
Changes in 5.10.52 certs: add 'x509_revocation_list' to gitignore cifs: handle reconnect of tcon when there is no cached dfs referral KVM: mmio: Fix use-after-free Read in kvm_vm_ioctl_unregister_coalesced_mmio KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled KVM: x86/mmu: Do not apply HPA (memory encryption) mask to GPAs KVM: nSVM: Check the value written to MSR_VM_HSAVE_PA KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run() scsi: core: Fix bad pointer dereference when ehandler kthread is invalid scsi: zfcp: Report port fc_security as unknown early during remote cable pull tracing: Do not reference char * as a string in histograms drm/i915/gtt: drop the page table optimisation drm/i915/gt: Fix -EDEADLK handling regression cgroup: verify that source is a string fbmem: Do not delete the mode that is still in use drm/dp_mst: Do not set proposed vcpi directly drm/dp_mst: Avoid to mess up payload table by ports in stale topology drm/dp_mst: Add missing drm parameters to recently added call to drm_dbg_kms() drm/ingenic: Fix non-OSD mode drm/ingenic: Switch IPU plane to type OVERLAY Revert "drm/ast: Remove reference to struct drm_device.pdev" net: bridge: multicast: fix PIM hello router port marking race net: bridge: multicast: fix MRD advertisement router port marking race leds: tlc591xx: fix return value check in tlc591xx_probe() ASoC: Intel: sof_sdw: add mutual exclusion between PCH DMIC and RT715 dmaengine: fsl-qdma: check dma_set_mask return value scsi: arcmsr: Fix the wrong CDB payload report to IOP srcu: Fix broken node geometry after early ssp init rcu: Reject RCU_LOCKDEP_WARN() false positives tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero serial: fsl_lpuart: disable DMA for console and fix sysrq misc/libmasm/module: Fix two use after free in ibmasm_init_one misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge ASoC: intel/boards: add missing MODULE_DEVICE_TABLE partitions: msdos: fix one-byte get_unaligned() iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get(). iio: magn: bmc150: Balance runtime pm + use pm_runtime_resume_and_get() ALSA: usx2y: Avoid camelCase ALSA: usx2y: Don't call free_pages_exact() with NULL address Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro" usb: common: usb-conn-gpio: fix NULL pointer dereference of charger w1: ds2438: fixing bug that would always get page0 scsi: arcmsr: Fix doorbell status being updated late on ARC-1886 scsi: hisi_sas: Propagate errors in interrupt_init_v1_hw() scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs scsi: core: Cap scsi_host cmd_per_lun at can_queue ALSA: ac97: fix PM reference leak in ac97_bus_remove() tty: serial: 8250: serial_cs: Fix a memory leak in error handling path scsi: mpt3sas: Fix deadlock while cancelling the running firmware event scsi: core: Fixup calling convention for scsi_mode_sense() scsi: scsi_dh_alua: Check for negative result value fs/jfs: Fix missing error code in lmLogInit() scsi: megaraid_sas: Fix resource leak in case of probe failure scsi: megaraid_sas: Early detection of VD deletion through RaidMap update scsi: megaraid_sas: Handle missing interrupts while re-enabling IRQs scsi: iscsi: Add iscsi_cls_conn refcount helpers scsi: iscsi: Fix conn use after free during resets scsi: iscsi: Fix shost->max_id use scsi: qedi: Fix null ref during abort handling scsi: qedi: Fix race during abort timeouts scsi: qedi: Fix TMF session block/unblock use scsi: qedi: Fix cleanup session block/unblock use mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE mfd: cpcap: Fix cpcap dmamask not set warnings ASoC: img: Fix PM reference leak in img_i2s_in_probe() fsi: Add missing MODULE_DEVICE_TABLE serial: tty: uartlite: fix console setup s390/sclp_vt220: fix console name to match device s390: disable SSP when needed selftests: timers: rtcpie: skip test if default RTC device does not exist ALSA: sb: Fix potential double-free of CSP mixer elements powerpc/ps3: Add dma_mask to ps3_dma_region iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get fails iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation ASoC: soc-pcm: fix the return value in dpcm_apply_symmetry() gpio: zynq: Check return value of pm_runtime_get_sync gpio: zynq: Check return value of irq_get_irq_data scsi: storvsc: Correctly handle multiple flags in srb_status ALSA: ppc: fix error return code in snd_pmac_probe() selftests/powerpc: Fix "no_handler" EBB selftest gpio: pca953x: Add support for the On Semi pca9655 powerpc/mm/book3s64: Fix possible build error ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing() habanalabs/gaudi: set the correct cpu_id on MME2_QM failure habanalabs: remove node from list before freeing the node s390/processor: always inline stap() and __load_psw_mask() s390/ipl_parm: fix program check new psw handling s390/mem_detect: fix diag260() program check new psw handling s390/mem_detect: fix tprot() program check new psw handling Input: hideep - fix the uninitialized use in hideep_nvm_unlock() ALSA: bebob: add support for ToneWeal FW66 ALSA: usb-audio: scarlett2: Fix 18i8 Gen 2 PCM Input count ALSA: usb-audio: scarlett2: Fix data_mutex lock ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return values usb: gadget: f_hid: fix endianness issue with descriptors usb: gadget: hid: fix error return code in hid_bind() powerpc/boot: Fixup device-tree on little endian ASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20 characters backlight: lm3630a: Fix return code of .update_status() callback ALSA: hda: Add IRQ check for platform_get_irq() ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptions ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol leds: turris-omnia: add missing MODULE_DEVICE_TABLE staging: rtl8723bs: fix macro value for 2.4Ghz only device intel_th: Wait until port is in reset before programming it i2c: core: Disable client irq on reboot/shutdown phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIP lib/decompress_unlz4.c: correctly handle zero-padding around initrds. kcov: add __no_sanitize_coverage to fix noinstr for all architectures power: supply: sc27xx: Add missing MODULE_DEVICE_TABLE power: supply: sc2731_charger: Add missing MODULE_DEVICE_TABLE pwm: spear: Don't modify HW state in .remove callback PCI: ftpci100: Rename macro name collision power: supply: ab8500: Avoid NULL pointers PCI: hv: Fix a race condition when removing the device power: supply: max17042: Do not enforce (incorrect) interrupt trigger type power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1 PCI/P2PDMA: Avoid pci_get_slot(), which may sleep NFSv4: Fix delegation return in cases where we have to retry PCI: pciehp: Ignore Link Down/Up caused by DPC watchdog: Fix possible use-after-free in wdt_startup() watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff() watchdog: Fix possible use-after-free by calling del_timer_sync() watchdog: imx_sc_wdt: fix pretimeout watchdog: iTCO_wdt: Account for rebooting on second timeout x86/fpu: Return proper error codes from user access functions remoteproc: core: Fix cdev remove and rproc del PCI: tegra: Add missing MODULE_DEVICE_TABLE orangefs: fix orangefs df output. ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty drm/gma500: Add the missed drm_gem_object_put() in psb_user_framebuffer_create() NFS: nfs_find_open_context() may only select open files power: supply: charger-manager: add missing MODULE_DEVICE_TABLE power: supply: ab8500: add missing MODULE_DEVICE_TABLE drm/amdkfd: fix sysfs kobj leak pwm: img: Fix PM reference leak in img_pwm_enable() pwm: tegra: Don't modify HW state in .remove callback ACPI: AMBA: Fix resource name in /proc/iomem ACPI: video: Add quirk for the Dell Vostro 3350 PCI: rockchip: Register IRQ handlers after device and data are ready virtio-blk: Fix memory leak among suspend/resume procedure virtio_net: Fix error handling in virtnet_restore() virtio_console: Assure used length from device is limited f2fs: atgc: fix to set default age threshold NFSD: Fix TP_printk() format specifier in nfsd_clid_class x86/signal: Detect and prevent an alternate signal stack overflow f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs f2fs: compress: fix to disallow temp extension remoteproc: k3-r5: Fix an error message PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun power: supply: rt5033_battery: Fix device tree enumeration NFSv4: Initialise connection to the server in nfs4_alloc_client() NFSv4: Fix an Oops in pnfs_mark_request_commit() when doing O_DIRECT misc: alcor_pci: fix inverted branch condition um: fix error return code in slip_open() um: fix error return code in winch_tramp() ubifs: Fix off-by-one error ubifs: journal: Fix error return code in ubifs_jnl_write_inode() watchdog: aspeed: fix hardware timeout calculation watchdog: jz4740: Fix return value check in jz4740_wdt_probe() SUNRPC: prevent port reuse on transports which don't request it. nfs: fix acl memory leak of posix_acl_create() ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode PCI: iproc: Fix multi-MSI base vector number allocation PCI: iproc: Support multi-MSI only on uniprocessor kernel f2fs: fix to avoid adding tab before doc section x86/fpu: Fix copy_xstate_to_kernel() gap handling x86/fpu: Limit xstate copy size in xstateregs_set() PCI: intel-gw: Fix INTx enable pwm: imx1: Don't disable clocks at device remove time PCI: tegra194: Fix tegra_pcie_ep_raise_msi_irq() ill-defined shift vdpa/mlx5: Fix umem sizes assignments on VQ create vdpa/mlx5: Fix possible failure in umem size calculation virtio_net: move tx vq operation under tx queue lock nvme-tcp: can't set sk_user_data without write_lock nfsd: Reduce contention for the nfsd_file nf_rwsem ALSA: isa: Fix error return code in snd_cmi8330_probe() vdpa/mlx5: Clear vq ready indication upon device reset NFSv4/pnfs: Fix the layout barrier update NFSv4/pnfs: Fix layoutget behaviour after invalidation NFSv4/pNFS: Don't call _nfs4_pnfs_v3_ds_connect multiple times hexagon: handle {,SOFT}IRQENTRY_TEXT in linker script hexagon: use common DISCARDS macro ARM: dts: gemini-rut1xx: remove duplicate ethernet node reset: RESET_BRCMSTB_RESCAL should depend on ARCH_BRCMSTB reset: RESET_INTEL_GW should depend on X86 reset: a10sr: add missing of_match_table reference ARM: exynos: add missing of_node_put for loop iteration ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3 ARM: dts: exynos: fix PWM LED max brightness on Odroid HC1 ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4 memory: stm32-fmc2-ebi: add missing of_node_put for loop iteration memory: atmel-ebi: add missing of_node_put for loop iteration reset: brcmstb: Add missing MODULE_DEVICE_TABLE memory: pl353: Fix error return code in pl353_smc_probe() ARM: dts: sun8i: h3: orangepi-plus: Fix ethernet phy-mode rtc: fix snprintf() checking in is_rtc_hctosys() arm64: dts: renesas: v3msk: Fix memory size ARM: dts: r8a7779, marzen: Fix DU clock names arm64: dts: ti: j7200-main: Enable USB2 PHY RX sensitivity workaround arm64: dts: renesas: Add missing opp-suspend properties arm64: dts: renesas: r8a7796[01]: Fix OPP table entry voltages ARM: dts: stm32: Connect PHY IRQ line on DH STM32MP1 SoM ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM arm64: dts: qcom: trogdor: Add no-hpd to DSI bridge node firmware: tegra: Fix error return code in tegra210_bpmp_init() firmware: arm_scmi: Reset Rx buffer to max size during async commands dt-bindings: i2c: at91: fix example for scl-gpios ARM: dts: BCM5301X: Fixup SPI binding reset: bail if try_module_get() fails arm64: dts: renesas: r8a779a0: Drop power-domains property from GIC node arm64: dts: ti: k3-j721e-main: Fix external refclk input to SERDES memory: fsl_ifc: fix leak of IO mapping on probe failure memory: fsl_ifc: fix leak of private memory on probe failure arm64: dts: allwinner: a64-sopine-baseboard: change RGMII mode to TXID ARM: dts: dra7: Fix duplicate USB4 target module node ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema ARM: dts: am437x: align ti,pindir-d0-out-d1-in property with dt-shema thermal/drivers/sprd: Add missing MODULE_DEVICE_TABLE ARM: dts: imx6q-dhcom: Fix ethernet reset time properties ARM: dts: imx6q-dhcom: Fix ethernet plugin detection problems ARM: dts: imx6q-dhcom: Add gpios pinctrl for i2c bus recovery thermal/drivers/rcar_gen3_thermal: Fix coefficient calculations firmware: turris-mox-rwtm: fix reply status decoding function firmware: turris-mox-rwtm: report failures better firmware: turris-mox-rwtm: fail probing when firmware does not support hwrng firmware: turris-mox-rwtm: show message about HWRNG registration arm64: dts: rockchip: Re-add regulator-boot-on, regulator-always-on for vdd_gpu on rk3399-roc-pc arm64: dts: rockchip: Re-add regulator-always-on for vcc_sdio for rk3399-roc-pc scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe() sched/uclamp: Ignore max aggregation if rq is idle jump_label: Fix jump_label_text_reserved() vs __init static_call: Fix static_call_text_reserved() vs __init mips: always link byteswap helpers into decompressor mips: disable branch profiling in boot/decompress.o MIPS: vdso: Invalid GIC access through VDSO scsi: scsi_dh_alua: Fix signedness bug in alua_rtpg() seq_file: disallow extremely large seq buffer allocations Linux 5.10.52 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ic1b04661728db8b0e060ca6935783e15a22210da
733 lines
20 KiB
C
733 lines
20 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_SCHED_SIGNAL_H
|
|
#define _LINUX_SCHED_SIGNAL_H
|
|
|
|
#include <linux/rculist.h>
|
|
#include <linux/signal.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/sched/jobctl.h>
|
|
#include <linux/sched/task.h>
|
|
#include <linux/cred.h>
|
|
#include <linux/refcount.h>
|
|
#include <linux/posix-timers.h>
|
|
#include <linux/mm_types.h>
|
|
#include <asm/ptrace.h>
|
|
#include <linux/android_kabi.h>
|
|
|
|
/*
|
|
* Types defining task->signal and task->sighand and APIs using them:
|
|
*/
|
|
|
|
struct sighand_struct {
|
|
spinlock_t siglock;
|
|
refcount_t count;
|
|
wait_queue_head_t signalfd_wqh;
|
|
struct k_sigaction action[_NSIG];
|
|
};
|
|
|
|
/*
|
|
* Per-process accounting stats:
|
|
*/
|
|
struct pacct_struct {
|
|
int ac_flag;
|
|
long ac_exitcode;
|
|
unsigned long ac_mem;
|
|
u64 ac_utime, ac_stime;
|
|
unsigned long ac_minflt, ac_majflt;
|
|
};
|
|
|
|
struct cpu_itimer {
|
|
u64 expires;
|
|
u64 incr;
|
|
};
|
|
|
|
/*
|
|
* This is the atomic variant of task_cputime, which can be used for
|
|
* storing and updating task_cputime statistics without locking.
|
|
*/
|
|
struct task_cputime_atomic {
|
|
atomic64_t utime;
|
|
atomic64_t stime;
|
|
atomic64_t sum_exec_runtime;
|
|
};
|
|
|
|
#define INIT_CPUTIME_ATOMIC \
|
|
(struct task_cputime_atomic) { \
|
|
.utime = ATOMIC64_INIT(0), \
|
|
.stime = ATOMIC64_INIT(0), \
|
|
.sum_exec_runtime = ATOMIC64_INIT(0), \
|
|
}
|
|
/**
|
|
* struct thread_group_cputimer - thread group interval timer counts
|
|
* @cputime_atomic: atomic thread group interval timers.
|
|
*
|
|
* This structure contains the version of task_cputime, above, that is
|
|
* used for thread group CPU timer calculations.
|
|
*/
|
|
struct thread_group_cputimer {
|
|
struct task_cputime_atomic cputime_atomic;
|
|
};
|
|
|
|
struct multiprocess_signals {
|
|
sigset_t signal;
|
|
struct hlist_node node;
|
|
};
|
|
|
|
/*
|
|
* NOTE! "signal_struct" does not have its own
|
|
* locking, because a shared signal_struct always
|
|
* implies a shared sighand_struct, so locking
|
|
* sighand_struct is always a proper superset of
|
|
* the locking of signal_struct.
|
|
*/
|
|
struct signal_struct {
|
|
refcount_t sigcnt;
|
|
atomic_t live;
|
|
int nr_threads;
|
|
struct list_head thread_head;
|
|
|
|
wait_queue_head_t wait_chldexit; /* for wait4() */
|
|
|
|
/* current thread group signal load-balancing target: */
|
|
struct task_struct *curr_target;
|
|
|
|
/* shared signal handling: */
|
|
struct sigpending shared_pending;
|
|
|
|
/* For collecting multiprocess signals during fork */
|
|
struct hlist_head multiprocess;
|
|
|
|
/* thread group exit support */
|
|
int group_exit_code;
|
|
/* overloaded:
|
|
* - notify group_exit_task when ->count is equal to notify_count
|
|
* - everyone except group_exit_task is stopped during signal delivery
|
|
* of fatal signals, group_exit_task processes the signal.
|
|
*/
|
|
int notify_count;
|
|
struct task_struct *group_exit_task;
|
|
|
|
/* thread group stop support, overloads group_exit_code too */
|
|
int group_stop_count;
|
|
unsigned int flags; /* see SIGNAL_* flags below */
|
|
|
|
/*
|
|
* PR_SET_CHILD_SUBREAPER marks a process, like a service
|
|
* manager, to re-parent orphan (double-forking) child processes
|
|
* to this process instead of 'init'. The service manager is
|
|
* able to receive SIGCHLD signals and is able to investigate
|
|
* the process until it calls wait(). All children of this
|
|
* process will inherit a flag if they should look for a
|
|
* child_subreaper process at exit.
|
|
*/
|
|
unsigned int is_child_subreaper:1;
|
|
unsigned int has_child_subreaper:1;
|
|
|
|
#ifdef CONFIG_POSIX_TIMERS
|
|
|
|
/* POSIX.1b Interval Timers */
|
|
int posix_timer_id;
|
|
struct list_head posix_timers;
|
|
|
|
/* ITIMER_REAL timer for the process */
|
|
struct hrtimer real_timer;
|
|
ktime_t it_real_incr;
|
|
|
|
/*
|
|
* ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use
|
|
* CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these
|
|
* values are defined to 0 and 1 respectively
|
|
*/
|
|
struct cpu_itimer it[2];
|
|
|
|
/*
|
|
* Thread group totals for process CPU timers.
|
|
* See thread_group_cputimer(), et al, for details.
|
|
*/
|
|
struct thread_group_cputimer cputimer;
|
|
|
|
#endif
|
|
/* Empty if CONFIG_POSIX_TIMERS=n */
|
|
struct posix_cputimers posix_cputimers;
|
|
|
|
/* PID/PID hash table linkage. */
|
|
struct pid *pids[PIDTYPE_MAX];
|
|
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
atomic_t tick_dep_mask;
|
|
#endif
|
|
|
|
struct pid *tty_old_pgrp;
|
|
|
|
/* boolean value for session group leader */
|
|
int leader;
|
|
|
|
struct tty_struct *tty; /* NULL if no tty */
|
|
|
|
#ifdef CONFIG_SCHED_AUTOGROUP
|
|
struct autogroup *autogroup;
|
|
#endif
|
|
/*
|
|
* Cumulative resource counters for dead threads in the group,
|
|
* and for reaped dead child processes forked by this group.
|
|
* Live threads maintain their own counters and add to these
|
|
* in __exit_signal, except for the group leader.
|
|
*/
|
|
seqlock_t stats_lock;
|
|
u64 utime, stime, cutime, cstime;
|
|
u64 gtime;
|
|
u64 cgtime;
|
|
struct prev_cputime prev_cputime;
|
|
unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
|
|
unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
|
|
unsigned long inblock, oublock, cinblock, coublock;
|
|
unsigned long maxrss, cmaxrss;
|
|
struct task_io_accounting ioac;
|
|
|
|
/*
|
|
* Cumulative ns of schedule CPU time fo dead threads in the
|
|
* group, not including a zombie group leader, (This only differs
|
|
* from jiffies_to_ns(utime + stime) if sched_clock uses something
|
|
* other than jiffies.)
|
|
*/
|
|
unsigned long long sum_sched_runtime;
|
|
|
|
/*
|
|
* We don't bother to synchronize most readers of this at all,
|
|
* because there is no reader checking a limit that actually needs
|
|
* to get both rlim_cur and rlim_max atomically, and either one
|
|
* alone is a single word that can safely be read normally.
|
|
* getrlimit/setrlimit use task_lock(current->group_leader) to
|
|
* protect this instead of the siglock, because they really
|
|
* have no need to disable irqs.
|
|
*/
|
|
struct rlimit rlim[RLIM_NLIMITS];
|
|
|
|
#ifdef CONFIG_BSD_PROCESS_ACCT
|
|
struct pacct_struct pacct; /* per-process accounting information */
|
|
#endif
|
|
#ifdef CONFIG_TASKSTATS
|
|
struct taskstats *stats;
|
|
#endif
|
|
#ifdef CONFIG_AUDIT
|
|
unsigned audit_tty;
|
|
struct tty_audit_buf *tty_audit_buf;
|
|
#endif
|
|
|
|
/*
|
|
* Thread is the potential origin of an oom condition; kill first on
|
|
* oom
|
|
*/
|
|
bool oom_flag_origin;
|
|
short oom_score_adj; /* OOM kill score adjustment */
|
|
short oom_score_adj_min; /* OOM kill score adjustment min value.
|
|
* Only settable by CAP_SYS_RESOURCE. */
|
|
struct mm_struct *oom_mm; /* recorded mm when the thread group got
|
|
* killed by the oom killer */
|
|
|
|
struct mutex cred_guard_mutex; /* guard against foreign influences on
|
|
* credential calculations
|
|
* (notably. ptrace)
|
|
* Deprecated do not use in new code.
|
|
* Use exec_update_lock instead.
|
|
*/
|
|
struct rw_semaphore exec_update_lock; /* Held while task_struct is
|
|
* being updated during exec,
|
|
* and may have inconsistent
|
|
* permissions.
|
|
*/
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
} __randomize_layout;
|
|
|
|
/*
|
|
* Bits in flags field of signal_struct.
|
|
*/
|
|
#define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */
|
|
#define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */
|
|
#define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */
|
|
#define SIGNAL_GROUP_COREDUMP 0x00000008 /* coredump in progress */
|
|
/*
|
|
* Pending notifications to parent.
|
|
*/
|
|
#define SIGNAL_CLD_STOPPED 0x00000010
|
|
#define SIGNAL_CLD_CONTINUED 0x00000020
|
|
#define SIGNAL_CLD_MASK (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED)
|
|
|
|
#define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */
|
|
|
|
#define SIGNAL_STOP_MASK (SIGNAL_CLD_MASK | SIGNAL_STOP_STOPPED | \
|
|
SIGNAL_STOP_CONTINUED)
|
|
|
|
static inline void signal_set_stop_flags(struct signal_struct *sig,
|
|
unsigned int flags)
|
|
{
|
|
WARN_ON(sig->flags & (SIGNAL_GROUP_EXIT|SIGNAL_GROUP_COREDUMP));
|
|
sig->flags = (sig->flags & ~SIGNAL_STOP_MASK) | flags;
|
|
}
|
|
|
|
/* If true, all threads except ->group_exit_task have pending SIGKILL */
|
|
static inline int signal_group_exit(const struct signal_struct *sig)
|
|
{
|
|
return (sig->flags & SIGNAL_GROUP_EXIT) ||
|
|
(sig->group_exit_task != NULL);
|
|
}
|
|
|
|
extern void flush_signals(struct task_struct *);
|
|
extern void ignore_signals(struct task_struct *);
|
|
extern void flush_signal_handlers(struct task_struct *, int force_default);
|
|
extern int dequeue_signal(struct task_struct *task,
|
|
sigset_t *mask, kernel_siginfo_t *info);
|
|
|
|
static inline int kernel_dequeue_signal(void)
|
|
{
|
|
struct task_struct *task = current;
|
|
kernel_siginfo_t __info;
|
|
int ret;
|
|
|
|
spin_lock_irq(&task->sighand->siglock);
|
|
ret = dequeue_signal(task, &task->blocked, &__info);
|
|
spin_unlock_irq(&task->sighand->siglock);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static inline void kernel_signal_stop(void)
|
|
{
|
|
spin_lock_irq(¤t->sighand->siglock);
|
|
if (current->jobctl & JOBCTL_STOP_DEQUEUED)
|
|
set_special_state(TASK_STOPPED);
|
|
spin_unlock_irq(¤t->sighand->siglock);
|
|
|
|
schedule();
|
|
}
|
|
#ifdef __ARCH_SI_TRAPNO
|
|
# define ___ARCH_SI_TRAPNO(_a1) , _a1
|
|
#else
|
|
# define ___ARCH_SI_TRAPNO(_a1)
|
|
#endif
|
|
#ifdef __ia64__
|
|
# define ___ARCH_SI_IA64(_a1, _a2, _a3) , _a1, _a2, _a3
|
|
#else
|
|
# define ___ARCH_SI_IA64(_a1, _a2, _a3)
|
|
#endif
|
|
|
|
int force_sig_fault_to_task(int sig, int code, void __user *addr
|
|
___ARCH_SI_TRAPNO(int trapno)
|
|
___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)
|
|
, struct task_struct *t);
|
|
int force_sig_fault(int sig, int code, void __user *addr
|
|
___ARCH_SI_TRAPNO(int trapno)
|
|
___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr));
|
|
int send_sig_fault(int sig, int code, void __user *addr
|
|
___ARCH_SI_TRAPNO(int trapno)
|
|
___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)
|
|
, struct task_struct *t);
|
|
|
|
int force_sig_mceerr(int code, void __user *, short);
|
|
int send_sig_mceerr(int code, void __user *, short, struct task_struct *);
|
|
|
|
int force_sig_bnderr(void __user *addr, void __user *lower, void __user *upper);
|
|
int force_sig_pkuerr(void __user *addr, u32 pkey);
|
|
|
|
int force_sig_ptrace_errno_trap(int errno, void __user *addr);
|
|
|
|
extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
|
|
extern void force_sigsegv(int sig);
|
|
extern int force_sig_info(struct kernel_siginfo *);
|
|
extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp);
|
|
extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid);
|
|
extern int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr, struct pid *,
|
|
const struct cred *);
|
|
extern int kill_pgrp(struct pid *pid, int sig, int priv);
|
|
extern int kill_pid(struct pid *pid, int sig, int priv);
|
|
extern __must_check bool do_notify_parent(struct task_struct *, int);
|
|
extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
|
|
extern void force_sig(int);
|
|
extern int send_sig(int, struct task_struct *, int);
|
|
extern int zap_other_threads(struct task_struct *p);
|
|
extern struct sigqueue *sigqueue_alloc(void);
|
|
extern void sigqueue_free(struct sigqueue *);
|
|
extern int send_sigqueue(struct sigqueue *, struct pid *, enum pid_type);
|
|
extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
|
|
|
|
static inline int restart_syscall(void)
|
|
{
|
|
set_tsk_thread_flag(current, TIF_SIGPENDING);
|
|
return -ERESTARTNOINTR;
|
|
}
|
|
|
|
static inline int signal_pending(struct task_struct *p)
|
|
{
|
|
return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
|
|
}
|
|
|
|
static inline int __fatal_signal_pending(struct task_struct *p)
|
|
{
|
|
return unlikely(sigismember(&p->pending.signal, SIGKILL));
|
|
}
|
|
|
|
static inline int fatal_signal_pending(struct task_struct *p)
|
|
{
|
|
return signal_pending(p) && __fatal_signal_pending(p);
|
|
}
|
|
|
|
static inline int signal_pending_state(long state, struct task_struct *p)
|
|
{
|
|
if (!(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
|
|
return 0;
|
|
if (!signal_pending(p))
|
|
return 0;
|
|
|
|
return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
|
|
}
|
|
|
|
/*
|
|
* This should only be used in fault handlers to decide whether we
|
|
* should stop the current fault routine to handle the signals
|
|
* instead, especially with the case where we've got interrupted with
|
|
* a VM_FAULT_RETRY.
|
|
*/
|
|
static inline bool fault_signal_pending(vm_fault_t fault_flags,
|
|
struct pt_regs *regs)
|
|
{
|
|
return unlikely((fault_flags & VM_FAULT_RETRY) &&
|
|
(fatal_signal_pending(current) ||
|
|
(user_mode(regs) && signal_pending(current))));
|
|
}
|
|
|
|
/*
|
|
* Reevaluate whether the task has signals pending delivery.
|
|
* Wake the task if so.
|
|
* This is required every time the blocked sigset_t changes.
|
|
* callers must hold sighand->siglock.
|
|
*/
|
|
extern void recalc_sigpending_and_wake(struct task_struct *t);
|
|
extern void recalc_sigpending(void);
|
|
extern void calculate_sigpending(void);
|
|
|
|
extern void signal_wake_up_state(struct task_struct *t, unsigned int state);
|
|
|
|
static inline void signal_wake_up(struct task_struct *t, bool resume)
|
|
{
|
|
signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0);
|
|
}
|
|
static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume)
|
|
{
|
|
signal_wake_up_state(t, resume ? __TASK_TRACED : 0);
|
|
}
|
|
|
|
void task_join_group_stop(struct task_struct *task);
|
|
|
|
#ifdef TIF_RESTORE_SIGMASK
|
|
/*
|
|
* Legacy restore_sigmask accessors. These are inefficient on
|
|
* SMP architectures because they require atomic operations.
|
|
*/
|
|
|
|
/**
|
|
* set_restore_sigmask() - make sure saved_sigmask processing gets done
|
|
*
|
|
* This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code
|
|
* will run before returning to user mode, to process the flag. For
|
|
* all callers, TIF_SIGPENDING is already set or it's no harm to set
|
|
* it. TIF_RESTORE_SIGMASK need not be in the set of bits that the
|
|
* arch code will notice on return to user mode, in case those bits
|
|
* are scarce. We set TIF_SIGPENDING here to ensure that the arch
|
|
* signal code always gets run when TIF_RESTORE_SIGMASK is set.
|
|
*/
|
|
static inline void set_restore_sigmask(void)
|
|
{
|
|
set_thread_flag(TIF_RESTORE_SIGMASK);
|
|
}
|
|
|
|
static inline void clear_tsk_restore_sigmask(struct task_struct *task)
|
|
{
|
|
clear_tsk_thread_flag(task, TIF_RESTORE_SIGMASK);
|
|
}
|
|
|
|
static inline void clear_restore_sigmask(void)
|
|
{
|
|
clear_thread_flag(TIF_RESTORE_SIGMASK);
|
|
}
|
|
static inline bool test_tsk_restore_sigmask(struct task_struct *task)
|
|
{
|
|
return test_tsk_thread_flag(task, TIF_RESTORE_SIGMASK);
|
|
}
|
|
static inline bool test_restore_sigmask(void)
|
|
{
|
|
return test_thread_flag(TIF_RESTORE_SIGMASK);
|
|
}
|
|
static inline bool test_and_clear_restore_sigmask(void)
|
|
{
|
|
return test_and_clear_thread_flag(TIF_RESTORE_SIGMASK);
|
|
}
|
|
|
|
#else /* TIF_RESTORE_SIGMASK */
|
|
|
|
/* Higher-quality implementation, used if TIF_RESTORE_SIGMASK doesn't exist. */
|
|
static inline void set_restore_sigmask(void)
|
|
{
|
|
current->restore_sigmask = true;
|
|
}
|
|
static inline void clear_tsk_restore_sigmask(struct task_struct *task)
|
|
{
|
|
task->restore_sigmask = false;
|
|
}
|
|
static inline void clear_restore_sigmask(void)
|
|
{
|
|
current->restore_sigmask = false;
|
|
}
|
|
static inline bool test_restore_sigmask(void)
|
|
{
|
|
return current->restore_sigmask;
|
|
}
|
|
static inline bool test_tsk_restore_sigmask(struct task_struct *task)
|
|
{
|
|
return task->restore_sigmask;
|
|
}
|
|
static inline bool test_and_clear_restore_sigmask(void)
|
|
{
|
|
if (!current->restore_sigmask)
|
|
return false;
|
|
current->restore_sigmask = false;
|
|
return true;
|
|
}
|
|
#endif
|
|
|
|
static inline void restore_saved_sigmask(void)
|
|
{
|
|
if (test_and_clear_restore_sigmask())
|
|
__set_current_blocked(¤t->saved_sigmask);
|
|
}
|
|
|
|
extern int set_user_sigmask(const sigset_t __user *umask, size_t sigsetsize);
|
|
|
|
static inline void restore_saved_sigmask_unless(bool interrupted)
|
|
{
|
|
if (interrupted)
|
|
WARN_ON(!test_thread_flag(TIF_SIGPENDING));
|
|
else
|
|
restore_saved_sigmask();
|
|
}
|
|
|
|
static inline sigset_t *sigmask_to_save(void)
|
|
{
|
|
sigset_t *res = ¤t->blocked;
|
|
if (unlikely(test_restore_sigmask()))
|
|
res = ¤t->saved_sigmask;
|
|
return res;
|
|
}
|
|
|
|
static inline int kill_cad_pid(int sig, int priv)
|
|
{
|
|
return kill_pid(cad_pid, sig, priv);
|
|
}
|
|
|
|
/* These can be the second arg to send_sig_info/send_group_sig_info. */
|
|
#define SEND_SIG_NOINFO ((struct kernel_siginfo *) 0)
|
|
#define SEND_SIG_PRIV ((struct kernel_siginfo *) 1)
|
|
|
|
static inline int __on_sig_stack(unsigned long sp)
|
|
{
|
|
#ifdef CONFIG_STACK_GROWSUP
|
|
return sp >= current->sas_ss_sp &&
|
|
sp - current->sas_ss_sp < current->sas_ss_size;
|
|
#else
|
|
return sp > current->sas_ss_sp &&
|
|
sp - current->sas_ss_sp <= current->sas_ss_size;
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* True if we are on the alternate signal stack.
|
|
*/
|
|
static inline int on_sig_stack(unsigned long sp)
|
|
{
|
|
/*
|
|
* If the signal stack is SS_AUTODISARM then, by construction, we
|
|
* can't be on the signal stack unless user code deliberately set
|
|
* SS_AUTODISARM when we were already on it.
|
|
*
|
|
* This improves reliability: if user state gets corrupted such that
|
|
* the stack pointer points very close to the end of the signal stack,
|
|
* then this check will enable the signal to be handled anyway.
|
|
*/
|
|
if (current->sas_ss_flags & SS_AUTODISARM)
|
|
return 0;
|
|
|
|
return __on_sig_stack(sp);
|
|
}
|
|
|
|
static inline int sas_ss_flags(unsigned long sp)
|
|
{
|
|
if (!current->sas_ss_size)
|
|
return SS_DISABLE;
|
|
|
|
return on_sig_stack(sp) ? SS_ONSTACK : 0;
|
|
}
|
|
|
|
static inline void sas_ss_reset(struct task_struct *p)
|
|
{
|
|
p->sas_ss_sp = 0;
|
|
p->sas_ss_size = 0;
|
|
p->sas_ss_flags = SS_DISABLE;
|
|
}
|
|
|
|
static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
|
|
{
|
|
if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp))
|
|
#ifdef CONFIG_STACK_GROWSUP
|
|
return current->sas_ss_sp;
|
|
#else
|
|
return current->sas_ss_sp + current->sas_ss_size;
|
|
#endif
|
|
return sp;
|
|
}
|
|
|
|
extern void __cleanup_sighand(struct sighand_struct *);
|
|
extern void flush_itimer_signals(void);
|
|
|
|
#define tasklist_empty() \
|
|
list_empty(&init_task.tasks)
|
|
|
|
#define next_task(p) \
|
|
list_entry_rcu((p)->tasks.next, struct task_struct, tasks)
|
|
|
|
#define for_each_process(p) \
|
|
for (p = &init_task ; (p = next_task(p)) != &init_task ; )
|
|
|
|
extern bool current_is_single_threaded(void);
|
|
|
|
/*
|
|
* Careful: do_each_thread/while_each_thread is a double loop so
|
|
* 'break' will not work as expected - use goto instead.
|
|
*/
|
|
#define do_each_thread(g, t) \
|
|
for (g = t = &init_task ; (g = t = next_task(g)) != &init_task ; ) do
|
|
|
|
#define while_each_thread(g, t) \
|
|
while ((t = next_thread(t)) != g)
|
|
|
|
#define __for_each_thread(signal, t) \
|
|
list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
|
|
|
|
#define for_each_thread(p, t) \
|
|
__for_each_thread((p)->signal, t)
|
|
|
|
/* Careful: this is a double loop, 'break' won't work as expected. */
|
|
#define for_each_process_thread(p, t) \
|
|
for_each_process(p) for_each_thread(p, t)
|
|
|
|
typedef int (*proc_visitor)(struct task_struct *p, void *data);
|
|
void walk_process_tree(struct task_struct *top, proc_visitor, void *);
|
|
|
|
static inline
|
|
struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
|
|
{
|
|
struct pid *pid;
|
|
if (type == PIDTYPE_PID)
|
|
pid = task_pid(task);
|
|
else
|
|
pid = task->signal->pids[type];
|
|
return pid;
|
|
}
|
|
|
|
static inline struct pid *task_tgid(struct task_struct *task)
|
|
{
|
|
return task->signal->pids[PIDTYPE_TGID];
|
|
}
|
|
|
|
/*
|
|
* Without tasklist or RCU lock it is not safe to dereference
|
|
* the result of task_pgrp/task_session even if task == current,
|
|
* we can race with another thread doing sys_setsid/sys_setpgid.
|
|
*/
|
|
static inline struct pid *task_pgrp(struct task_struct *task)
|
|
{
|
|
return task->signal->pids[PIDTYPE_PGID];
|
|
}
|
|
|
|
static inline struct pid *task_session(struct task_struct *task)
|
|
{
|
|
return task->signal->pids[PIDTYPE_SID];
|
|
}
|
|
|
|
static inline int get_nr_threads(struct task_struct *task)
|
|
{
|
|
return task->signal->nr_threads;
|
|
}
|
|
|
|
static inline bool thread_group_leader(struct task_struct *p)
|
|
{
|
|
return p->exit_signal >= 0;
|
|
}
|
|
|
|
static inline
|
|
bool same_thread_group(struct task_struct *p1, struct task_struct *p2)
|
|
{
|
|
return p1->signal == p2->signal;
|
|
}
|
|
|
|
static inline struct task_struct *next_thread(const struct task_struct *p)
|
|
{
|
|
return list_entry_rcu(p->thread_group.next,
|
|
struct task_struct, thread_group);
|
|
}
|
|
|
|
static inline int thread_group_empty(struct task_struct *p)
|
|
{
|
|
return list_empty(&p->thread_group);
|
|
}
|
|
|
|
#define delay_group_leader(p) \
|
|
(thread_group_leader(p) && !thread_group_empty(p))
|
|
|
|
extern bool thread_group_exited(struct pid *pid);
|
|
|
|
extern struct sighand_struct *__lock_task_sighand(struct task_struct *task,
|
|
unsigned long *flags);
|
|
|
|
static inline struct sighand_struct *lock_task_sighand(struct task_struct *task,
|
|
unsigned long *flags)
|
|
{
|
|
struct sighand_struct *ret;
|
|
|
|
ret = __lock_task_sighand(task, flags);
|
|
(void)__cond_lock(&task->sighand->siglock, ret);
|
|
return ret;
|
|
}
|
|
|
|
static inline void unlock_task_sighand(struct task_struct *task,
|
|
unsigned long *flags)
|
|
{
|
|
spin_unlock_irqrestore(&task->sighand->siglock, *flags);
|
|
}
|
|
|
|
static inline unsigned long task_rlimit(const struct task_struct *task,
|
|
unsigned int limit)
|
|
{
|
|
return READ_ONCE(task->signal->rlim[limit].rlim_cur);
|
|
}
|
|
|
|
static inline unsigned long task_rlimit_max(const struct task_struct *task,
|
|
unsigned int limit)
|
|
{
|
|
return READ_ONCE(task->signal->rlim[limit].rlim_max);
|
|
}
|
|
|
|
static inline unsigned long rlimit(unsigned int limit)
|
|
{
|
|
return task_rlimit(current, limit);
|
|
}
|
|
|
|
static inline unsigned long rlimit_max(unsigned int limit)
|
|
{
|
|
return task_rlimit_max(current, limit);
|
|
}
|
|
|
|
#endif /* _LINUX_SCHED_SIGNAL_H */
|