summaryrefslogtreecommitdiff
path: root/security
AgeCommit message (Collapse)Author
7 hoursMerge branch 'headers' of git://git.infradead.org/users/willy/pagecache.gitMark Brown
# Conflicts: # drivers/gpu/drm/amd/amdkfd/kfd_migrate.c # net/ceph/osd_client.c
7 hoursMerge branch 'next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/wufan/ipe.git
7 hoursMerge branch 'caps-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/sergeh/linux.git
10 hoursMerge branch 'next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git
10 hoursMerge branch 'next-integrity' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity
10 hoursMerge branch 'next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
10 hoursMerge branch 'modules-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/modules/linux.git # Conflicts: # drivers/gpu/drm/clients/drm_fbdev_helper.c # drivers/gpu/drm/xe/xe_guc_log.c
11 hoursMerge branch 'libcrypto-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
11 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git # Conflicts: # kernel/bpf/token.c # mm/internal.h
12 hoursMerge branch 'fs-next' of linux-nextMark Brown
# Conflicts: # fs/coredump.c # fs/f2fs/f2fs.h # fs/fuse/dax.c # fs/xfs/libxfs/xfs_btree.c
15 hoursMerge https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git ↵David Hildenbrand (Arm)
mm-unstable into for-next Signed-off-by: David Hildenbrand (Arm) <david@kernel.org> # Conflicts: # mm/sparse-vmemmap.c # Conflict resolution: # # diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c # index 11543f4b6304..5d7e982f94d0 100644 # --- a/mm/sparse-vmemmap.c # +++ b/mm/sparse-vmemmap.c # @@ -36,11 +36,7 @@ # #include "mm_init.h" # #include "sparse.h" # # -<<<<<<< HEAD # -void * __meminit vmemmap_alloc_block(unsigned long size, int node) # -======= # void __ref *vmemmap_alloc_block(unsigned long size, int node) # ->>>>>>> akpm/mm-unstable # { # /* If the main allocator is up use that, fallback to bootmem. */ # if (slab_is_available()) { # @@ -60,11 +56,7 @@ void __ref *vmemmap_alloc_block(unsigned long size, int node) # } # return NULL; # } else # -<<<<<<< HEAD # return memmap_alloc(size, size, __pa(MAX_DMA_ADDRESS), node); # -======= # - return memmap_alloc(size, size, __pa(MAX_DMA_ADDRESS), node, false); # ->>>>>>> akpm/mm-unstable # } # # static void * __meminit altmap_alloc_block_buf(unsigned long size,
24 hoursselinux: reject writable opens of policy file, drop mmap shared/write checkLorenzo Stoakes (ARM)
The policy file has no write method and is exposed read-only (S_IRUGO in selinux_files[]), yet sel_open_policy() performs no open mode check, so a CAP_DAC_OVERRIDE caller can open it O_RDWR. Reject FMODE_WRITE at open, as kernfs does. The file can then never be mapped with FMODE_WRITE, so do_mmap() always clears VM_MAYWRITE and VM_SHARED for MAP_SHARED mappings and the VM_SHARED check in sel_mmap_policy() cannot be reached. Remove it. This also stops sel_mmap_policy() clearing VM_MAYWRITE on a mapping that is neither a PFN map nor a mixed map, ahead of the core enforcing that only such mappings may do so. Link: https://lore.kernel.org/20261013-b4-mmap-prepare-vma-flag-sanify-v6-12-1aa3c9b139f9@kernel.org Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Reviewed-by: Jann Horn <jannh@google.com> Acked-by: Paul Moore <paul@paul-moore.com> Reviewed-by: Suren Baghdasaryan <surenb@google.com> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Liam R. Howlett <liam@infradead.org> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Pedro Falcato <pfalcato@suse.de> Cc: Mike Rapoport <rppt@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Eduard Zingerman <eddyz87@gmail.com> Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com> Cc: Zi Yan <ziy@nvidia.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Nico Pache <nico.pache@linux.dev> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Dev Jain <dev.jain@arm.com> Cc: Barry Song <baohua@kernel.org> Cc: Lance Yang <lance.yang@linux.dev> Cc: Usama Arif <usama.arif@linux.dev> Cc: Kiryl Shutsemau <kas@kernel.org> Cc: Doug Gilbert <dgilbert@interlog.com> Cc: James Bottomley <james.bottomley@hansenpartnership.com> Cc: Martin K. Petersen <mkp@kernel.org> Cc: Simona Vetter <simona@ffwll.ch> Cc: Helge Deller <deller@gmx.de> Cc: Sebastian Reichel <sre@kernel.org> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Peter Xu <peterx@redhat.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rik van Riel <riel@surriel.com> Cc: Harry Yoo <harry@kernel.org> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@gmail.com> Cc: Will Deacon <will@kernel.org> Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Muchun Song <muchun.song@linux.dev> Cc: Oscar Salvador <osalvador@suse.de> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Jan Kara <jack@suse.cz> Cc: Marc Zyngier <maz@kernel.org> Cc: Oliver Upton <oupton@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Anup Patel <anup@brainfault.org> Cc: Paul Walmsley <pjw@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Janosch Frank <frankja@linux.ibm.com> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: David S. Miller <davem@davemloft.net> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Joshua Hahn <joshua.hahnjy@gmail.com> Cc: Rakie Kim <rakie.kim@sk.com> Cc: Byungchul Park <byungchul@sk.com> Cc: Gregory Price <gourry@gourry.net> Cc: Ying Huang <ying.huang@linux.alibaba.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Chris Li <chrisl@kernel.org> Cc: Kairui Song <kasong@tencent.com> Cc: Kemeng Shi <shikemeng@huaweicloud.com> Cc: Nhat Pham <nphamcs@gmail.com> Cc: Baoquan He <baoquan.he@linux.dev> Cc: Youngjun Park <youngjun.park@lge.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Qi Zheng <qi.zheng@linux.dev> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Yuanchu Xie <yuanchu@google.com> Cc: Wei Xu <weixugc@google.com> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Michal Hocko <mhocko@kernel.org> Cc: Miklos Szeredi <miklos@szeredi.hu> Cc: Xu Xin <xu.xin@linux.dev> Cc: Ihor Solodrai <ihor.solodrai@linux.dev> Cc: Bert Karwatzki <spasswolf@web.de>
4 daysMerge branch 'vfs-7.4.idmap' into vfs.allChristian Brauner
5 daysima: recover number of violations after kexecEnrico Bravi
When recovering the IMA measurement list after kexec(), currently, the counter of violations is not restored. This causes a mismatch between the real number of violations and the value reported by the <securityfs>/ima/violations file. Restore the violations counter during the IMA measurement list recovery. This mechanism does not take into account false positives. A legit all-zeros hash is treated as a violation. Reported-by: Roberto Sassu <roberto.sassu@huawei.com> Closes: https://github.com/linux-integrity/linux/issues/13 Signed-off-by: Enrico Bravi <enrico.bravi@polito.it> Reviewed-and-tested-by: Roberto Sassu <roberto.sassu@huawei.com> [zohar@linux.ibm.com: Fixed patch description line length] Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
7 daysAutomated merge of 'dev' into 'next'Paul Moore
* dev: selinux: validate permissive and neveraudit map types at load selinux: validate user MLS range and default level at load selinux: bounds-check role and user membership bitmaps at load selinux: check neveraudit in avc_xperms_audit_required() selinux: bounds-check filename transition source types at load selinux: reject duplicate symbol values during policy load selinux: reject a policy that both rejects and allows unknown classes selinux: constify avc function parameters selinux: avoid 64-bit division of inode numbers selinux: mark status and policy inodes as immutable, drop status mmap write checks selinux: remove unused mls_setup_user_range() selinux: convert selinuxfs inode numbers from unsigned long to u64 selinux: tighten policydb_context_isvalid() checks
8 daysMerge tag 'landlock-7.3-rc7' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux Pull Landlock fix from Mickaël Salaün: "This fixes a Clang bug by removing an annotation, which was introduced mostly for documentation" * tag 'landlock-7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux: landlock: Drop __counted_by from landlock_domain.handled_masks
8 dayslandlock: Drop __counted_by from landlock_domain.handled_masksNguyen Ngoc Thang
With clang 22 and CONFIG_FORTIFY_SOURCE, the second landlock_restrict_self() call hits a bogus fortify report in inherit_ruleset(): memcpy: detected buffer overflow: 4 byte write of buffer size 0 Call Trace: __fortify_panic landlock_merge_ruleset __se_sys_landlock_restrict_self handled_masks[] lives in an anonymous struct inside the anonymous union that overlays work_free. For such a flexible array, clang computes the address of the __counted_by counter as the start of the array instead of &num_layers. The bound is then read from handled_masks[0], i.e. from the first layer's access masks, which is not a count. The same layout crashes clang itself in a standalone test. The annotation was added as documentation, so drop it rather than restructure the union. Keep the information in the member comment. Reported-by: syzbot+a0eecb22de4d821a9e5d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=a0eecb22de4d821a9e5d Fixes: bd3a19800dd1 ("landlock: Add counted_by in landlock_domain") Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com> Link: https://lore.kernel.org/r/20261010164450.194439-1-ngocthang2710.1999@gmail.com Reviewed-by: Günther Noack <gnoack3000@gmail.com> Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reported-by: Mike Bommarito <michael.bommarito@gmail.com> Closes: https://lore.kernel.org/r/20261009115108.17819-1-michael.bommarito@gmail.com [mic: Rebased on master, where the array is handled_masks[], updated the fortify report, added the clang bug link and the other reports] Signed-off-by: Mickaël Salaün <mic@digikod.net>
13 daysipe: fix enforcement auditFan Wu
ipe_audit_enforce() starts an audit buffer but writes the state change with audit_log(), which logs its own record. Ending the unused buffer then emits an extra empty AUDIT_MAC_STATUS record. Remove the unused buffer and log the state change with audit_log() alone. Fixes: a68916eaedcd ("ipe: add permissive toggle") Assisted-by: LLM Signed-off-by: Fan Wu <wufan@kernel.org>
13 daysipe: correct policy text ownership commentFan Wu
Policy text is separately allocated only when p->pkcs7 is NULL. Correct the comment to match the existing free logic. No functional changes. Assisted-by: LLM Signed-off-by: Fan Wu <wufan@kernel.org>
13 daysipe: check parser token table sizesFan Wu
The parser token tables contain one entry for each enum value followed by a terminator. Add static assertions so adding an enum value without a corresponding token fails the build. Assisted-by: LLM Signed-off-by: Fan Wu <wufan@kernel.org>
13 daysipe: use designated initializers for audit name tablesFan Wu
The audit name tables are indexed by enum values but initialized positionally. Adding an enum value in the middle can associate the following names with the wrong values. Use designated initializers to bind each name to its enum value. No functional changes. Assisted-by: LLM Signed-off-by: Fan Wu <wufan@kernel.org>
13 daysipe: constify token_default()Fan Wu
token_default() does not modify its argument, so make it const. Assisted-by: LLM Signed-off-by: Fan Wu <wufan@kernel.org>
14 daysMerge tag 'keys-v7.3-rc7' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd Pull keys fixes from Jarkko Sakkinen: - key_get_persistent() created a new persistent keyring if one did not exist, but failed to set a timeout on it in an error path, preventing GC. Call key_set_timeout() regardless of key_link() result if a persistent keyring was created. - __key_create_or_update() made a copy of keyring->restrict_link before holding keyring->sem, which could cause add_key() to be executed against stale keyring restrictions. Fix it by copying the value only after taking keyring->sem * tag 'keys-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: KEYS: Fix add_key() race with keyring restriction keys: finalize persistent keyring timeout after link attempt
2026-10-05Merge tag 'selinux-pr-20261005' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux Pull selinux fixes from Paul Moore: - Preserve SECURITY_LSM_NATIVE_LABELS when reusing superblocks Similar to a previous fix (see the commit description of Stephen's fix) we need to check to see if we have already mounted/setup the superblock passed into the security_sb_set_mnt_opts() LSM hook so we don't mistakenly unset SECURITY_LSM_NATIVE_LABELS. - Fix a potential AVC sequence number data race * tag 'selinux-pr-20261005' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: preserve NATIVE_LABELS on already-initialized sb in set_mnt_opts selinux: fix data race on AVC latest_notif
2026-10-04KEYS: Fix add_key() race with keyring restriction성병찬
__key_create_or_update() snapshots keyring->restrict_link before taking the destination keyring's semaphore. keyring_restrict() installs a restriction while holding that semaphore. This allows a writer to observe no restriction, wait for the keyring owner to install a reject-all restriction and return successfully, and then link a key using the stale NULL snapshot. The writer only needs write permission on the destination keyring. Move the restrict_link read after __key_link_lock() and __key_link_begin(). The read and the subsequent restriction check are then serialized with restriction installation by keyring->sem. The race was reproduced on v7.2.8 in 19 executions where restriction installation returned before the link completed. All 19 linked the key despite the reject-all restriction. With this change, 312 executions reached the same ordering and every add_key() call failed with -EPERM. The issue was found by manual concurrency analysis assisted by AI-based analysis and independently verified with a QEMU reproducer and kernel instrumentation. Fixes: 5ac7eace2d00 ("KEYS: Add a facility to restrict new links into a keyring") Cc: stable@vger.kernel.org Signed-off-by: 성병찬 <tjdqudcks0424@naver.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/r/20260930041802.6114-1-tjdqudcks0424@naver.com Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-04keys: finalize persistent keyring timeout after link attemptKarl Mehltretter
When no keyring exists for the requested UID, KEYCTL_GET_PERSISTENT creates and registers one before linking it to the requested destination. The configured timeout is set only after the destination link succeeds. A destination restricted with KEYCTL_RESTRICT_KEYRING makes that link fail with -EPERM. With persistent_keyring_expiry set to 60 seconds, /proc/keys still reports the registered keyring's expiry as "perm". The failed call therefore leaves a quota-exempt keyring in the namespace's hidden register, where it may remain until namespace teardown. Rename the write-locked helper to key_get_or_create_persistent() and return the key reference through a result parameter. Return 0 when it creates a keyring and 1 when the retry finds an existing one. Return a negative error on failure. Another caller may create the keyring between the initial read-locked lookup and the retry under the write lock. Set the timeout after permission checking and linking. Do this on success, or on failure if the call allocated the keyring. This leaves a new keyring collectible after failure without starting its timeout while linking is still in progress. Cc: stable@vger.kernel.org # v5.10+ Fixes: f36f8c75ae2e ("KEYS: Add per-user_namespace registers for persistent per-UID kerberos caches") Assisted-by: LLM Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Link: https://lore.kernel.org/r/20260912095440.79864-1-kmehltretter@gmail.com Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-02Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.3-rc5Alexei Starovoitov
Cross-merge BPF and other fixes after downstream PR. Conflicts: arch/arm64/net/bpf_jit_comp.c arch/x86/net/bpf_jit_comp.c Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-09-30selinux: validate permissive and neveraudit map types at loadChristian Göttsche
The permissive and neveraudit maps are read as ebitmaps and indexed by type value, but their set bits are never checked. A bit that is not a defined, non-attribute type is silently accepted. Validate every set bit of both maps in policydb_index() with policydb_simpletype_isvalid(). Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-30selinux: validate user MLS range and default level at loadChristian Göttsche
user_read() reads each user's MLS range and default level but, unlike range transitions and security contexts, never validates them. Validate usr->range and usr->dfltlevel in user_index_check() when MLS is enabled, once the level and category symbol tables are populated. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-30selinux: bounds-check role and user membership bitmaps at loadChristian Göttsche
role->dominates, role->types and user->roles are read as ebitmaps but their set bits are never checked against the role and type symbol tables. A bit naming an undefined value is silently accepted, and an out-of-range one is used to index those tables later; in particular role_bounds_sanity_check() passes such a bit straight to sym_name(), reading p->sym_val_to_name[] out of bounds on a crafted bounded role. Validate the three bitmaps in policydb_index() once every symbol table is populated (roles are read before types, so this cannot be done in role_read()). Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-30selinux: preserve NATIVE_LABELS on already-initialized sb in set_mnt_optsStephen Smalley
When an NFSv4 filesystem exported with security_label is mounted a second time, sget_fc() returns the existing superblock and nfs_get_root() calls security_sb_set_mnt_opts() again on it. Since the superblock is already SB_INITIALIZED, selinux_set_mnt_opts() takes an early exit without setting SECURITY_LSM_NATIVE_LABELS in *set_kern_flags. nfs_get_root() then sees kflags without SECURITY_LSM_NATIVE_LABELS set and clears NFS_CAP_SECURITY_LABEL on the shared nfs_server, silently disabling per-file labeling for both the new and the original mount. Commit 3815a245b501 ("security/selinux: fix SECURITY_LSM_NATIVE_LABELS on reused superblock") fixed the same problem in selinux_sb_clone_mnt_opts(). The reused-superblock path for a plain second mount now goes through sb_set_mnt_opts rather than sb_clone_mnt_opts, so it needs the same treatment: on both SE_SBINITIALIZED early exits, set SECURITY_LSM_NATIVE_LABELS in *set_kern_flags when the superblock was already using SECURITY_FS_USE_NATVE. Cc: stable@vger.kernel.org Closes: https://github.com/SELinuxProject/selinux-kernel/issues/69 Closes: https://github.com/SELinuxProject/selinux-kernel/issues/70 Closes: https://github.com/SELinuxProject/selinux-testsuite/issues/91 Closes: https://github.com/SELinuxProject/selinux-testsuite/issues/92 Fixes: eb9ae686507b ("SELinux: Add new labeling type native labels") Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-30security: keys: trusted: always clear the hmac_sha1_ctx before returningThomas Huth
Clear the hmac_sha1_ctx structure via __cleanup(hmac_sha1_zeroize_ctx) to make sure that the function does not leak sensitive data on the stack when returning without calling hmac_sha1_final(). Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Link: https://patch.msgid.link/20260916095022.604354-10-thuth@redhat.com Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2026-09-29lsm: remove redundant NULL check in security_init()Sang-Heon Jeon
Since commit 5137e583ba26 ("lsm: cleanup the debug and console output in lsm_init.c"), the NULL check for lsm_order_legacy in security_init() has no effect. So remove the check. No functional change. Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-28integrity: Replace integrity_audit_message() with integrity_audit_msg()Frederick Lawler
Now that integrity_audit_msg() accepts an errno parameter, it is equivalent to integrity_audit_message(). Replace the remaining integrity_audit_message() call sites with integrity_audit_msg() and remove integrity_audit_message(). Signed-off-by: Frederick Lawler <fred@cloudflare.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2026-09-28integrity: Report error code in integrity_audit_msg() call sitesFrederick Lawler
integrity_audit_msg() hides error codes by wrapping integrity_audit_message() which obfuscates the underlying reason for the failure. Update integrity_audit_msg() to take a errno argument, and pass that through to integrity_audit_message(). Then update call sites to take caller's respective error codes. ima_appraise_measurement() stores xattr_len as the return code, but can replace it with a error code later. Therefore conditionally use a code if rc < 0, otherwise report zero. Lastly, conditionally use -EINVAL for ima_release_policy(). Signed-off-by: Frederick Lawler <fred@cloudflare.com> Reviewed-by: Enrico Bravi <enrico.bravi@polito.it> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2026-09-25Merge tag 'ipe-pr-20260925' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wufan/ipe Pull IPE fixes from Fan Wu: "Two fixes for use-after-free issues found by recent LLM-assisted code analysis. - move successful policy load auditing under the new policy directory's inode lock, preventing a concurrent policy deletion from freeing the policy while it is still being audited - protect the dm-verity root hash with RCU, preventing policy evaluation from racing with root hash replacement during preresume" * tag 'ipe-pr-20260925' of git://git.kernel.org/pub/scm/linux/kernel/git/wufan/ipe: ipe: protect the dm-verity root hash with RCU ipe: fix use-after-free when auditing a newly loaded policy
2026-09-25ipe: protect the dm-verity root hash with RCUFan Wu
ipe_bdev_setintegrity() frees the old root hash when dm-verity publishes a new one on ->preresume, while policy evaluation can still be dereferencing it. Protect the root hash with RCU. The evaluation path already runs under rcu_read_lock(). Fixes: e155858dd995 ("ipe: add support for dm-verity as a trust provider") Cc: stable@vger.kernel.org Assisted-by: LLM [FW: remove model name according to latest guideline] Signed-off-by: Fan Wu <wufan@kernel.org>
2026-09-25ipe: fix use-after-free when auditing a newly loaded policyFan Wu
new_policy() audits the policy after ipe_new_policyfs_node() publishes it and drops the new directory's inode lock. A concurrent delete can free the policy while ipe_audit_policy_load() is still using it. Audit the successful load under that lock. Fixes: f44554b5067b ("audit,ipe: add IPE auditing support") Cc: stable@vger.kernel.org Assisted-by: LLM [FW: remove model name according to latest guideline] Signed-off-by: Fan Wu <wufan@kernel.org>
2026-09-25selinux: fix data race on AVC latest_notifChristian Göttsche
avc_policy_seqno() reads latest_notif without holding notif_lock, while avc_latest_notif_update() can update it under that lock. KCSAN reports these concurrent accesses during policy boolean updates and permission checks. Use READ_ONCE() for the lockless read and WRITE_ONCE() for the update. The spinlock continues to serialize the comparison and update against other writers. Reads made while holding notif_lock cannot race with a writer and can remain plain accesses. This marks both sides of the intentional concurrent access and constrains compiler transformations, without suppressing checking with data_race(). Cc: stable@vger.kernel.org Fixes: 788e7dd4c22e ("SELinux: Improve read/write performance") Reported-by: syzbot+a7f7cb0737bd91aa698c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=a7f7cb0737bd91aa698c Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-25security: commoncap: clarify CAP_FS_SET comment in cap_task_fix_setuid()Adriano Cordova
CAP_FS_SET is exactly the set of capabilities that an fsuid of 0 historically granted (see CAP_FS_MASK in include/linux/capability.h), so cap_task_fix_setuid() drops that set from the effective set when fsuid leaves 0. Replace the stale FIXME with this explanation. Signed-off-by: Adriano Cordova <adrianox@gmail.com> Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Serge Hallyn <sergeh@kernel.org>
2026-09-24selinux: check neveraudit in avc_xperms_audit_required()Christian Göttsche
avc_audit_required() returns early for a neveraudit domain, while avc_xperms_audit_required() instead relies on security_compute_av() (and security_compute_av_user()) having already zeroed avd->auditallow and avd->auditdeny for such a domain. That leaves its "else if (result)" branch as the only way left to audit a neveraudit domain, and makes the two helpers read differently for the same rule. Add the same early return to avc_xperms_audit_required(), so both audit gates state the neveraudit rule directly and the extended permission audit path no longer depends on the auditallow/auditdeny mask having been zeroed elsewhere. No behavior changes today: avc_has_extended_perms() only reaches the "result" branch once the identically computed "denied" is already nonzero, so that branch was already unreachable in practice. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-24selinux: bounds-check filename transition source types at loadChristian Göttsche
filename_trans_read_helper() validates the target type, target class and each datum's otype, but the per-datum stypes ebitmap is read without any bound on its set bits. Reject a stypes bitmap whose highest set bit is not a defined type. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Reviewed-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-24selinux: reject duplicate symbol values during policy loadChristian Göttsche
The symbol index functions assign unconditionally, so two symbols that share a value silently overwrite each other and leave another value with no entry. Reject a value whose slot is already populated, for commons, classes, roles, types, users, sensitivities and categories; booleans already have their own "declared but not defined" check. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Reviewed-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-24selinux: reject a policy that both rejects and allows unknown classesChristian Göttsche
handle-unknown is a single three-valued choice - deny, reject or allow - but the policydb header spells it as two independent bits and policydb_read() takes any combination of them. libsepol writes exactly one of the three values (POLICYDB_CONFIG_UNKNOWN_MASK & p->handle_unknown), so no policy built by the reference toolchain carries this combination. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-24selinux: constify avc function parametersChristian Göttsche
Constify read-only decision structs to ease reasoning where decisions are actually modified, and where only processed. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> [PM: fixed line length issues] Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-09-24Merge tag 'landlock-7.3-rc5' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux Pull Landlock fixes from Mickaël Salaün: "This mainly fixes the Landlock tracepoint support merged this cycle so that denial and rule events report the intended policy context, whether through tracefs or BTF-visible callbacks. The size of this all is mainly from propagating the corrected contract through event definitions and producers, adding new tests for the reported context, and updating the documentation. Also improve annotation and fix a GCC 16 build warning" * tag 'landlock-7.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux: landlock: Widen ruleset versions to 64 bits landlock: Add counted_by in landlock_domain landlock: Fix tracepoint contract documentation selftests/landlock: Test network denial context selftests/landlock: Test filesystem denial blockers landlock: Report the effective signal number landlock: Report the actual ptrace tracer landlock: Fix network denial trace context landlock: Fix rule tracepoint context landlock: Fix filesystem denial blocker reporting landlock: Fix tracepoint fixed-width type names landlock: Work around gcc-16 -Wuninitialized warning
2026-09-24Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.3-rc4Alexei Starovoitov
Cross-merge BPF and other fixes after downstream PR. Conflicts: kernel/bpf/helpers.c tools/testing/selftests/bpf/prog_tests/cb_refs.c tools/testing/selftests/bpf/prog_tests/verifier.c Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-09-23fs: port mnt_idmap() and file_mnt_idmap() to const mnt_idmapChristian Brauner
Now that everything takes a mnt_idmap as const store a const pointer in struct vfsmount, struct mount_kattr and struct kstatmount and return one from mnt_idmap(), file_mnt_idmap() and ovl_upper_mnt_idmap(). Finally, also make mnt_idmap_get() return a const pointer. Also convert the remaining local variables that are initialized from the accessors. alloc_mnt_idmap() keeps returning a non-const pointer. It is the only place where an idmapping is actually written to. Link: https://patch.msgid.link/20260901-work-idmap-const-v1-26-54ccd48e100b@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Seth Forshee <sforshee@kernel.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-09-23fs: port ->setattr() to pass const mnt_idmapChristian Brauner
Convert to const struct mnt_idmap. A mount's idmapping is immutable. The only thing that is allowed to be modified afterwards is the reference count and that is hidden behind mnt_idmap_get() and mnt_idmap_put(). Everything else only ever reads from the idmapping. This is the same model that struct cred uses and the idmapping is also rather sensitive. So make the idmap argument const wherever we can. The conversion is done from the bottom up so callers can continue to pass a non-const pointer to a const parameter until the conversion is finished. No functional changes. Link: https://patch.msgid.link/20260901-work-idmap-const-v1-24-54ccd48e100b@kernel.org Acked-by: Paul Moore <paul@paul-moore.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Seth Forshee <sforshee@kernel.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-09-23fs: port ->mkdir() to pass const mnt_idmapChristian Brauner
Convert to const struct mnt_idmap. A mount's idmapping is immutable. The only thing that is allowed to be modified afterwards is the reference count and that is hidden behind mnt_idmap_get() and mnt_idmap_put(). Everything else only ever reads from the idmapping. This is the same model that struct cred uses and the idmapping is also rather sensitive. So make the idmap argument const wherever we can. The conversion is done from the bottom up so callers can continue to pass a non-const pointer to a const parameter until the conversion is finished. No functional changes. Link: https://patch.msgid.link/20260901-work-idmap-const-v1-20-54ccd48e100b@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Seth Forshee <sforshee@kernel.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>