linux/fs
Max Filippov 5a9dc62586 exec: Fix NOMMU linux_binprm::exec in transfer_args_to_stack()
commit 2aea94ac14 upstream.

In NOMMU kernel the value of linux_binprm::p is the offset inside the
temporary program arguments array maintained in separate pages in the
linux_binprm::page. linux_binprm::exec being a copy of linux_binprm::p
thus must be adjusted when that array is copied to the user stack.
Without that adjustment the value passed by the NOMMU kernel to the ELF
program in the AT_EXECFN entry of the aux array doesn't make any sense
and it may break programs that try to access memory pointed to by that
entry.

Adjust linux_binprm::exec before the successful return from the
transfer_args_to_stack().

Cc: <stable@vger.kernel.org>
Fixes: b6a2fea393 ("mm: variable length argument support")
Fixes: 5edc2a5123 ("binfmt_elf_fdpic: wire up AT_EXECFD, AT_EXECFN, AT_SECURE")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Link: https://lore.kernel.org/r/20240320182607.1472887-1-jcmvbkbc@gmail.com
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-03 15:11:49 +02:00
..
9p 9p: Fix initialisation of netfs_inode for 9p 2024-02-05 20:17:04 +00:00
adfs
affs vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
afs afs: Revert "afs: Hide silly-rename files from userspace" 2024-03-26 18:18:49 -04:00
autofs autofs: add: new_inode check in autofs_fill_super() 2023-11-20 14:56:36 +01:00
bcachefs bcachefs: Fix BTREE_ITER_FILTER_SNAPSHOTS on inodes btree 2024-03-26 18:18:50 -04:00
befs vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
bfs
btrfs btrfs: zoned: use zone aware sb location for scrub 2024-04-03 15:11:48 +02:00
cachefiles cachefiles: fix memory leak in cachefiles_add_cache() 2024-03-01 13:41:47 +01:00
ceph ceph: stop copying to iter at EOF on sync reads 2024-03-26 18:18:57 -04:00
coda
configfs
cramfs vfs-6.7.ctime 2023-10-30 09:47:13 -10:00
crypto This update includes the following changes: 2023-11-02 16:15:30 -10:00
debugfs debugfs: fix wait/cancellation handling during remove 2024-04-03 15:11:21 +02:00
devpts
dlm dlm: fix user space lkb refcounting 2024-04-03 15:11:25 +02:00
ecryptfs ecryptfs: Reject casefold directory inodes 2024-02-05 20:16:48 +00:00
efivarfs efivarfs: Request at most 512 bytes for variable names 2024-03-06 14:53:57 +00:00
efs vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
erofs erofs: fix lockdep false positives on initializing erofs_pseudo_mnt 2024-03-26 18:18:26 -04:00
exfat exfat: fix ctime is not updated 2023-11-03 22:24:11 +09:00
exportfs fs: fix build error with CONFIG_EXPORTFS=m or not defined 2023-10-28 16:16:19 +02:00
ext2 quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:18:32 -04:00
ext4 ext4: fix corruption during on-line resize 2024-04-03 15:11:20 +02:00
f2fs f2fs: truncate page cache before clearing flags when aborting atomic write 2024-04-03 15:11:27 +02:00
fat fat: fix uninitialized field in nostale filehandles 2024-04-03 15:11:11 +02:00
freevxfs vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
fscache netfs, fscache: Prevent Oops in fscache_put_cache() 2024-01-31 16:21:06 -08:00
fuse fuse: don't unhash root 2024-04-03 15:11:16 +02:00
gfs2 gfs2: fix kernel BUG in gfs2_quota_cleanup 2024-01-25 15:44:43 -08:00
hfs vfs-6.7.ctime 2023-10-30 09:47:13 -10:00
hfsplus vfs-6.7.ctime 2023-10-30 09:47:13 -10:00
hostfs
hpfs
hugetlbfs mm: hugetlb pages should not be reserved by shmat() if SHM_NORESERVE 2024-02-23 09:51:56 +01:00
iomap iomap: clear the per-folio dirty bits on all writeback failures 2024-03-26 18:17:58 -04:00
isofs
jbd2 jbd2: fix soft lockup in journal_finish_inode_data_buffers() 2023-12-12 10:25:46 -05:00
jffs2 vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
jfs quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:18:32 -04:00
kernfs fs/kernfs/dir: obey S_ISGID 2024-02-05 20:17:04 +00:00
lockd
minix
netfs
nfs NFS: Read unlock folio on nfs_page_create_from_folio() error 2024-04-03 15:11:22 +02:00
nfs_common
nfsd NFSD: Fix nfsd_clid_class use of __string_len() macro 2024-04-03 15:11:29 +02:00
nilfs2 nilfs2: prevent kernel bug at submit_bh_wbc() 2024-04-03 15:11:27 +02:00
nls
notify vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
ntfs vfs-6.7.fsid 2023-11-07 12:11:26 -08:00
ntfs3 fs/ntfs3: fix build without CONFIG_NTFS3_LZX_XPRESS 2024-03-02 18:23:50 +01:00
ocfs2 quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:18:32 -04:00
omfs
openpromfs
orangefs vfs-6.7.ctime 2023-10-30 09:47:13 -10:00
overlayfs ovl: Always reject mounting over case-insensitive directories 2024-03-26 18:17:59 -04:00
proc fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats 2024-02-23 09:51:58 +01:00
pstore pstore: inode: Only d_invalidate() is needed 2024-03-26 18:18:20 -04:00
qnx4
qnx6
quota quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:18:32 -04:00
ramfs
reiserfs quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:18:32 -04:00
romfs vfs-6.7.ctime 2023-10-30 09:47:13 -10:00
smb ksmbd: fix potencial out-of-bounds when buffer offset is invalid 2024-04-03 15:11:29 +02:00
squashfs squashfs: squashfs_read_data need to check if the length is 0 2023-12-06 16:12:45 -08:00
sysfs
sysv
tracefs eventfs: Keep all directory links at 1 2024-02-23 09:51:45 +01:00
ubifs ubifs: Set page uptodate in the correct place 2024-04-03 15:11:11 +02:00
udf \n 2023-11-02 08:19:51 -10:00
ufs fix ufs_get_locked_folio() breakage 2023-12-13 11:14:09 -05:00
unicode
vboxsf
verity
xfs xfs: read only mounts with fsopen mount API are busted 2024-01-31 16:21:12 -08:00
zonefs zonefs: Improve error handling 2024-02-23 09:51:53 +01:00
aio.c fs/aio: Check IOCB_AIO_RW before the struct aio_kiocb conversion 2024-04-03 15:11:39 +02:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_elf_fdpic.c execve updates for v6.7-rc1 2023-10-30 19:28:19 -10:00
binfmt_elf_test.c
binfmt_elf.c
binfmt_flat.c
binfmt_misc.c execve updates for v6.7-rc1 2023-10-30 19:28:19 -10:00
binfmt_script.c
buffer.c As usual, lots of singleton and doubleton patches all over the tree and 2023-11-02 20:53:31 -10:00
char_dev.c As usual, lots of singleton and doubleton patches all over the tree and 2023-11-02 20:53:31 -10:00
compat_binfmt_elf.c
coredump.c
d_path.c
dax.c
dcache.c fast_dput(): handle underflows gracefully 2024-02-05 20:16:57 +00:00
direct-io.c
drop_caches.c
eventfd.c eventfd: simplify eventfd_signal() 2024-04-03 15:11:23 +02:00
eventpoll.c
exec.c exec: Fix NOMMU linux_binprm::exec in transfer_args_to_stack() 2024-04-03 15:11:49 +02:00
fcntl.c fs: Fix rw_hint validation 2024-03-26 18:17:58 -04:00
fhandle.c do_sys_name_to_handle(): use kzalloc() to fix kernel-infoleak 2024-03-26 18:17:57 -04:00
file_table.c As usual, lots of singleton and doubleton patches all over the tree and 2023-11-02 20:53:31 -10:00
file.c file, i915: fix file reference for mmap_singleton() 2023-10-25 22:17:04 +02:00
filesystems.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c vfs-6.7.misc 2023-10-30 09:14:19 -10:00
fsopen.c
init.c
inode.c filemap: add a per-mapping stable writes flag 2023-11-20 15:05:18 +01:00
internal.h
ioctl.c lsm: new security_file_ioctl_compat() hook 2024-01-31 16:21:00 -08:00
Kconfig mm/hugetlb: have CONFIG_HUGETLB_PAGE select CONFIG_XARRAY_MULTI 2023-12-06 16:12:49 -08:00
Kconfig.binfmt
kernel_read_file.c
libfs.c libfs: getdents() should return 0 after reaching EOD 2023-11-20 15:34:22 +01:00
locks.c As usual, lots of singleton and doubleton patches all over the tree and 2023-11-02 20:53:31 -10:00
Makefile
mbcache.c
mnt_idmapping.c fs: export mnt_idmap_get/mnt_idmap_put 2023-11-03 23:28:33 +01:00
mount.h
mpage.c buffer: remove folio_create_empty_buffers() 2023-10-25 16:47:10 -07:00
namei.c new helper: user_path_locked_at() 2024-02-16 19:14:30 +01:00
namespace.c fs: relax mount_setattr() permission checks 2024-02-23 09:51:55 +01:00
nsfs.c
open.c cred: get rid of CONFIG_DEBUG_CREDENTIALS 2023-12-15 14:19:48 -08:00
pipe.c pipe: wakeup wr_wait after setting max_usage 2024-01-31 16:20:53 -08:00
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c fs/select: rework stack allocation hack for clang 2024-03-26 18:17:59 -04:00
seq_file.c
signalfd.c
splice.c
stack.c
stat.c fs: Pass AT_GETATTR_NOSEC flag to getattr interface function 2023-11-18 14:54:07 +01:00
statfs.c
super.c overlayfs update for 6.7-rc1 2023-11-07 11:46:31 -08:00
sync.c
sysctls.c
timerfd.c
userfaultfd.c As usual, lots of singleton and doubleton patches all over the tree and 2023-11-02 20:53:31 -10:00
utimes.c
xattr.c