An error occurred while fetching folder content.
signal: remove the wrong signal_pending() check in restore_user_sigmask()
Oleg Nesterov authored
This is the minimal fix for stable, I'll send cleanups later.

Commit 854a6ed5 ("signal: Add restore_user_sigmask()") introduced
the visible change which breaks user-space: a signal temporary unblocked
by set_user_sigmask() can be delivered even if the caller returns
success or timeout.

Change restore_user_sigmask() to accept the additional "interrupted"
argument which should be used instead of signal_pending() check, and
update the callers.

Eric said:

: For clarity.  I don't think this is required by posix, or fundamentally to
: remove the races in select.  It is what linux has always done and we have
: applications who care so I agree this fix is needed.
:
: Further in any case where the semantic change that this patch rolls back
: (aka where allowing a signal to be delivered and the select like call to
: complete) would be advantage we can do as well if not better by using
: signalfd.
:
: Michael is there any chance we can get this guarantee of the linux
: implementation of pselect and friends clearly documented.  The guarantee
: that if the system call completes successfully we are guaranteed that no
: signal that is unblocked by using sigmask will be delivered?

Link: http://lkml.kernel.org/r/20190604134117.GA29963@redhat.com
Fixes: 854a6ed5

 ("signal: Add restore_user_sigmask()")
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Reported-by: default avatarEric Wong <e@80x24.org>
Tested-by: default avatarEric Wong <e@80x24.org>
Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: <stable@vger.kernel.org>	[5.0+]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
97abc889
Name Last commit Last update
..
9p treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188
adfs treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
affs treewide: Add SPDX license identifier - Makefile/Kconfig
afs Merge tag 'afs-fixes-20190620' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
autofs treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 83
befs treewide: Add SPDX license identifier - Makefile/Kconfig
bfs treewide: Add SPDX license identifier - Makefile/Kconfig
btrfs Merge tag 'for-5.2-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
cachefiles treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36
ceph ceph: fix error handling in ceph_get_caps()
cifs Merge tag 'spdx-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx
coda treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
configfs Merge tag 'spdx-5.2-rc3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
cramfs treewide: Add SPDX license identifier - Makefile/Kconfig
crypto treewide: Add SPDX license identifier - Makefile/Kconfig
debugfs treewide: Add SPDX license identifier - Makefile/Kconfig
devpts treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 83
dlm treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398
ecryptfs treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333
efivarfs treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
efs treewide: Add SPDX license identifier - Makefile/Kconfig
exportfs treewide: Add SPDX license identifier - Makefile/Kconfig
ext2 treewide: Add SPDX license identifier - Makefile/Kconfig
ext4 Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
f2fs treewide: Add SPDX license identifier - Makefile/Kconfig
fat
freevxfs
fscache
fuse
gfs2
hfs
hfsplus
hostfs
hpfs
hugetlbfs
isofs
jbd2
jffs2
jfs
kernfs
lockd
minix
nfs
nfs_common
nfsd
nilfs2
nls
notify
ntfs
ocfs2
omfs
openpromfs
orangefs
overlayfs
proc
pstore
qnx4
qnx6
quota
ramfs
reiserfs
romfs
squashfs
sysfs
sysv
tracefs
ubifs
udf
ufs
unicode
xfs
Kconfig
Kconfig.binfmt
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
block_dev.c
buffer.c
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c
d_path.c
dax.c
dcache.c
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c