OrangePi_CM5/fs
Eric W. Biederman b25b8c55ba UPSTREAM: coredump: Limit what can interrupt coredumps
[ Upstream commit 06af8679449d4ed282df13191fc52d5ba28ec536 ]

Olivier Langlois has been struggling with coredumps being incompletely written in
processes using io_uring.

Olivier Langlois <olivier@trillion01.com> writes:
> io_uring is a big user of task_work and any event that io_uring made a
> task waiting for that occurs during the core dump generation will
> generate a TIF_NOTIFY_SIGNAL.
>
> Here are the detailed steps of the problem:
> 1. io_uring calls vfs_poll() to install a task to a file wait queue
>    with io_async_wake() as the wakeup function cb from io_arm_poll_handler()
> 2. wakeup function ends up calling task_work_add() with TWA_SIGNAL
> 3. task_work_add() sets the TIF_NOTIFY_SIGNAL bit by calling
>    set_notify_signal()

The coredump code deliberately supports being interrupted by SIGKILL,
and depends upon prepare_signal to filter out all other signals.   Now
that signal_pending includes wake ups for TIF_NOTIFY_SIGNAL this hack
in dump_emitted by the coredump code no longer works.

Make the coredump code more robust by explicitly testing for all of
the wakeup conditions the coredump code supports.  This prevents
new wakeup conditions from breaking the coredump code, as well
as fixing the current issue.

The filesystem code that the coredump code uses already limits
itself to only aborting on fatal_signal_pending.  So it should
not develop surprising wake-up reasons either.

v2: Don't remove the now unnecessary code in prepare_signal.

Cc: stable@vger.kernel.org
Fixes: 12db8b690010 ("entry: Add support for TIF_NOTIFY_SIGNAL")
Reported-by: Olivier Langlois <olivier@trillion01.com>
Change-Id: I84870bf0a620a97af50d9b495dd225f9ee2b66b8
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 4b4d2c79921a8327e9e853dc93c06b27edb3a859)
Bug: 268174392
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-02-07 13:38:13 +00:00
..
9p This is the 5.10.124 stable release 2022-07-28 15:53:46 +02:00
adfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
affs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
afs This is the 5.10.158 stable release 2022-12-08 16:39:44 +00:00
autofs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
befs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
bfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
btrfs This is the 5.10.159 stable release 2022-12-14 13:11:31 +01:00
cachefiles ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
ceph This is the 5.10.157 stable release 2022-12-04 12:51:21 +00:00
cifs This is the 5.10.156 stable release 2022-12-02 08:42:05 +00:00
coda ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
configfs This is the 5.10.103 stable release 2022-03-02 15:41:32 +01:00
cramfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
crypto ANDROID: abi preservation for fscrypt change in 5.10.154 2022-12-01 16:47:19 +00:00
debugfs debugfs: add debugfs_lookup_and_remove() 2022-09-15 11:32:03 +02:00
devpts fsnotify: fix fsnotify hooks in pseudo filesystems 2022-02-01 17:25:39 +01:00
dlm fs: dlm: handle -EBUSY first in lock arg validation 2022-10-26 13:25:08 +02:00
ecryptfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
efivarfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
efs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
erofs Merge branch 'android12-5.10' into branch 'android12-5.10-lts' 2022-10-01 14:58:20 +02:00
exfat Merge branch 'android12-5.10' into branch 'android12-5.10-lts' 2022-08-16 14:34:54 +02:00
exportfs
ext2 This is the 5.10.137 stable release 2022-08-29 16:53:14 +02:00
ext4 Merge tag 'android12-5.10.160_r00' into android12-5.10 2023-01-21 12:06:54 +00:00
f2fs BACKPORT: f2fs: do not allow to decompress files have FI_COMPRESS_RELEASED 2023-02-03 18:44:20 +00:00
fat This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
freevxfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
fscache ANDROID: GKI: set more vfs-only exports into their own namespace 2022-04-07 20:52:29 +02:00
fuse Merge tag 'android12-5.10.160_r00' into android12-5.10 2023-01-21 12:06:54 +00:00
gfs2 This is the 5.10.156 stable release 2022-12-02 08:42:05 +00:00
hfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
hfsplus ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
hostfs hostfs: fix memory handling in follow_link() 2021-04-14 08:42:06 +02:00
hpfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
hugetlbfs mm, hugetlb: allow for "high" userspace addresses 2022-04-27 13:53:54 +02:00
incfs ANDROID: incfs: Add check for ATTR_KILL_SUID and ATTR_MODE in incfs_setattr 2022-09-19 16:16:16 +00:00
iomap This is the 5.10.129 stable release 2022-07-28 16:55:29 +02:00
isofs Merge tag 'android12-5.10.81_r00' into android12-5.10 2022-01-21 09:35:04 +01:00
jbd2 This is the 5.10.150 stable release 2022-11-15 19:14:08 +00:00
jffs2 This is the 5.10.122 stable release 2022-07-28 15:05:26 +02:00
jfs This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
kernfs This is the 5.10.153 stable release 2022-11-21 15:47:06 +00:00
lockd lockd: lockd server-side shouldn't set fl_ops 2021-09-18 13:40:30 +02:00
minix This is the 5.10.111 stable release 2022-04-21 14:27:41 +02:00
nfs This is the 5.10.156 stable release 2022-12-02 08:42:05 +00:00
nfs_common nfs_common: need lock during iterate through the list 2020-12-30 11:53:45 +01:00
nfsd This is the 5.10.160 stable release 2022-12-20 12:38:28 +00:00
nilfs2 This is the 5.10.158 stable release 2022-12-08 16:39:44 +00:00
nls ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
notify This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
ntfs This is the 5.10.156 stable release 2022-12-02 08:42:05 +00:00
ocfs2 This is the 5.10.152 stable release 2022-11-21 15:46:22 +00:00
omfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
openpromfs
orangefs Merge tag 'android12-5.10.81_r00' into android12-5.10 2022-01-21 09:35:04 +01:00
overlayfs This is the 5.10.137 stable release 2022-08-29 16:53:14 +02:00
proc This is the 5.10.152 stable release 2022-11-21 15:46:22 +00:00
pstore UPSTREAM: pstore: Properly assign mem_type property 2023-01-15 12:14:49 +01:00
qnx4 Merge tag 'android12-5.10.81_r00' into android12-5.10 2022-01-21 09:35:04 +01:00
qnx6 ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
quota quota: Check next/prev free block number after reading from quota file 2022-10-26 13:25:09 +02:00
ramfs ramfs: fix nommu mmap with gaps in the page cache 2020-10-16 11:11:22 -07:00
reiserfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
romfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
squashfs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
sysfs
sysv ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
tracefs This is the 5.10.144 stable release 2022-09-22 14:50:45 +02:00
ubifs This is the 5.10.111 stable release 2022-04-21 14:27:41 +02:00
udf Merge 5.10.155 into android12-5.10-lts 2022-12-02 08:40:37 +00:00
ufs ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
unicode
vboxsf Merge tag 'android12-5.10.81_r00' into android12-5.10 2022-01-21 09:35:04 +01:00
verity ANDROID: GKI: set more vfs-only exports into their own namespace 2022-04-07 20:52:29 +02:00
xfs This is the 5.10.146 stable release 2022-09-29 17:06:30 +02:00
zonefs This is the 5.10.157 stable release 2022-12-04 12:51:21 +00:00
Kconfig Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
Kconfig.binfmt
Makefile ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
aio.c UPSTREAM: aio: fix use-after-free due to missing POLLFREE handling 2021-12-14 13:54:22 +01:00
anon_inodes.c UPSTREAM: fs: anon_inodes: rephrase to appropriate kernel-doc 2021-03-03 16:18:33 +00:00
attr.c This is the 5.10.137 stable release 2022-08-29 16:53:14 +02:00
bad_inode.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
binfmt_aout.c
binfmt_elf.c This is the 5.10.153 stable release 2022-11-21 15:47:06 +00:00
binfmt_elf_fdpic.c Revert "coredump: Snapshot the vmas in do_coredump" 2022-04-20 16:10:08 +02:00
binfmt_em86.c
binfmt_flat.c binfmt_flat: do not stop relocating GOT entries prematurely on riscv 2022-06-09 10:20:47 +02:00
binfmt_misc.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
binfmt_script.c
block_dev.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
buffer.c This is the 5.10.156 stable release 2022-12-02 08:42:05 +00:00
char_dev.c
compat_binfmt_elf.c
coredump.c UPSTREAM: coredump: Limit what can interrupt coredumps 2023-02-07 13:38:13 +00:00
d_path.c fs: fix NULL dereference due to data race in prepend_path() 2020-10-14 14:54:45 -07:00
dax.c dax: fix cache flush on PMD-mapped pages 2022-06-09 10:21:16 +02:00
dcache.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
dcookies.c
direct-io.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
drop_caches.c
eventfd.c
eventpoll.c This is the 5.10.137 stable release 2022-08-29 16:53:14 +02:00
exec.c This is the 5.10.153 stable release 2022-11-21 15:47:06 +00:00
fcntl.c fcntl: fix potential deadlocks for &fown_struct.lock 2022-10-30 09:41:18 +01:00
fhandle.c
file.c UPSTREAM: fs: provide locked helper variant of close_fd_get_file() 2023-02-07 13:38:09 +00:00
file_table.c SUNRPC: Ensure we flush any closed sockets before xs_xprt_free() 2022-05-18 10:23:48 +02:00
filesystems.c
fs-writeback.c This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
fs_context.c memcg: charge fs_context and legacy_fs_context 2022-02-08 18:30:36 +01:00
fs_parser.c fs_parse: mark fs_param_bad_value() as static 2020-10-13 18:38:27 -07:00
fs_pin.c
fs_struct.c
fs_types.c ANDROID: GKI: set more vfs-only exports into their own namespace 2022-04-07 20:52:29 +02:00
fsopen.c
init.c
inode.c This is the 5.10.148 stable release 2022-10-15 08:33:43 +02:00
internal.h UPSTREAM: fs: provide locked helper variant of close_fd_get_file() 2023-02-07 13:38:09 +00:00
io-wq.c io-wq: fix wakeup race when adding new work 2021-09-18 13:40:06 +02:00
io-wq.h io_uring: always batch cancel in *cancel_files() 2021-02-13 13:54:56 +01:00
io_uring.c UPSTREAM: file: Rename __close_fd_get_file close_fd_get_file 2023-02-07 13:38:09 +00:00
ioctl.c This is the 5.10.118 stable release 2022-06-06 16:37:12 +02:00
kernel_read_file.c vfs: check fd has read access in kernel_read_file_from_fd() 2021-10-27 09:56:51 +02:00
libfs.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
locks.c Revert "nfsd4: a client's own opens needn't prevent delegations" 2021-03-20 10:43:44 +01:00
mbcache.c
mount.h
mpage.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
namei.c UPSTREAM: fs: make do_renameat2() take struct filename 2023-02-07 13:38:09 +00:00
namespace.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00
no-block.c
nsfs.c
open.c UPSTREAM: fs: expose LOOKUP_CACHED through openat2() RESOLVE_CACHED 2023-02-07 13:38:08 +00:00
pipe.c BACKPORT: pipe: Fix missing lock in pipe_resize_ring() 2022-09-12 22:52:59 +00:00
pnode.c
pnode.h mount: fix mounting of detached mounts onto targets that reside on shared mounts 2021-03-17 17:06:13 +01:00
posix_acl.c
proc_namespace.c proc mountinfo: make splice available again 2020-12-30 11:54:02 +01:00
read_write.c This is the 5.10.160 stable release 2022-12-20 12:38:28 +00:00
readdir.c readdir: make sure to verify directory entry for legacy interfaces too 2021-04-21 13:00:54 +02:00
remap_range.c fs/remap: constrain dedupe of EOF blocks 2022-07-21 21:20:01 +02:00
select.c select: Fix indefinitely sleeping task in poll_schedule_timeout() 2022-01-29 10:26:11 +01:00
seq_file.c seq_file: disallow extremely large seq buffer allocations 2021-07-20 16:05:59 +02:00
signalfd.c Revert "io_uring: disable polling pollfree files" 2022-09-22 13:22:53 +02:00
splice.c This is the 5.10.149 stable release 2022-10-19 11:11:59 +02:00
stack.c
stat.c This is the 5.10.113 stable release 2022-05-12 11:23:35 +02:00
statfs.c
super.c This is the 5.10.154 stable release 2022-11-29 23:38:14 +00:00
sync.c This is the 5.10.140 stable release 2022-08-31 18:52:48 +02:00
timerfd.c ANDROID: fs: Add vendor hooks for ep_create_wakeup_source & timerfd_create 2021-03-24 17:57:22 +00:00
userfaultfd.c This is the 5.10.150 stable release 2022-11-15 19:14:08 +00:00
utimes.c
xattr.c ANDROID: GKI: set vfs-only exports into their own namespace 2022-01-11 09:30:47 +01:00