Linux Security Modules development
 help / color / mirror / Atom feed
* Re: [PATCH 50/61] zonefs: update format strings for u64 i_ino
From: Damien Le Moal @ 2026-02-26 22:45 UTC (permalink / raw)
  To: Jeff Layton, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes, coda,
	Nicolas Pitre, Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Naohiro Aota, Johannes Thumshirn, John Johansen,
	Paul Moore, James Morris, Serge E. Hallyn, Mimi Zohar,
	Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller
  Cc: linux-fsdevel, linux-kernel, linux-trace-kernel, nvdimm, fsverity,
	linux-mm, netfs, linux-ext4, linux-f2fs-devel, linux-nfs,
	linux-cifs, samba-technical, linux-nilfs, v9fs, linux-afs, autofs,
	ceph-devel, codalist, ecryptfs, linux-mtd, jfs-discussion, ntfs3,
	ocfs2-devel, devel, linux-unionfs, apparmor,
	linux-security-module, linux-integrity, selinux, amd-gfx,
	dri-devel, linux-media, linaro-mm-sig, netdev, linux-perf-users,
	linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-50-ccceff366db9@kernel.org>

On 2/27/26 00:55, Jeff Layton wrote:
> Update format strings and local variable types in zonefs for the
> i_ino type change from unsigned long to u64.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Acked-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply

* Re: [PATCH 03/61] trace: update VFS-layer trace events for u64 i_ino
From: Damien Le Moal @ 2026-02-26 22:51 UTC (permalink / raw)
  To: Jeff Layton, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes, coda,
	Nicolas Pitre, Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Naohiro Aota, Johannes Thumshirn, John Johansen,
	Paul Moore, James Morris, Serge E. Hallyn, Mimi Zohar,
	Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller
  Cc: linux-fsdevel, linux-kernel, linux-trace-kernel, nvdimm, fsverity,
	linux-mm, netfs, linux-ext4, linux-f2fs-devel, linux-nfs,
	linux-cifs, samba-technical, linux-nilfs, v9fs, linux-afs, autofs,
	ceph-devel, codalist, ecryptfs, linux-mtd, jfs-discussion, ntfs3,
	ocfs2-devel, devel, linux-unionfs, apparmor,
	linux-security-module, linux-integrity, selinux, amd-gfx,
	dri-devel, linux-media, linaro-mm-sig, netdev, linux-perf-users,
	linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-3-ccceff366db9@kernel.org>

On 2/27/26 00:55, Jeff Layton wrote:
> Update trace event definitions in VFS-layer trace headers to use u64
> instead of ino_t/unsigned long for inode number fields, and change
> format strings from %lu/%lx to %llu/%llx to match.
> 
> This is needed because i_ino is now u64. Changing trace event field
> types changes the binary trace format, but the self-describing format
> metadata handles this transparently for modern trace-cmd and perf.
> 
> Files updated:
>   - cachefiles.h, filelock.h, filemap.h, fs_dax.h, fsverity.h,
>     hugetlbfs.h, netfs.h, readahead.h, timestamp.h, writeback.h
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

[...]

> @@ -726,7 +726,7 @@ TRACE_EVENT(balance_dirty_pages,
>  		  __entry->pause,	/* ms */
>  		  __entry->period,	/* ms */
>  		  __entry->think,	/* ms */
> -		  (unsigned long)__entry->cgroup_ino
> +		  (unsigned long long)__entry->cgroup_ino

Do we really need this cast here ? (same comment for the following events).

Other than this, this looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply

* Re: [PATCH 01/61] vfs: widen inode hash/lookup functions to u64
From: Damien Le Moal @ 2026-02-26 22:56 UTC (permalink / raw)
  To: Jeff Layton, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes, coda,
	Nicolas Pitre, Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Naohiro Aota, Johannes Thumshirn, John Johansen,
	Paul Moore, James Morris, Serge E. Hallyn, Mimi Zohar,
	Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller
  Cc: linux-fsdevel, linux-kernel, linux-trace-kernel, nvdimm, fsverity,
	linux-mm, netfs, linux-ext4, linux-f2fs-devel, linux-nfs,
	linux-cifs, samba-technical, linux-nilfs, v9fs, linux-afs, autofs,
	ceph-devel, codalist, ecryptfs, linux-mtd, jfs-discussion, ntfs3,
	ocfs2-devel, devel, linux-unionfs, apparmor,
	linux-security-module, linux-integrity, selinux, amd-gfx,
	dri-devel, linux-media, linaro-mm-sig, netdev, linux-perf-users,
	linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-1-ccceff366db9@kernel.org>

On 2/27/26 00:55, Jeff Layton wrote:
> Change the inode hash/lookup VFS API functions to accept u64 parameters
> instead of unsigned long for inode numbers and hash values. This is
> preparation for widening i_ino itself to u64, which will allow
> filesystems to store full 64-bit inode numbers on 32-bit architectures.
> 
> Since unsigned long implicitly widens to u64 on all architectures, this
> change is backward-compatible with all existing callers.
> 
> Functions updated:
>   - hash(), find_inode_fast(), find_inode_by_ino_rcu(), test_inode_iunique()
>   - __insert_inode_hash(), iget_locked(), iget5_locked(), iget5_locked_rcu()
>   - ilookup(), ilookup5(), ilookup5_nowait()
>   - find_inode_nowait(), find_inode_rcu()
>   - inode_insert5(), insert_inode_locked4()
>   - insert_inode_locked() (local variable)
>   - dump_mapping() (local variable and format string)
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

[...]

> -int insert_inode_locked4(struct inode *inode, unsigned long hashval,
> +int insert_inode_locked4(struct inode *inode, u64 hashval,
>  		int (*test)(struct inode *, void *), void *data)
>  {
>  	struct inode *old;
> @@ -2642,7 +2642,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
>  		break;
>  	default:
>  		printk(KERN_DEBUG "init_special_inode: bogus i_mode (%o) for"
> -				  " inode %s:%lu\n", mode, inode->i_sb->s_id,
> +				  " inode %s:%llu\n", mode, inode->i_sb->s_id,

Hmmm. the type of ino in struct inode is changed in patch 2, not this patch. So
this feels incorrect. Why not just squash patch 2 in here ?

While at it, maybe you could change this to use pr_debug() too ?

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply

* Re: [PATCH] xfrm: kill xfrm_dev_{state,policy}_flush_secctx_check()
From: Paul Moore @ 2026-02-27  1:14 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Tetsuo Handa, SELinux, linux-security-module, Herbert Xu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Network Development
In-Reply-To: <aY76t_xYCHmLq6Ur@secunet.com>

On Fri, Feb 13, 2026 at 5:19 AM Steffen Klassert
<steffen.klassert@secunet.com> wrote:
> On Mon, Feb 09, 2026 at 11:26:14PM +0900, Tetsuo Handa wrote:
> > On 2026/02/09 20:22, Steffen Klassert wrote:
> > > On Mon, Feb 09, 2026 at 07:02:47PM +0900, Tetsuo Handa wrote:
> > >> On 2026/02/09 18:25, Steffen Klassert wrote:

...

> And here we come to the other problem I mentioned. When a LSM policy
> rejects to flush the xfrm states and policies on network namespace
> exit, we leak all the xfrm states and policies in that namespace.
> Here we have no other option, we must flush the xfrm states and
> policies regardless of any LSM policy. This can be fixed with
> something like that:
>
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 72678053bd69..8a4b2cbba0e0 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -1822,9 +1822,11 @@ int xfrm_policy_flush(struct net *net, u8 type, bool task_valid)
>
>         spin_lock_bh(&net->xfrm.xfrm_policy_lock);
>
> -       err = xfrm_policy_flush_secctx_check(net, type, task_valid);
> -       if (err)
> -               goto out;
> +       if (task_valid) {
> +               err = xfrm_policy_flush_secctx_check(net, type, task_valid);
> +               if (err)
> +                       goto out;
> +       }
>
>  again:
>         list_for_each_entry(pol, &net->xfrm.policy_all, walk.all) {
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> index f2aef404b583..fd00f2d20425 100644
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
> @@ -923,9 +923,11 @@ int xfrm_state_flush(struct net *net, u8 proto, bool task_valid)
>         int i, err = 0, cnt = 0;
>
>         spin_lock_bh(&net->xfrm.xfrm_state_lock);
> -       err = xfrm_state_flush_secctx_check(net, proto, task_valid);
> -       if (err)
> -               goto out;
> +       if (task_valid) {
> +               err = xfrm_state_flush_secctx_check(net, proto, task_valid);
> +               if (err)
> +                       goto out;
> +       }
>
>         err = -ESRCH;
>         for (i = 0; i <= net->xfrm.state_hmask; i++) {

This seems reasonable to me, and please correct me if I'm wrong, but
if the network namespace is gone at this point, we don't really have
to worry about traffic from any applications because there should no
longer be any processes in that namespace, yes?  I suppose there is
still a chance we'll see inbound traffic for endpoints in that
namespace, but I imagine the initns stack will reject it.

> > >> For example, we don't check permission for unmount when a mount is deleted
> > >> due to teardown of a mount namespace. I wonder why you want to check permission
> > >> for unregistering a net_device when triggered by a teardown path.
> > >
> > > I just try to find out what's the right thing to do here.
> > > If a policy goes away, packets that match this policy will
> > > find another path through the network stack. As best, they
> > > are dropped somewhere, but they can also leave on some other
> > > device without encryption. A LSM that implements xfrm hooks
> > > must be able to check the permission to delete the xfrm policy
> > > or state.
> >
> > Do you mean that calling xfrm_dev_down()/xfrm_dev_unregister() might
> > result in network traffic to be sent in cleartext ?
>
> Yes this can happen, but it is known. You can either install
> a global block policy with low priority or use a LSM to
> prevent this. The latter does not work unfortunately.

If I understand you correctly, the proposal below would address this
last part, yes?

> > If yes, we need to consider updating the other patch at
> > https://lkml.kernel.org/r/20260202123655.GK34749@unreal to replace
> > the NETDEV_UNREGISTER net_device with the blackhole_netdev. (That is,
> > xfrm_dev_{state,policy}_flush() does not actually delete a state/policy
> > but instead updates that state/policy to behave as a blackhole. Then,
> > we won't need to call LSM hooks because we no longer delete).
>
> I think there is a clean way to fix this. We could just unlink
> policy and state from the device. Then we could do the same as
> we do when a state becomes unavailable due to expiration. We mark
> the state as invalid with a flag. On expiration we do this with
> XFRM_STATE_EXPIRED. We can add a new flag and do the same as
> xfrm_state_check_expire() does on a hard expire. I.e. fire
> a timer that notifies the userspace key manager that this
> path is not avalable anymore and return an error. This way
> userspace is informed about that and all packets matching
> the policy are dropped.

This looks interesting.  The traffic would be dropped, and presumably
userspace could then cleanup the old state and establish any new
policy as required, yes?

> This is of course a bit more work and requires testing.

Tetsuo, Steffen, any chance one of the two of you would be able to
work on some patches for this?

-- 
paul-moore.com

^ permalink raw reply

* Re: [PATCH] cred: clarify usage of get_cred_rcu()
From: Paul Moore @ 2026-02-27  2:18 UTC (permalink / raw)
  To: Alice Ryhl; +Cc: Serge Hallyn, linux-security-module, linux-kernel
In-Reply-To: <20260220091941.1520313-1-aliceryhl@google.com>

On Fri, Feb 20, 2026 at 4:19 AM Alice Ryhl <aliceryhl@google.com> wrote:
>
> After being confused by looking at get_cred() and get_cred_rcu(), I
> figured out what's going on. Thus, add some comments to clarify how
> get_cred_rcu() works for the benefit of others looking in the future.
>
> Note that in principle we could add an assertion that non_rcu is zero in
> the failure path of atomic_long_inc_not_zero().

That would be interesting to add a WARN_ON() there and see what
happens.  Hopefully nothing, but one never knows ;)  Have you tried
this?

> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
>  include/linux/cred.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

...

> +/*
> + * get_cred_rcu - Get a reference on a set of credentials under rcu

I agree this is a bit pedantic, but it looks like the bulk of the file
capitalizes RCU and technically that is correct as it is an acronym.

> + * @cred: The credentials to reference
> + *
> + * Get a reference on the specified set of credentials, or %NULL if the last
> + * refcount has already been put.
> + *
> + * This is used to obtain a reference under an rcu read lock.

I would suggest a different description:

"Get a reference to the specified set of credentials and return a
pointer to the cred struct, or %NULL if it is not possible to obtain a
new reference.  After successfully taking a new reference to the
specified credentials, the cred struct will be marked for free'ing via
RCU."

> + */
>  static inline const struct cred *get_cred_rcu(const struct cred *cred)
>  {
>         struct cred *nonconst_cred = (struct cred *) cred;
>         if (!cred)
>                 return NULL;
>         if (!atomic_long_inc_not_zero(&nonconst_cred->usage))
>                 return NULL;
> +       /*
> +        * If non_rcu is not already zero, then this call to get_cred_rcu() is
> +        * probably wrong because if 'usage' goes to zero prior to this call,
> +        * then get_cred_rcu() assumes it is freed with rcu.
> +        *
> +        * However, an exception to this is using get_cred_rcu() in cases where
> +        * get_cred() would have been okay. To support that case, we do not
> +        * check non_rcu and set it to zero regardless.
> +        */

This is surely a matter of perspective, but the above seems a bit
wordy, and doesn't address what I believe is the important part:
setting non_rcu to zero means this credential will be freed
asynchronously via RCU.  Both get_cred_rcu() and get_cred() set
non_rcu to 0/false ... although get_cred() doesn't do the non-zero
check before bumping the refcount.

I suppose we could consider adding the zero check in the get_cred()
case, but even if we ignore the KCSAN barrier, it looks like the arch
support for the inc_not_zero() case isn't nearly as good, likely
resulting in more code to execute.

>         nonconst_cred->non_rcu = 0;
>         return cred;
>  }
> --
> 2.53.0.345.g96ddfc5eaa-goog

-- 
paul-moore.com

^ permalink raw reply

* Re: [PATCH v6 0/6] Extend "trusted" keys to support a new trust source named the PowerVM Key Wrapping Module (PKWM)
From: Christophe Leroy (CS GROUP) @ 2026-02-27  7:51 UTC (permalink / raw)
  To: Srish Srinivasan, linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, mpe, npiggin, James.Bottomley, jarkko, zohar, nayna,
	rnsastry, linux-kernel, linux-security-module
In-Reply-To: <20260201135930.898721-1-ssrish@linux.ibm.com>



Le 01/02/2026 à 14:59, Srish Srinivasan a écrit :
> Power11 has introduced a feature called the PowerVM Key Wrapping Module
> (PKWM), where PowerVM in combination with Power LPAR Platform KeyStore
> (PLPKS) [1] supports a new feature called "Key Wrapping" [2] to protect
> user secrets by wrapping them using a hypervisor generated wrapping key.
> This wrapping key is an AES-GCM-256 symmetric key that is stored as an
> object in the PLPKS. It has policy based protections that prevents it from
> being read out or exposed to the user. This wrapping key can then be used
> by the OS to wrap or unwrap secrets via hypervisor calls.
> 
> This patchset intends to add the PKWM, which is a combination of IBM
> PowerVM and PLPKS, as a new trust source for trusted keys. The wrapping key
> does not exist by default and its generation is requested by the kernel at
> the time of PKWM initialization. This key is then persisted by the PKWM and
> is used for wrapping any kernel provided key, and is never exposed to the
> user. The kernel is aware of only the label to this wrapping key.
> 
> Along with the PKWM implementation, this patchset includes two preparatory
> patches: one fixing the kernel-doc inconsistencies in the PLPKS code and
> another reorganizing PLPKS config variables in the sysfs.
> 
> Changelog:
> 
> v6:

Seems like v5 was applied, if needed can you send followup patch ?

Christophe

> 
> * Patch 1 to Patch 3:
>    - Add Nayna's Tested-by tag
> * Patch 4
>    - Fix build error reported by kernel test robot <lkp@intel.com>
>    - Add Nayna's Tested-by tag
> * Patch 5
>    - Add Nayna's Tested-by tag
> 
> v5:
> 
> * Patch 1 to Patch 3:
>    - Add Nayna's Reviewed-by tag
> * Patch 4:
>    - Fix build error identified by chleroy@kernel.org
>    - Add Nayna's Reviewed-by tag
> * Patch 5:
>    - Add Reviewed-by tags from Nayna and Jarkko
> 
> v4:
> 
> * Patch 5:
>    - Add a per-backend private data pointer in trusted_key_options
>      to store a pointer to the backend-specific options structure
>    - Minor clean-up
> 
> v3:
> 
> * Patch 2:
>    - Add Mimi's Reviewed-by tag
> * Patch 4:
>    - Minor tweaks to some print statements
>    - Fix typos
> * Patch 5:
>    - Fix typos
>    - Add Mimi's Reviewed-by tag
> * Patch 6:
>    - Add Mimi's Reviewed-by tag
> 
> v2:
> 
> * Patch 2:
>    - Fix build warning detected by the kernel test bot
> * Patch 5:
>    - Use pr_debug inside dump_options
>    - Replace policyhande with wrap_flags inside dump_options
>    - Provide meaningful error messages with error codes
> 
> Nayna Jain (1):
>    docs: trusted-encryped: add PKWM as a new trust source
> 
> Srish Srinivasan (5):
>    pseries/plpks: fix kernel-doc comment inconsistencies
>    powerpc/pseries: move the PLPKS config inside its own sysfs directory
>    pseries/plpks: expose PowerVM wrapping features via the sysfs
>    pseries/plpks: add HCALLs for PowerVM Key Wrapping Module
>    keys/trusted_keys: establish PKWM as a trusted source
> 
>   .../ABI/testing/sysfs-firmware-plpks          |  58 ++
>   Documentation/ABI/testing/sysfs-secvar        |  65 --
>   .../admin-guide/kernel-parameters.txt         |   1 +
>   Documentation/arch/powerpc/papr_hcalls.rst    |  43 ++
>   .../security/keys/trusted-encrypted.rst       |  50 ++
>   MAINTAINERS                                   |   9 +
>   arch/powerpc/include/asm/hvcall.h             |   4 +-
>   arch/powerpc/include/asm/plpks.h              |  95 +--
>   arch/powerpc/include/asm/secvar.h             |   1 -
>   arch/powerpc/kernel/secvar-sysfs.c            |  21 +-
>   arch/powerpc/platforms/pseries/Makefile       |   2 +-
>   arch/powerpc/platforms/pseries/plpks-secvar.c |  29 -
>   arch/powerpc/platforms/pseries/plpks-sysfs.c  |  96 +++
>   arch/powerpc/platforms/pseries/plpks.c        | 688 +++++++++++++++++-
>   include/keys/trusted-type.h                   |   7 +-
>   include/keys/trusted_pkwm.h                   |  33 +
>   security/keys/trusted-keys/Kconfig            |   8 +
>   security/keys/trusted-keys/Makefile           |   2 +
>   security/keys/trusted-keys/trusted_core.c     |   6 +-
>   security/keys/trusted-keys/trusted_pkwm.c     | 190 +++++
>   20 files changed, 1207 insertions(+), 201 deletions(-)
>   create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks
>   create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c
>   create mode 100644 include/keys/trusted_pkwm.h
>   create mode 100644 security/keys/trusted-keys/trusted_pkwm.c
> 


^ permalink raw reply

* Re: [PATCH 47/61] ubifs: update format strings for u64 i_ino
From: Zhihao Cheng @ 2026-02-27  8:16 UTC (permalink / raw)
  To: Jeff Layton, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes, coda,
	Nicolas Pitre, Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Damien Le Moal, Naohiro Aota, Johannes Thumshirn, John Johansen,
	Paul Moore, James Morris, Serge E. Hallyn, Mimi Zohar,
	Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller
  Cc: linux-fsdevel, linux-kernel, linux-trace-kernel, nvdimm, fsverity,
	linux-mm, netfs, linux-ext4, linux-f2fs-devel, linux-nfs,
	linux-cifs, samba-technical, linux-nilfs, v9fs, linux-afs, autofs,
	ceph-devel, codalist, ecryptfs, linux-mtd, jfs-discussion, ntfs3,
	ocfs2-devel, devel, linux-unionfs, apparmor,
	linux-security-module, linux-integrity, selinux, amd-gfx,
	dri-devel, linux-media, linaro-mm-sig, netdev, linux-perf-users,
	linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-47-ccceff366db9@kernel.org>

在 2026/2/26 23:55, Jeff Layton 写道:
> Update format strings and local variable types in ubifs for the
> i_ino type change from unsigned long to u64.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   fs/ubifs/debug.c   |  8 ++++----
>   fs/ubifs/dir.c     | 28 ++++++++++++++--------------
>   fs/ubifs/file.c    | 28 ++++++++++++++--------------
>   fs/ubifs/journal.c |  6 +++---
>   fs/ubifs/super.c   | 16 ++++++++--------
>   fs/ubifs/tnc.c     |  4 ++--
>   fs/ubifs/xattr.c   | 14 +++++++-------
>   7 files changed, 52 insertions(+), 52 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> 
> diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
> index 160c16aa7b6e7088355582670357262ab3930225..5794de5a9069f20302b6630c39c1452183137acc 100644
> --- a/fs/ubifs/debug.c
> +++ b/fs/ubifs/debug.c
> @@ -230,7 +230,7 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode)
>   	int count = 2;
>   
>   	pr_err("Dump in-memory inode:");
> -	pr_err("\tinode          %lu\n", inode->i_ino);
> +	pr_err("\tinode          %llu\n", inode->i_ino);
>   	pr_err("\tsize           %llu\n",
>   	       (unsigned long long)i_size_read(inode));
>   	pr_err("\tnlink          %u\n", inode->i_nlink);
> @@ -1101,7 +1101,7 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode)
>   	if (ui->ui_size != ui->synced_i_size && !ui->dirty) {
>   		ubifs_err(c, "ui_size is %lld, synced_i_size is %lld, but inode is clean",
>   			  ui->ui_size, ui->synced_i_size);
> -		ubifs_err(c, "i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino,
> +		ubifs_err(c, "i_ino %llu, i_mode %#x, i_size %lld", inode->i_ino,
>   			  inode->i_mode, i_size_read(inode));
>   		dump_stack();
>   		err = -EINVAL;
> @@ -1163,7 +1163,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir)
>   	kfree(pdent);
>   
>   	if (i_size_read(dir) != size) {
> -		ubifs_err(c, "directory inode %lu has size %llu, but calculated size is %llu",
> +		ubifs_err(c, "directory inode %llu has size %llu, but calculated size is %llu",
>   			  dir->i_ino, (unsigned long long)i_size_read(dir),
>   			  (unsigned long long)size);
>   		ubifs_dump_inode(c, dir);
> @@ -1171,7 +1171,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir)
>   		return -EINVAL;
>   	}
>   	if (dir->i_nlink != nlink) {
> -		ubifs_err(c, "directory inode %lu has nlink %u, but calculated nlink is %u",
> +		ubifs_err(c, "directory inode %llu has nlink %u, but calculated nlink is %u",
>   			  dir->i_ino, dir->i_nlink, nlink);
>   		ubifs_dump_inode(c, dir);
>   		dump_stack();
> diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> index 4c9f57f3b2adbbd396b288878cb18fa87cdbd0df..86d41e077e4d621dbb8c448acd0065c8ac7ae225 100644
> --- a/fs/ubifs/dir.c
> +++ b/fs/ubifs/dir.c
> @@ -223,7 +223,7 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,
>   	struct ubifs_info *c = dir->i_sb->s_fs_info;
>   	struct fscrypt_name nm;
>   
> -	dbg_gen("'%pd' in dir ino %lu", dentry, dir->i_ino);
> +	dbg_gen("'%pd' in dir ino %llu", dentry, dir->i_ino);
>   
>   	err = fscrypt_prepare_lookup(dir, dentry, &nm);
>   	if (err == -ENOENT)
> @@ -281,7 +281,7 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,
>   	if (IS_ENCRYPTED(dir) &&
>   	    (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&
>   	    !fscrypt_has_permitted_context(dir, inode)) {
> -		ubifs_warn(c, "Inconsistent encryption contexts: %lu/%lu",
> +		ubifs_warn(c, "Inconsistent encryption contexts: %llu/%llu",
>   			   dir->i_ino, inode->i_ino);
>   		iput(inode);
>   		inode = ERR_PTR(-EPERM);
> @@ -318,7 +318,7 @@ static int ubifs_create(struct mnt_idmap *idmap, struct inode *dir,
>   	 * parent directory inode.
>   	 */
>   
> -	dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
> +	dbg_gen("dent '%pd', mode %#hx in dir ino %llu",
>   		dentry, mode, dir->i_ino);
>   
>   	err = ubifs_budget_space(c, &req);
> @@ -386,7 +386,7 @@ static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry)
>   	 * atomically.
>   	 */
>   
> -	dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
> +	dbg_gen("dent '%pd', mode %#hx in dir ino %llu",
>   		dentry, mode, dir->i_ino);
>   
>   	inode = ubifs_new_inode(c, dir, mode, false);
> @@ -460,7 +460,7 @@ static int ubifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
>   	 * be released via writeback.
>   	 */
>   
> -	dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
> +	dbg_gen("dent '%pd', mode %#hx in dir ino %llu",
>   		dentry, mode, dir->i_ino);
>   
>   	err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
> @@ -589,7 +589,7 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
>   	bool encrypted = IS_ENCRYPTED(dir);
>   	struct ubifs_dir_data *data = file->private_data;
>   
> -	dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, ctx->pos);
> +	dbg_gen("dir ino %llu, f_pos %#llx", dir->i_ino, ctx->pos);
>   
>   	if (ctx->pos > UBIFS_S_KEY_HASH_MASK || ctx->pos == 2)
>   		/*
> @@ -764,7 +764,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
>   	 * changing the parent inode.
>   	 */
>   
> -	dbg_gen("dent '%pd' to ino %lu (nlink %d) in dir ino %lu",
> +	dbg_gen("dent '%pd' to ino %llu (nlink %d) in dir ino %llu",
>   		dentry, inode->i_ino,
>   		inode->i_nlink, dir->i_ino);
>   	ubifs_assert(c, inode_is_locked(dir));
> @@ -836,7 +836,7 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
>   	 * deletions.
>   	 */
>   
> -	dbg_gen("dent '%pd' from ino %lu (nlink %d) in dir ino %lu",
> +	dbg_gen("dent '%pd' from ino %llu (nlink %d) in dir ino %llu",
>   		dentry, inode->i_ino,
>   		inode->i_nlink, dir->i_ino);
>   
> @@ -941,7 +941,7 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
>   	 * because we have extra space reserved for deletions.
>   	 */
>   
> -	dbg_gen("directory '%pd', ino %lu in dir ino %lu", dentry,
> +	dbg_gen("directory '%pd', ino %llu in dir ino %llu", dentry,
>   		inode->i_ino, dir->i_ino);
>   	ubifs_assert(c, inode_is_locked(dir));
>   	ubifs_assert(c, inode_is_locked(inode));
> @@ -1018,7 +1018,7 @@ static struct dentry *ubifs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
>   	 * directory inode.
>   	 */
>   
> -	dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
> +	dbg_gen("dent '%pd', mode %#hx in dir ino %llu",
>   		dentry, mode, dir->i_ino);
>   
>   	err = ubifs_budget_space(c, &req);
> @@ -1096,7 +1096,7 @@ static int ubifs_mknod(struct mnt_idmap *idmap, struct inode *dir,
>   	 * directory inode.
>   	 */
>   
> -	dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino);
> +	dbg_gen("dent '%pd' in dir ino %llu", dentry, dir->i_ino);
>   
>   	if (S_ISBLK(mode) || S_ISCHR(mode)) {
>   		dev = kmalloc_obj(union ubifs_dev_desc, GFP_NOFS);
> @@ -1183,7 +1183,7 @@ static int ubifs_symlink(struct mnt_idmap *idmap, struct inode *dir,
>   					.dirtied_ino = 1 };
>   	struct fscrypt_name nm;
>   
> -	dbg_gen("dent '%pd', target '%s' in dir ino %lu", dentry,
> +	dbg_gen("dent '%pd', target '%s' in dir ino %llu", dentry,
>   		symname, dir->i_ino);
>   
>   	err = fscrypt_prepare_symlink(dir, symname, len, UBIFS_MAX_INO_DATA,
> @@ -1349,7 +1349,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
>   	 *   ino_req: marks the target inode as dirty and does not write it.
>   	 */
>   
> -	dbg_gen("dent '%pd' ino %lu in dir ino %lu to dent '%pd' in dir ino %lu flags 0x%x",
> +	dbg_gen("dent '%pd' ino %llu in dir ino %llu to dent '%pd' in dir ino %llu flags 0x%x",
>   		old_dentry, old_inode->i_ino, old_dir->i_ino,
>   		new_dentry, new_dir->i_ino, flags);
>   
> @@ -1597,7 +1597,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
>   	 * parent directory inodes.
>   	 */
>   
> -	dbg_gen("dent '%pd' ino %lu in dir ino %lu exchange dent '%pd' ino %lu in dir ino %lu",
> +	dbg_gen("dent '%pd' ino %llu in dir ino %llu exchange dent '%pd' ino %llu in dir ino %llu",
>   		old_dentry, fst_inode->i_ino, old_dir->i_ino,
>   		new_dentry, snd_inode->i_ino, new_dir->i_ino);
>   
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index cd04755e792a7f8e7d33ed4e67806cd202c71fad..e73c28b12f97fd1fbeb67510434e499eab84da70 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -90,7 +90,7 @@ static int read_block(struct inode *inode, struct folio *folio, size_t offset,
>   	return 0;
>   
>   dump:
> -	ubifs_err(c, "bad data node (block %u, inode %lu)",
> +	ubifs_err(c, "bad data node (block %u, inode %llu)",
>   		  block, inode->i_ino);
>   	ubifs_dump_node(c, dn, UBIFS_MAX_DATA_NODE_SZ);
>   	return -EINVAL;
> @@ -106,7 +106,7 @@ static int do_readpage(struct folio *folio)
>   	loff_t i_size = i_size_read(inode);
>   	size_t offset = 0;
>   
> -	dbg_gen("ino %lu, pg %lu, i_size %lld, flags %#lx",
> +	dbg_gen("ino %llu, pg %lu, i_size %lld, flags %#lx",
>   		inode->i_ino, folio->index, i_size, folio->flags.f);
>   	ubifs_assert(c, !folio_test_checked(folio));
>   	ubifs_assert(c, !folio->private);
> @@ -162,7 +162,7 @@ static int do_readpage(struct folio *folio)
>   			dbg_gen("hole");
>   			err = 0;
>   		} else {
> -			ubifs_err(c, "cannot read page %lu of inode %lu, error %d",
> +			ubifs_err(c, "cannot read page %lu of inode %llu, error %d",
>   				  folio->index, inode->i_ino, err);
>   		}
>   	}
> @@ -212,7 +212,7 @@ static int write_begin_slow(struct address_space *mapping,
>   	int err, appending = !!(pos + len > inode->i_size);
>   	struct folio *folio;
>   
> -	dbg_gen("ino %lu, pos %llu, len %u, i_size %lld",
> +	dbg_gen("ino %llu, pos %llu, len %u, i_size %lld",
>   		inode->i_ino, pos, len, inode->i_size);
>   
>   	/*
> @@ -526,7 +526,7 @@ static int ubifs_write_end(const struct kiocb *iocb,
>   	loff_t end_pos = pos + len;
>   	int appending = !!(end_pos > inode->i_size);
>   
> -	dbg_gen("ino %lu, pos %llu, pg %lu, len %u, copied %d, i_size %lld",
> +	dbg_gen("ino %llu, pos %llu, pg %lu, len %u, copied %d, i_size %lld",
>   		inode->i_ino, pos, folio->index, len, copied, inode->i_size);
>   
>   	if (unlikely(copied < len && !folio_test_uptodate(folio))) {
> @@ -599,7 +599,7 @@ static int populate_page(struct ubifs_info *c, struct folio *folio,
>   	size_t offset = 0;
>   	pgoff_t end_index;
>   
> -	dbg_gen("ino %lu, pg %lu, i_size %lld, flags %#lx",
> +	dbg_gen("ino %llu, pg %lu, i_size %lld, flags %#lx",
>   		inode->i_ino, folio->index, i_size, folio->flags.f);
>   
>   	end_index = (i_size - 1) >> PAGE_SHIFT;
> @@ -680,7 +680,7 @@ static int populate_page(struct ubifs_info *c, struct folio *folio,
>   	return 0;
>   
>   out_err:
> -	ubifs_err(c, "bad data node (block %u, inode %lu)",
> +	ubifs_err(c, "bad data node (block %u, inode %llu)",
>   		  page_block, inode->i_ino);
>   	return -EINVAL;
>   }
> @@ -913,7 +913,7 @@ static int do_writepage(struct folio *folio, size_t len)
>   	}
>   	if (err) {
>   		mapping_set_error(folio->mapping, err);
> -		ubifs_err(c, "cannot write folio %lu of inode %lu, error %d",
> +		ubifs_err(c, "cannot write folio %lu of inode %llu, error %d",
>   			  folio->index, inode->i_ino, err);
>   		ubifs_ro_mode(c, err);
>   	}
> @@ -987,7 +987,7 @@ static int ubifs_writepage(struct folio *folio, struct writeback_control *wbc)
>   	loff_t i_size =  i_size_read(inode), synced_i_size;
>   	int err, len = folio_size(folio);
>   
> -	dbg_gen("ino %lu, pg %lu, pg flags %#lx",
> +	dbg_gen("ino %llu, pg %lu, pg flags %#lx",
>   		inode->i_ino, folio->index, folio->flags.f);
>   	ubifs_assert(c, folio->private != NULL);
>   
> @@ -1106,7 +1106,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode,
>   	int offset = new_size & (UBIFS_BLOCK_SIZE - 1), budgeted = 1;
>   	struct ubifs_inode *ui = ubifs_inode(inode);
>   
> -	dbg_gen("ino %lu, size %lld -> %lld", inode->i_ino, old_size, new_size);
> +	dbg_gen("ino %llu, size %lld -> %lld", inode->i_ino, old_size, new_size);
>   	memset(&req, 0, sizeof(struct ubifs_budget_req));
>   
>   	/*
> @@ -1258,7 +1258,7 @@ int ubifs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
>   	struct inode *inode = d_inode(dentry);
>   	struct ubifs_info *c = inode->i_sb->s_fs_info;
>   
> -	dbg_gen("ino %lu, mode %#x, ia_valid %#x",
> +	dbg_gen("ino %llu, mode %#x, ia_valid %#x",
>   		inode->i_ino, inode->i_mode, attr->ia_valid);
>   	err = setattr_prepare(&nop_mnt_idmap, dentry, attr);
>   	if (err)
> @@ -1308,7 +1308,7 @@ int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
>   	struct ubifs_info *c = inode->i_sb->s_fs_info;
>   	int err;
>   
> -	dbg_gen("syncing inode %lu", inode->i_ino);
> +	dbg_gen("syncing inode %llu", inode->i_ino);
>   
>   	if (c->ro_mount)
>   		/*
> @@ -1495,7 +1495,7 @@ static vm_fault_t ubifs_vm_page_mkwrite(struct vm_fault *vmf)
>   	struct ubifs_budget_req req = { .new_page = 1 };
>   	int err, update_time;
>   
> -	dbg_gen("ino %lu, pg %lu, i_size %lld",	inode->i_ino, folio->index,
> +	dbg_gen("ino %llu, pg %lu, i_size %lld",	inode->i_ino, folio->index,
>   		i_size_read(inode));
>   	ubifs_assert(c, !c->ro_media && !c->ro_mount);
>   
> @@ -1531,7 +1531,7 @@ static vm_fault_t ubifs_vm_page_mkwrite(struct vm_fault *vmf)
>   	err = ubifs_budget_space(c, &req);
>   	if (unlikely(err)) {
>   		if (err == -ENOSPC)
> -			ubifs_warn(c, "out of space for mmapped file (inode number %lu)",
> +			ubifs_warn(c, "out of space for mmapped file (inode number %llu)",
>   				   inode->i_ino);
>   		return VM_FAULT_SIGBUS;
>   	}
> diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
> index e28ab4395e5ca404d8e8d8f735c3113b58bcc941..40a95a2fad50039f39917e71da7b71a735237469 100644
> --- a/fs/ubifs/journal.c
> +++ b/fs/ubifs/journal.c
> @@ -982,7 +982,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
>   	int kill_xattrs = ui->xattr_cnt && last_reference;
>   	u8 hash[UBIFS_HASH_ARR_SZ];
>   
> -	dbg_jnl("ino %lu, nlink %u", inode->i_ino, inode->i_nlink);
> +	dbg_jnl("ino %llu, nlink %u", inode->i_ino, inode->i_nlink);
>   
>   	if (kill_xattrs && ui->xattr_cnt > ubifs_xattr_max_cnt(c)) {
>   		ubifs_err(c, "Cannot delete inode, it has too many xattrs!");
> @@ -1743,7 +1743,7 @@ int ubifs_jnl_truncate(struct ubifs_info *c, const struct inode *inode,
>   			int dn_len = le32_to_cpu(dn->size);
>   
>   			if (dn_len <= 0 || dn_len > UBIFS_BLOCK_SIZE) {
> -				ubifs_err(c, "bad data node (block %u, inode %lu)",
> +				ubifs_err(c, "bad data node (block %u, inode %llu)",
>   					  blk, inode->i_ino);
>   				ubifs_dump_node(c, dn, dn_size);
>   				err = -EUCLEAN;
> @@ -1987,7 +1987,7 @@ int ubifs_jnl_change_xattr(struct ubifs_info *c, const struct inode *inode,
>   	u8 hash_host[UBIFS_HASH_ARR_SZ];
>   	u8 hash[UBIFS_HASH_ARR_SZ];
>   
> -	dbg_jnl("ino %lu, ino %lu", host->i_ino, inode->i_ino);
> +	dbg_jnl("ino %llu, ino %llu", host->i_ino, inode->i_ino);
>   	ubifs_assert(c, inode->i_nlink > 0);
>   	ubifs_assert(c, mutex_is_locked(&host_ui->ui_mutex));
>   
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 03bf924756ca003809d229837a970d5935450f23..9a77d8b64ffa70f9d5b695fb3d87c22cb223704f 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -92,7 +92,7 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
>   		return 5;
>   
>   	if (!ubifs_compr_present(c, ui->compr_type)) {
> -		ubifs_warn(c, "inode %lu uses '%s' compression, but it was not compiled in",
> +		ubifs_warn(c, "inode %llu uses '%s' compression, but it was not compiled in",
>   			   inode->i_ino, ubifs_compr_name(c, ui->compr_type));
>   	}
>   
> @@ -248,14 +248,14 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
>   	return inode;
>   
>   out_invalid:
> -	ubifs_err(c, "inode %lu validation failed, error %d", inode->i_ino, err);
> +	ubifs_err(c, "inode %llu validation failed, error %d", inode->i_ino, err);
>   	ubifs_dump_node(c, ino, UBIFS_MAX_INO_NODE_SZ);
>   	ubifs_dump_inode(c, inode);
>   	err = -EINVAL;
>   out_ino:
>   	kfree(ino);
>   out:
> -	ubifs_err(c, "failed to read inode %lu, error %d", inode->i_ino, err);
> +	ubifs_err(c, "failed to read inode %llu, error %d", inode->i_ino, err);
>   	iget_failed(inode);
>   	return ERR_PTR(err);
>   }
> @@ -316,12 +316,12 @@ static int ubifs_write_inode(struct inode *inode, struct writeback_control *wbc)
>   	 * As an optimization, do not write orphan inodes to the media just
>   	 * because this is not needed.
>   	 */
> -	dbg_gen("inode %lu, mode %#x, nlink %u",
> +	dbg_gen("inode %llu, mode %#x, nlink %u",
>   		inode->i_ino, (int)inode->i_mode, inode->i_nlink);
>   	if (inode->i_nlink) {
>   		err = ubifs_jnl_write_inode(c, inode);
>   		if (err)
> -			ubifs_err(c, "can't write inode %lu, error %d",
> +			ubifs_err(c, "can't write inode %llu, error %d",
>   				  inode->i_ino, err);
>   		else
>   			err = dbg_check_inode_size(c, inode, ui->ui_size);
> @@ -357,7 +357,7 @@ static void ubifs_evict_inode(struct inode *inode)
>   		 */
>   		goto out;
>   
> -	dbg_gen("inode %lu, mode %#x", inode->i_ino, (int)inode->i_mode);
> +	dbg_gen("inode %llu, mode %#x", inode->i_ino, (int)inode->i_mode);
>   	ubifs_assert(c, !icount_read(inode));
>   
>   	truncate_inode_pages_final(&inode->i_data);
> @@ -375,7 +375,7 @@ static void ubifs_evict_inode(struct inode *inode)
>   		 * Worst case we have a lost orphan inode wasting space, so a
>   		 * simple error message is OK here.
>   		 */
> -		ubifs_err(c, "can't delete inode %lu, error %d",
> +		ubifs_err(c, "can't delete inode %llu, error %d",
>   			  inode->i_ino, err);
>   
>   out:
> @@ -399,7 +399,7 @@ static void ubifs_dirty_inode(struct inode *inode, int flags)
>   	ubifs_assert(c, mutex_is_locked(&ui->ui_mutex));
>   	if (!ui->dirty) {
>   		ui->dirty = 1;
> -		dbg_gen("inode %lu",  inode->i_ino);
> +		dbg_gen("inode %llu",  inode->i_ino);
>   	}
>   }
>   
> diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
> index 694b08d27d7d9c7d9d7d9039f406637c702f8613..52c758c5290d8cc425fdc6d49c608d0cb0ba7ff7 100644
> --- a/fs/ubifs/tnc.c
> +++ b/fs/ubifs/tnc.c
> @@ -3561,8 +3561,8 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
>   
>   out_dump:
>   	block = key_block(c, key);
> -	ubifs_err(c, "inode %lu has size %lld, but there are data at offset %lld",
> -		  (unsigned long)inode->i_ino, size,
> +	ubifs_err(c, "inode %llu has size %lld, but there are data at offset %lld",
> +		  (unsigned long long)inode->i_ino, size,
>   		  ((loff_t)block) << UBIFS_BLOCK_SHIFT);
>   	mutex_unlock(&c->tnc_mutex);
>   	ubifs_dump_inode(c, inode);
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index c21a0c2b3e907c1572780d4a3e48cc9d2a11b9d6..b5a9ab9d8a10adcf49e6d7228d385cb986e6e75e 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -76,7 +76,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
>   				.dirtied_ino_d = ALIGN(host_ui->data_len, 8) };
>   
>   	if (host_ui->xattr_cnt >= ubifs_xattr_max_cnt(c)) {
> -		ubifs_err(c, "inode %lu already has too many xattrs (%d), cannot create more",
> +		ubifs_err(c, "inode %llu already has too many xattrs (%d), cannot create more",
>   			  host->i_ino, host_ui->xattr_cnt);
>   		return -ENOSPC;
>   	}
> @@ -88,7 +88,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
>   	 */
>   	names_len = host_ui->xattr_names + host_ui->xattr_cnt + fname_len(nm) + 1;
>   	if (names_len > XATTR_LIST_MAX) {
> -		ubifs_err(c, "cannot add one more xattr name to inode %lu, total names length would become %d, max. is %d",
> +		ubifs_err(c, "cannot add one more xattr name to inode %llu, total names length would become %d, max. is %d",
>   			  host->i_ino, names_len, XATTR_LIST_MAX);
>   		return -ENOSPC;
>   	}
> @@ -390,7 +390,7 @@ ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size)
>   	int err, len, written = 0;
>   	struct fscrypt_name nm = {0};
>   
> -	dbg_gen("ino %lu ('%pd'), buffer size %zd", host->i_ino,
> +	dbg_gen("ino %llu ('%pd'), buffer size %zd", host->i_ino,
>   		dentry, size);
>   
>   	down_read(&host_ui->xattr_sem);
> @@ -498,7 +498,7 @@ int ubifs_purge_xattrs(struct inode *host)
>   	if (ubifs_inode(host)->xattr_cnt <= ubifs_xattr_max_cnt(c))
>   		return 0;
>   
> -	ubifs_warn(c, "inode %lu has too many xattrs, doing a non-atomic deletion",
> +	ubifs_warn(c, "inode %llu has too many xattrs, doing a non-atomic deletion",
>   		   host->i_ino);
>   
>   	down_write(&ubifs_inode(host)->xattr_sem);
> @@ -641,7 +641,7 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
>   					   &init_xattrs, NULL);
>   	if (err) {
>   		struct ubifs_info *c = dentry->i_sb->s_fs_info;
> -		ubifs_err(c, "cannot initialize security for inode %lu, error %d",
> +		ubifs_err(c, "cannot initialize security for inode %llu, error %d",
>   			  inode->i_ino, err);
>   	}
>   	return err;
> @@ -652,7 +652,7 @@ static int xattr_get(const struct xattr_handler *handler,
>   			   struct dentry *dentry, struct inode *inode,
>   			   const char *name, void *buffer, size_t size)
>   {
> -	dbg_gen("xattr '%s', ino %lu ('%pd'), buf size %zd", name,
> +	dbg_gen("xattr '%s', ino %llu ('%pd'), buf size %zd", name,
>   		inode->i_ino, dentry, size);
>   
>   	name = xattr_full_name(handler, name);
> @@ -665,7 +665,7 @@ static int xattr_set(const struct xattr_handler *handler,
>   			   const char *name, const void *value,
>   			   size_t size, int flags)
>   {
> -	dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd",
> +	dbg_gen("xattr '%s', host ino %llu ('%pd'), size %zd",
>   		name, inode->i_ino, dentry, size);
>   
>   	name = xattr_full_name(handler, name);
> 


^ permalink raw reply

* Re: [PATCH v6 0/6] Extend "trusted" keys to support a new trust source named the PowerVM Key Wrapping Module (PKWM)
From: Srish Srinivasan @ 2026-02-27  8:29 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP), linux-integrity, keyrings,
	linuxppc-dev
  Cc: maddy, mpe, npiggin, James.Bottomley, jarkko, zohar, nayna,
	rnsastry, linux-kernel, linux-security-module
In-Reply-To: <31dfcf7a-5b3d-406d-bdd4-c8b09f7eb1f0@kernel.org>

Hi Christophe,

On 2/27/26 1:21 PM, Christophe Leroy (CS GROUP) wrote:
>
>
> Le 01/02/2026 à 14:59, Srish Srinivasan a écrit :
>> Power11 has introduced a feature called the PowerVM Key Wrapping Module
>> (PKWM), where PowerVM in combination with Power LPAR Platform KeyStore
>> (PLPKS) [1] supports a new feature called "Key Wrapping" [2] to protect
>> user secrets by wrapping them using a hypervisor generated wrapping key.
>> This wrapping key is an AES-GCM-256 symmetric key that is stored as an
>> object in the PLPKS. It has policy based protections that prevents it 
>> from
>> being read out or exposed to the user. This wrapping key can then be 
>> used
>> by the OS to wrap or unwrap secrets via hypervisor calls.
>>
>> This patchset intends to add the PKWM, which is a combination of IBM
>> PowerVM and PLPKS, as a new trust source for trusted keys. The 
>> wrapping key
>> does not exist by default and its generation is requested by the 
>> kernel at
>> the time of PKWM initialization. This key is then persisted by the 
>> PKWM and
>> is used for wrapping any kernel provided key, and is never exposed to 
>> the
>> user. The kernel is aware of only the label to this wrapping key.
>>
>> Along with the PKWM implementation, this patchset includes two 
>> preparatory
>> patches: one fixing the kernel-doc inconsistencies in the PLPKS code and
>> another reorganizing PLPKS config variables in the sysfs.
>>
>> Changelog:
>>
>> v6:
>
> Seems like v5 was applied, if needed can you send followup patch ?
>
> Christophe


I had sent out a patch on top of v5 to take care of this, and it has 
been applied.

thanks,
Srish.


>
>>
>> * Patch 1 to Patch 3:
>>    - Add Nayna's Tested-by tag
>> * Patch 4
>>    - Fix build error reported by kernel test robot <lkp@intel.com>
>>    - Add Nayna's Tested-by tag
>> * Patch 5
>>    - Add Nayna's Tested-by tag
>>
>> v5:
>>
>> * Patch 1 to Patch 3:
>>    - Add Nayna's Reviewed-by tag
>> * Patch 4:
>>    - Fix build error identified by chleroy@kernel.org
>>    - Add Nayna's Reviewed-by tag
>> * Patch 5:
>>    - Add Reviewed-by tags from Nayna and Jarkko
>>
>> v4:
>>
>> * Patch 5:
>>    - Add a per-backend private data pointer in trusted_key_options
>>      to store a pointer to the backend-specific options structure
>>    - Minor clean-up
>>
>> v3:
>>
>> * Patch 2:
>>    - Add Mimi's Reviewed-by tag
>> * Patch 4:
>>    - Minor tweaks to some print statements
>>    - Fix typos
>> * Patch 5:
>>    - Fix typos
>>    - Add Mimi's Reviewed-by tag
>> * Patch 6:
>>    - Add Mimi's Reviewed-by tag
>>
>> v2:
>>
>> * Patch 2:
>>    - Fix build warning detected by the kernel test bot
>> * Patch 5:
>>    - Use pr_debug inside dump_options
>>    - Replace policyhande with wrap_flags inside dump_options
>>    - Provide meaningful error messages with error codes
>>
>> Nayna Jain (1):
>>    docs: trusted-encryped: add PKWM as a new trust source
>>
>> Srish Srinivasan (5):
>>    pseries/plpks: fix kernel-doc comment inconsistencies
>>    powerpc/pseries: move the PLPKS config inside its own sysfs directory
>>    pseries/plpks: expose PowerVM wrapping features via the sysfs
>>    pseries/plpks: add HCALLs for PowerVM Key Wrapping Module
>>    keys/trusted_keys: establish PKWM as a trusted source
>>
>>   .../ABI/testing/sysfs-firmware-plpks          |  58 ++
>>   Documentation/ABI/testing/sysfs-secvar        |  65 --
>>   .../admin-guide/kernel-parameters.txt         |   1 +
>>   Documentation/arch/powerpc/papr_hcalls.rst    |  43 ++
>>   .../security/keys/trusted-encrypted.rst       |  50 ++
>>   MAINTAINERS                                   |   9 +
>>   arch/powerpc/include/asm/hvcall.h             |   4 +-
>>   arch/powerpc/include/asm/plpks.h              |  95 +--
>>   arch/powerpc/include/asm/secvar.h             |   1 -
>>   arch/powerpc/kernel/secvar-sysfs.c            |  21 +-
>>   arch/powerpc/platforms/pseries/Makefile       |   2 +-
>>   arch/powerpc/platforms/pseries/plpks-secvar.c |  29 -
>>   arch/powerpc/platforms/pseries/plpks-sysfs.c  |  96 +++
>>   arch/powerpc/platforms/pseries/plpks.c        | 688 +++++++++++++++++-
>>   include/keys/trusted-type.h                   |   7 +-
>>   include/keys/trusted_pkwm.h                   |  33 +
>>   security/keys/trusted-keys/Kconfig            |   8 +
>>   security/keys/trusted-keys/Makefile           |   2 +
>>   security/keys/trusted-keys/trusted_core.c     |   6 +-
>>   security/keys/trusted-keys/trusted_pkwm.c     | 190 +++++
>>   20 files changed, 1207 insertions(+), 201 deletions(-)
>>   create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks
>>   create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c
>>   create mode 100644 include/keys/trusted_pkwm.h
>>   create mode 100644 security/keys/trusted-keys/trusted_pkwm.c
>>
>

^ permalink raw reply

* Re: [PATCH 00/61] vfs: change inode->i_ino from unsigned long to u64
From: Christian König @ 2026-02-27  9:30 UTC (permalink / raw)
  To: Jeff Layton, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes, coda,
	Nicolas Pitre, Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	David Airlie, Simona Vetter, Sumit Semwal, Eric Dumazet,
	Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn, David S. Miller,
	Jakub Kicinski, Simon Horman, Oleg Nesterov, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Darrick J. Wong, Martin Schiller
  Cc: linux-fsdevel, linux-kernel, linux-trace-kernel, nvdimm, fsverity,
	linux-mm, netfs, linux-ext4, linux-f2fs-devel, linux-nfs,
	linux-cifs, samba-technical, linux-nilfs, v9fs, linux-afs, autofs,
	ceph-devel, codalist, ecryptfs, linux-mtd, jfs-discussion, ntfs3,
	ocfs2-devel, devel, linux-unionfs, apparmor,
	linux-security-module, linux-integrity, selinux, amd-gfx,
	dri-devel, linux-media, linaro-mm-sig, netdev, linux-perf-users,
	linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-0-ccceff366db9@kernel.org>

On 2/26/26 16:55, Jeff Layton wrote:
> Christian said [1] to "just do it" when I proposed this, so here we are!
> 
> For historical reasons, the inode->i_ino field is an unsigned long,
> which means that it's 32 bits on 32 bit architectures. This has caused a
> number of filesystems to implement hacks to hash a 64-bit identifier
> into a 32-bit field, and deprives us of a universal identifier field for
> an inode.
> 
> This patchset changes the inode->i_ino field from an unsigned long to a
> u64. This shouldn't make any material difference on 64-bit hosts, but
> 32-bit hosts will see struct inode grow by at least 4 bytes. This could
> have effects on slabcache sizes and field alignment.
> 
> The bulk of the changes are to format strings and tracepoints, since the
> kernel itself doesn't care that much about the i_ino field. The first
> patch changes some vfs function arguments, so check that one out
> carefully.
> 
> With this change, we may be able to shrink some inode structures. For
> instance, struct nfs_inode has a fileid field that holds the 64-bit
> inode number. With this set of changes, that field could be eliminated.
> I'd rather leave that sort of cleanups for later just to keep this
> simple.
> 
> Much of this set was generated by LLM, but I attributed it to myself
> since I consider this to be in the "menial tasks" category of LLM usage.

Sounds reasonable to me, should get_next_ino() also be changed to return an 64bit ino?

Currently it is always only 32bit and we have workarounds for that in DMA-buf for example.

Thanks,
Christian.

> 
> [1]: https://lore.kernel.org/linux-fsdevel/20260219-portrait-winkt-959070cee42f@brauner/
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> Jeff Layton (61):
>       vfs: widen inode hash/lookup functions to u64
>       vfs: change i_ino from unsigned long to u64
>       trace: update VFS-layer trace events for u64 i_ino
>       ext4: update for u64 i_ino
>       jbd2: update format strings for u64 i_ino
>       f2fs: update for u64 i_ino
>       lockd: update format strings for u64 i_ino
>       nfs: update for u64 i_ino
>       nfs: remove nfs_fattr_to_ino_t() and nfs_fileid_to_ino_t()
>       nfs: remove nfs_compat_user_ino64()
>       nfs: remove enable_ino64 module parameter
>       nfsd: update format strings for u64 i_ino
>       smb: store full 64-bit uniqueid in i_ino
>       smb: remove cifs_uniqueid_to_ino_t()
>       locks: update /proc/locks format for u64 i_ino
>       proc: update /proc/PID/maps for u64 i_ino
>       nilfs2: update for u64 i_ino
>       9p: update format strings for u64 i_ino
>       affs: update format strings for u64 i_ino
>       afs: update format strings for u64 i_ino
>       autofs: update format strings for u64 i_ino
>       befs: update format strings for u64 i_ino
>       bfs: update format strings for u64 i_ino
>       cachefiles: update format strings for u64 i_ino
>       ceph: update format strings for u64 i_ino
>       coda: update format strings for u64 i_ino
>       cramfs: update format strings for u64 i_ino
>       ecryptfs: update format strings for u64 i_ino
>       efs: update format strings for u64 i_ino
>       exportfs: update format strings for u64 i_ino
>       ext2: update format strings for u64 i_ino
>       freevxfs: update format strings for u64 i_ino
>       hfs: update format strings for u64 i_ino
>       hfsplus: update format strings for u64 i_ino
>       hpfs: update format strings for u64 i_ino
>       isofs: update format strings for u64 i_ino
>       jffs2: update format strings for u64 i_ino
>       jfs: update format strings for u64 i_ino
>       minix: update format strings for u64 i_ino
>       nsfs: update format strings for u64 i_ino
>       ntfs3: update format strings for u64 i_ino
>       ocfs2: update format strings for u64 i_ino
>       orangefs: update format strings for u64 i_ino
>       overlayfs: update format strings for u64 i_ino
>       qnx4: update format strings for u64 i_ino
>       qnx6: update format strings for u64 i_ino
>       ubifs: update format strings for u64 i_ino
>       udf: update format strings for u64 i_ino
>       ufs: update format strings for u64 i_ino
>       zonefs: update format strings for u64 i_ino
>       security: update audit format strings for u64 i_ino
>       drm/amdgpu: update for u64 i_ino
>       fsnotify: update fdinfo format strings for u64 i_ino
>       net: update socket dname format for u64 i_ino
>       uprobes: update format strings for u64 i_ino
>       dma-buf: update format string for u64 i_ino
>       fscrypt: update format strings for u64 i_ino
>       fsverity: update format string for u64 i_ino
>       iomap: update format string for u64 i_ino
>       net: update legacy protocol format strings for u64 i_ino
>       vfs: update core format strings for u64 i_ino
> 
>  drivers/dma-buf/dma-buf.c                  |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |   4 +-
>  fs/9p/vfs_addr.c                           |   4 +-
>  fs/9p/vfs_inode.c                          |   6 +-
>  fs/9p/vfs_inode_dotl.c                     |   6 +-
>  fs/affs/amigaffs.c                         |   8 +-
>  fs/affs/bitmap.c                           |   2 +-
>  fs/affs/dir.c                              |   2 +-
>  fs/affs/file.c                             |  20 +-
>  fs/affs/inode.c                            |  12 +-
>  fs/affs/namei.c                            |  14 +-
>  fs/affs/symlink.c                          |   2 +-
>  fs/afs/dir.c                               |  10 +-
>  fs/afs/dir_search.c                        |   2 +-
>  fs/afs/dynroot.c                           |   2 +-
>  fs/afs/inode.c                             |   2 +-
>  fs/autofs/inode.c                          |   2 +-
>  fs/befs/linuxvfs.c                         |  28 +-
>  fs/bfs/dir.c                               |   4 +-
>  fs/cachefiles/io.c                         |   6 +-
>  fs/cachefiles/namei.c                      |  12 +-
>  fs/cachefiles/xattr.c                      |   2 +-
>  fs/ceph/crypto.c                           |   4 +-
>  fs/coda/dir.c                              |   2 +-
>  fs/coda/inode.c                            |   2 +-
>  fs/cramfs/inode.c                          |   2 +-
>  fs/crypto/crypto.c                         |   2 +-
>  fs/crypto/hooks.c                          |   2 +-
>  fs/crypto/keysetup.c                       |   2 +-
>  fs/dcache.c                                |   4 +-
>  fs/ecryptfs/crypto.c                       |   6 +-
>  fs/ecryptfs/file.c                         |   2 +-
>  fs/efs/inode.c                             |   6 +-
>  fs/eventpoll.c                             |   2 +-
>  fs/exportfs/expfs.c                        |   4 +-
>  fs/ext2/dir.c                              |  10 +-
>  fs/ext2/ialloc.c                           |   9 +-
>  fs/ext2/inode.c                            |   2 +-
>  fs/ext2/xattr.c                            |  14 +-
>  fs/ext4/dir.c                              |   2 +-
>  fs/ext4/ext4.h                             |   4 +-
>  fs/ext4/extents.c                          |   8 +-
>  fs/ext4/extents_status.c                   |  28 +-
>  fs/ext4/fast_commit.c                      |   8 +-
>  fs/ext4/ialloc.c                           |  10 +-
>  fs/ext4/indirect.c                         |   2 +-
>  fs/ext4/inline.c                           |  14 +-
>  fs/ext4/inode.c                            |  22 +-
>  fs/ext4/ioctl.c                            |   4 +-
>  fs/ext4/mballoc.c                          |   6 +-
>  fs/ext4/migrate.c                          |   2 +-
>  fs/ext4/move_extent.c                      |  20 +-
>  fs/ext4/namei.c                            |  10 +-
>  fs/ext4/orphan.c                           |  16 +-
>  fs/ext4/page-io.c                          |  10 +-
>  fs/ext4/super.c                            |  22 +-
>  fs/ext4/xattr.c                            |  10 +-
>  fs/f2fs/compress.c                         |   4 +-
>  fs/f2fs/dir.c                              |   2 +-
>  fs/f2fs/extent_cache.c                     |   8 +-
>  fs/f2fs/f2fs.h                             |   6 +-
>  fs/f2fs/file.c                             |  12 +-
>  fs/f2fs/gc.c                               |   2 +-
>  fs/f2fs/inline.c                           |   4 +-
>  fs/f2fs/inode.c                            |  48 ++--
>  fs/f2fs/namei.c                            |   8 +-
>  fs/f2fs/node.c                             |  12 +-
>  fs/f2fs/recovery.c                         |  10 +-
>  fs/f2fs/xattr.c                            |  10 +-
>  fs/freevxfs/vxfs_bmap.c                    |   4 +-
>  fs/fserror.c                               |   2 +-
>  fs/hfs/catalog.c                           |   2 +-
>  fs/hfs/extent.c                            |   4 +-
>  fs/hfs/inode.c                             |   4 +-
>  fs/hfsplus/attributes.c                    |  10 +-
>  fs/hfsplus/catalog.c                       |   2 +-
>  fs/hfsplus/dir.c                           |   6 +-
>  fs/hfsplus/extents.c                       |   6 +-
>  fs/hfsplus/inode.c                         |   8 +-
>  fs/hfsplus/super.c                         |   6 +-
>  fs/hfsplus/xattr.c                         |  10 +-
>  fs/hpfs/dir.c                              |   4 +-
>  fs/hpfs/dnode.c                            |   4 +-
>  fs/hpfs/ea.c                               |   4 +-
>  fs/hpfs/inode.c                            |   4 +-
>  fs/inode.c                                 |  46 ++--
>  fs/iomap/ioend.c                           |   2 +-
>  fs/isofs/compress.c                        |   2 +-
>  fs/isofs/dir.c                             |   2 +-
>  fs/isofs/inode.c                           |   6 +-
>  fs/isofs/namei.c                           |   2 +-
>  fs/jbd2/journal.c                          |   4 +-
>  fs/jbd2/transaction.c                      |   2 +-
>  fs/jffs2/dir.c                             |   4 +-
>  fs/jffs2/file.c                            |   4 +-
>  fs/jffs2/fs.c                              |  18 +-
>  fs/jfs/inode.c                             |   2 +-
>  fs/jfs/jfs_imap.c                          |   2 +-
>  fs/jfs/jfs_metapage.c                      |   2 +-
>  fs/lockd/svclock.c                         |   8 +-
>  fs/lockd/svcsubs.c                         |   2 +-
>  fs/locks.c                                 |   6 +-
>  fs/minix/inode.c                           |  10 +-
>  fs/nfs/dir.c                               |  22 +-
>  fs/nfs/file.c                              |   8 +-
>  fs/nfs/filelayout/filelayout.c             |   8 +-
>  fs/nfs/flexfilelayout/flexfilelayout.c     |   8 +-
>  fs/nfs/inode.c                             |  54 +---
>  fs/nfs/nfs4proc.c                          |   4 +-
>  fs/nfs/pnfs.c                              |  12 +-
>  fs/nfsd/export.c                           |   2 +-
>  fs/nfsd/nfs4state.c                        |   4 +-
>  fs/nfsd/nfsfh.c                            |   4 +-
>  fs/nfsd/vfs.c                              |   2 +-
>  fs/nilfs2/alloc.c                          |  10 +-
>  fs/nilfs2/bmap.c                           |   2 +-
>  fs/nilfs2/btnode.c                         |   2 +-
>  fs/nilfs2/btree.c                          |  12 +-
>  fs/nilfs2/dir.c                            |  12 +-
>  fs/nilfs2/direct.c                         |   4 +-
>  fs/nilfs2/gcinode.c                        |   2 +-
>  fs/nilfs2/inode.c                          |   8 +-
>  fs/nilfs2/mdt.c                            |   2 +-
>  fs/nilfs2/namei.c                          |   2 +-
>  fs/nilfs2/segment.c                        |   2 +-
>  fs/notify/fdinfo.c                         |   4 +-
>  fs/nsfs.c                                  |   4 +-
>  fs/ntfs3/super.c                           |   2 +-
>  fs/ocfs2/alloc.c                           |   2 +-
>  fs/ocfs2/aops.c                            |   4 +-
>  fs/ocfs2/dir.c                             |   8 +-
>  fs/ocfs2/dlmfs/dlmfs.c                     |  10 +-
>  fs/ocfs2/extent_map.c                      |  12 +-
>  fs/ocfs2/inode.c                           |   2 +-
>  fs/ocfs2/quota_local.c                     |   2 +-
>  fs/ocfs2/refcounttree.c                    |  10 +-
>  fs/ocfs2/xattr.c                           |   4 +-
>  fs/orangefs/inode.c                        |   2 +-
>  fs/overlayfs/export.c                      |   2 +-
>  fs/overlayfs/namei.c                       |   4 +-
>  fs/overlayfs/util.c                        |   2 +-
>  fs/pipe.c                                  |   2 +-
>  fs/proc/fd.c                               |   2 +-
>  fs/proc/task_mmu.c                         |   4 +-
>  fs/qnx4/inode.c                            |   4 +-
>  fs/qnx6/inode.c                            |   2 +-
>  fs/smb/client/cifsfs.h                     |  17 --
>  fs/smb/client/inode.c                      |   6 +-
>  fs/smb/client/readdir.c                    |   2 +-
>  fs/ubifs/debug.c                           |   8 +-
>  fs/ubifs/dir.c                             |  28 +-
>  fs/ubifs/file.c                            |  28 +-
>  fs/ubifs/journal.c                         |   6 +-
>  fs/ubifs/super.c                           |  16 +-
>  fs/ubifs/tnc.c                             |   4 +-
>  fs/ubifs/xattr.c                           |  14 +-
>  fs/udf/directory.c                         |  18 +-
>  fs/udf/file.c                              |   2 +-
>  fs/udf/inode.c                             |  12 +-
>  fs/udf/namei.c                             |   8 +-
>  fs/udf/super.c                             |   2 +-
>  fs/ufs/balloc.c                            |   6 +-
>  fs/ufs/dir.c                               |  10 +-
>  fs/ufs/ialloc.c                            |   6 +-
>  fs/ufs/inode.c                             |  18 +-
>  fs/ufs/ufs_fs.h                            |   6 +-
>  fs/ufs/util.c                              |   2 +-
>  fs/verity/init.c                           |   2 +-
>  fs/zonefs/super.c                          |   8 +-
>  include/linux/fs.h                         |  28 +-
>  include/linux/nfs_fs.h                     |  10 -
>  include/trace/events/cachefiles.h          |  18 +-
>  include/trace/events/ext4.h                | 427 +++++++++++++++--------------
>  include/trace/events/f2fs.h                | 172 ++++++------
>  include/trace/events/filelock.h            |  16 +-
>  include/trace/events/filemap.h             |  20 +-
>  include/trace/events/fs_dax.h              |  20 +-
>  include/trace/events/fsverity.h            |  30 +-
>  include/trace/events/hugetlbfs.h           |  28 +-
>  include/trace/events/netfs.h               |   4 +-
>  include/trace/events/nilfs2.h              |  12 +-
>  include/trace/events/readahead.h           |  12 +-
>  include/trace/events/timestamp.h           |  12 +-
>  include/trace/events/writeback.h           | 148 +++++-----
>  kernel/events/uprobes.c                    |   4 +-
>  net/netrom/af_netrom.c                     |   4 +-
>  net/rose/af_rose.c                         |   4 +-
>  net/socket.c                               |   2 +-
>  net/x25/x25_proc.c                         |   4 +-
>  security/apparmor/apparmorfs.c             |   4 +-
>  security/integrity/integrity_audit.c       |   2 +-
>  security/ipe/audit.c                       |   2 +-
>  security/lsm_audit.c                       |  10 +-
>  security/selinux/hooks.c                   |   4 +-
>  security/smack/smack_lsm.c                 |  12 +-
>  195 files changed, 1101 insertions(+), 1166 deletions(-)
> ---
> base-commit: 2bf35e96cf6c6c3a290b69b777d34be15888e364
> change-id: 20260224-iino-u64-b44a3a72543c
> 
> Best regards,


^ permalink raw reply

* Re: [PATCH] cred: clarify usage of get_cred_rcu()
From: Alice Ryhl @ 2026-02-27 10:04 UTC (permalink / raw)
  To: Paul Moore; +Cc: Serge Hallyn, linux-security-module, linux-kernel
In-Reply-To: <CAHC9VhTwJbuXrdUFxWLVWfgk45hLScPgaC9Xb+R2NH6NGdaMZQ@mail.gmail.com>

On Thu, Feb 26, 2026 at 09:18:29PM -0500, Paul Moore wrote:
> On Fri, Feb 20, 2026 at 4:19 AM Alice Ryhl <aliceryhl@google.com> wrote:
> >
> > After being confused by looking at get_cred() and get_cred_rcu(), I
> > figured out what's going on. Thus, add some comments to clarify how
> > get_cred_rcu() works for the benefit of others looking in the future.
> >
> > Note that in principle we could add an assertion that non_rcu is zero in
> > the failure path of atomic_long_inc_not_zero().
> 
> That would be interesting to add a WARN_ON() there and see what
> happens.  Hopefully nothing, but one never knows ;)  Have you tried
> this?

I tried just now. I put it on an Android phone, and it did not seem to
be triggered after a few minute of usage.

I can send a patch adding it if you would like?

> > Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> > ---
> >  include/linux/cred.h | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> 
> ...
> 
> > +/*
> > + * get_cred_rcu - Get a reference on a set of credentials under rcu
> 
> I agree this is a bit pedantic, but it looks like the bulk of the file
> capitalizes RCU and technically that is correct as it is an acronym.

Will do.

> > + * @cred: The credentials to reference
> > + *
> > + * Get a reference on the specified set of credentials, or %NULL if the last
> > + * refcount has already been put.
> > + *
> > + * This is used to obtain a reference under an rcu read lock.
> 
> I would suggest a different description:
> 
> "Get a reference to the specified set of credentials and return a
> pointer to the cred struct, or %NULL if it is not possible to obtain a
> new reference.  After successfully taking a new reference to the
> specified credentials, the cred struct will be marked for free'ing via
> RCU."

I actually think it's confusing to include

	After successfully taking a new reference to the specified
	credentials, the cred struct will be marked for free'ing via
	RCU.

in the documentation, because it makes it sounds like this method has
the _rcu() suffix because it marks the struct for free'ing via RCU. But
that is not the case. After all, get_cred() also marks it for free'ing
via RCU.

It has the _rcu() suffix because - if the cred struct is *already*
marked for free'ing via RCU, then you are allowed to do this:

	rcu_read_lock();
	cred = get_cred_rcu(&foo->my_cred);
	rcu_read_unlock();

even if another thread might put foo->my_cred in parallel with the above
piece of code.

> > + */
> >  static inline const struct cred *get_cred_rcu(const struct cred *cred)
> >  {
> >         struct cred *nonconst_cred = (struct cred *) cred;
> >         if (!cred)
> >                 return NULL;
> >         if (!atomic_long_inc_not_zero(&nonconst_cred->usage))
> >                 return NULL;
> > +       /*
> > +        * If non_rcu is not already zero, then this call to get_cred_rcu() is
> > +        * probably wrong because if 'usage' goes to zero prior to this call,
> > +        * then get_cred_rcu() assumes it is freed with rcu.
> > +        *
> > +        * However, an exception to this is using get_cred_rcu() in cases where
> > +        * get_cred() would have been okay. To support that case, we do not
> > +        * check non_rcu and set it to zero regardless.
> > +        */
> 
> This is surely a matter of perspective, but the above seems a bit
> wordy, and doesn't address what I believe is the important part:
> setting non_rcu to zero means this credential will be freed
> asynchronously via RCU.  Both get_cred_rcu() and get_cred() set
> non_rcu to 0/false ... although get_cred() doesn't do the non-zero
> check before bumping the refcount.

I think that would be a good comment to add to get_cred(), but in the
case of get_cred_rcu(), it really should already be set to zero, because
otherwise

	rcu_read_lock();
	cred = get_cred_rcu(&foo->my_cred);
	rcu_read_unlock();

is illegal.

> I suppose we could consider adding the zero check in the get_cred()
> case, but even if we ignore the KCSAN barrier, it looks like the arch
> support for the inc_not_zero() case isn't nearly as good, likely
> resulting in more code to execute.

I don't think that's necessary. If you use get_cred() in a scenario
where it might be zero, you have a bug.

Alice

^ permalink raw reply

* Re: [PATCH 00/61] vfs: change inode->i_ino from unsigned long to u64
From: Christian Brauner @ 2026-02-27 10:06 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Alexander Viro, Jan Kara, Steven Rostedt, Masami Hiramatsu,
	Mathieu Desnoyers, Dan Williams, Matthew Wilcox, Eric Biggers,
	Theodore Y. Ts'o, Muchun Song, Oscar Salvador,
	David Hildenbrand, David Howells, Paulo Alcantara, Andreas Dilger,
	Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Steve French, Ronnie Sahlberg, Shyam Prasad N, Bharath SM,
	Alexander Aring, Ryusuke Konishi, Viacheslav Dubeyko,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, Marc Dionne, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Ilya Dryomov, Alex Markuze, Jan Harkes, coda, Nicolas Pitre,
	Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller, linux-fsdevel, linux-kernel, linux-trace-kernel,
	nvdimm, fsverity, linux-mm, netfs, linux-ext4, linux-f2fs-devel,
	linux-nfs, linux-cifs, samba-technical, linux-nilfs, v9fs,
	linux-afs, autofs, ceph-devel, codalist, ecryptfs, linux-mtd,
	jfs-discussion, ntfs3, ocfs2-devel, devel, linux-unionfs,
	apparmor, linux-security-module, linux-integrity, selinux,
	amd-gfx, dri-devel, linux-media, linaro-mm-sig, netdev,
	linux-perf-users, linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-0-ccceff366db9@kernel.org>

On Thu, Feb 26, 2026 at 10:55:02AM -0500, Jeff Layton wrote:
> Christian said [1] to "just do it" when I proposed this, so here we are!
> 
> For historical reasons, the inode->i_ino field is an unsigned long,
> which means that it's 32 bits on 32 bit architectures. This has caused a
> number of filesystems to implement hacks to hash a 64-bit identifier
> into a 32-bit field, and deprives us of a universal identifier field for
> an inode.
> 
> This patchset changes the inode->i_ino field from an unsigned long to a
> u64. This shouldn't make any material difference on 64-bit hosts, but
> 32-bit hosts will see struct inode grow by at least 4 bytes. This could
> have effects on slabcache sizes and field alignment.
> 
> The bulk of the changes are to format strings and tracepoints, since the
> kernel itself doesn't care that much about the i_ino field. The first
> patch changes some vfs function arguments, so check that one out
> carefully.
> 
> With this change, we may be able to shrink some inode structures. For
> instance, struct nfs_inode has a fileid field that holds the 64-bit
> inode number. With this set of changes, that field could be eliminated.
> I'd rather leave that sort of cleanups for later just to keep this
> simple.
> 
> Much of this set was generated by LLM, but I attributed it to myself
> since I consider this to be in the "menial tasks" category of LLM usage.
> 
> [1]: https://lore.kernel.org/linux-fsdevel/20260219-portrait-winkt-959070cee42f@brauner/

I'm working under the assumption that we have crossed the threshold and
people send patches they did completely themselves and also patches that
were done with the help of or almost completely by a tool. You have to
defend it one way or the other.

Frankly, as long as you understand what you're doing in general well and
I know that you are a trusted and thorough developer/maintainer I could
not care less if you tell me whether or not you did this all on your
own or with the help of some tool. In my experience, laziness grows with
experience but so does the amount of ideas. 

So attribute it to yourself or attribute it partially to the tool. I
personally don't care.

^ permalink raw reply

* [PATCH v2] cred: delete task_euid()
From: Alice Ryhl @ 2026-02-27 10:33 UTC (permalink / raw)
  To: Paul Moore, Serge Hallyn, Jonathan Corbet, Greg Kroah-Hartman,
	Shuah Khan, Alex Shi, Yanteng Si, Dongliang Mu
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	linux-security-module, linux-doc, linux-kernel, rust-for-linux,
	Jann Horn, Alice Ryhl

task_euid() is a very weird operation. You can see how weird it is by
grepping for task_euid() - binder is its only user. task_euid() obtains
the objective effective UID - it looks at the credentials of the task
for purposes of acting on it as an object, but then accesses the
effective UID (which the credentials.7 man page describes as "[...] used
by the kernel to determine the permissions that the process will have
when accessing shared resources [...]").

Since usage in Binder has now been removed, get rid of the resulting
dead code.

Changes to the zh_CN translation was carried out with the help of
Gemini and Google Translate.

Suggested-by: Jann Horn <jannh@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Depends on these two changes:
https://lore.kernel.org/all/20260212-rust-uid-v1-1-deff4214c766@google.com/   (not picked up)
https://lore.kernel.org/all/20260213-binder-uid-v1-0-7b795ae05523@google.com/ (in char-misc-testing)
---
Changes in v2:
- Update translation as per Alex Shi.
- Pick up Reviewed-by Gary.
- Update commit title to use cred: prefix.
- Link to v1: https://lore.kernel.org/r/20260219-remove-task-euid-v1-1-904060826e07@google.com
---
 Documentation/security/credentials.rst                    |  6 ++----
 Documentation/translations/zh_CN/security/credentials.rst |  4 +---
 include/linux/cred.h                                      |  1 -
 rust/helpers/task.c                                       |  5 -----
 rust/kernel/task.rs                                       | 10 ----------
 5 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/Documentation/security/credentials.rst b/Documentation/security/credentials.rst
index d0191c8b8060..81d3b5737d85 100644
--- a/Documentation/security/credentials.rst
+++ b/Documentation/security/credentials.rst
@@ -393,16 +393,14 @@ the credentials so obtained when they're finished with.
    The result of ``__task_cred()`` should not be passed directly to
    ``get_cred()`` as this may race with ``commit_cred()``.
 
-There are a couple of convenience functions to access bits of another task's
-credentials, hiding the RCU magic from the caller::
+There is a convenience function to access bits of another task's credentials,
+hiding the RCU magic from the caller::
 
 	uid_t task_uid(task)		Task's real UID
-	uid_t task_euid(task)		Task's effective UID
 
 If the caller is holding the RCU read lock at the time anyway, then::
 
 	__task_cred(task)->uid
-	__task_cred(task)->euid
 
 should be used instead.  Similarly, if multiple aspects of a task's credentials
 need to be accessed, RCU read lock should be used, ``__task_cred()`` called,
diff --git a/Documentation/translations/zh_CN/security/credentials.rst b/Documentation/translations/zh_CN/security/credentials.rst
index 88fcd9152ffe..20c8696f8198 100644
--- a/Documentation/translations/zh_CN/security/credentials.rst
+++ b/Documentation/translations/zh_CN/security/credentials.rst
@@ -337,15 +337,13 @@ const指针上操作,因此不需要进行类型转换,但需要临时放弃
    ``__task_cred()`` 的结果不应直接传递给 ``get_cred()`` ,
    因为这可能与 ``commit_cred()`` 发生竞争条件。
 
-还有一些方便的函数可以访问另一个任务凭据的特定部分,将RCU操作对调用方隐藏起来::
+有一个方便的函数可用于访问另一个任务凭据的特定部分,从而对调用方隐藏RCU机制::
 
 	uid_t task_uid(task)		Task's real UID
-	uid_t task_euid(task)		Task's effective UID
 
 如果调用方在此时已经持有RCU读锁,则应使用::
 
 	__task_cred(task)->uid
-	__task_cred(task)->euid
 
 类似地,如果需要访问任务凭据的多个方面,应使用RCU读锁,调用 ``__task_cred()``
 函数,将结果存储在临时指针中,然后从临时指针中调用凭据的各个方面,最后释放锁。
diff --git a/include/linux/cred.h b/include/linux/cred.h
index ed1609d78cd7..b40ec3c72ee6 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -367,7 +367,6 @@ DEFINE_FREE(put_cred, struct cred *, if (!IS_ERR_OR_NULL(_T)) put_cred(_T))
 })
 
 #define task_uid(task)		(task_cred_xxx((task), uid))
-#define task_euid(task)		(task_cred_xxx((task), euid))
 #define task_ucounts(task)	(task_cred_xxx((task), ucounts))
 
 #define current_cred_xxx(xxx)			\
diff --git a/rust/helpers/task.c b/rust/helpers/task.c
index c0e1a06ede78..b46b1433a67e 100644
--- a/rust/helpers/task.c
+++ b/rust/helpers/task.c
@@ -28,11 +28,6 @@ __rust_helper kuid_t rust_helper_task_uid(struct task_struct *task)
 	return task_uid(task);
 }
 
-__rust_helper kuid_t rust_helper_task_euid(struct task_struct *task)
-{
-	return task_euid(task);
-}
-
 #ifndef CONFIG_USER_NS
 __rust_helper uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
 {
diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs
index e07d0ddd76f6..169ff1dde936 100644
--- a/rust/kernel/task.rs
+++ b/rust/kernel/task.rs
@@ -218,16 +218,6 @@ pub fn uid(&self) -> Kuid {
         Kuid::from_raw(unsafe { bindings::task_uid(self.as_ptr()) })
     }
 
-    /// Returns the objective effective UID of the given task.
-    ///
-    /// You should probably not be using this; the effective UID is normally
-    /// only relevant in subjective credentials.
-    #[inline]
-    pub fn euid(&self) -> Kuid {
-        // SAFETY: It's always safe to call `task_euid` on a valid task.
-        Kuid::from_raw(unsafe { bindings::task_euid(self.as_ptr()) })
-    }
-
     /// Determines whether the given task has pending signals.
     #[inline]
     pub fn signal_pending(&self) -> bool {

---
base-commit: 7dff99b354601dd01829e1511711846e04340a69
change-id: 20260219-remove-task-euid-19e4b00beebe
prerequisite-change-id: 20260212-rust-uid-f1b3a45c8084:v1
prerequisite-patch-id: 7ec4933af3a7f4c6bb0403c34a6dd41306836295
prerequisite-change-id: 20260213-binder-uid-a24ede5026a8:v1
prerequisite-patch-id: 7be0128bd8902879bb271d0587ac98bf242cf612
prerequisite-patch-id: 4a9d0f595d2084b3f8982a2d0d8b3df35b9fae0e

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


^ permalink raw reply related

* Re: [PATCH 00/61] vfs: change inode->i_ino from unsigned long to u64
From: Jeff Layton @ 2026-02-27 11:52 UTC (permalink / raw)
  To: Christian König, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes, coda,
	Nicolas Pitre, Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	David Airlie, Simona Vetter, Sumit Semwal, Eric Dumazet,
	Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn, David S. Miller,
	Jakub Kicinski, Simon Horman, Oleg Nesterov, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Darrick J. Wong, Martin Schiller
  Cc: linux-fsdevel, linux-kernel, linux-trace-kernel, nvdimm, fsverity,
	linux-mm, netfs, linux-ext4, linux-f2fs-devel, linux-nfs,
	linux-cifs, samba-technical, linux-nilfs, v9fs, linux-afs, autofs,
	ceph-devel, codalist, ecryptfs, linux-mtd, jfs-discussion, ntfs3,
	ocfs2-devel, devel, linux-unionfs, apparmor,
	linux-security-module, linux-integrity, selinux, amd-gfx,
	dri-devel, linux-media, linaro-mm-sig, netdev, linux-perf-users,
	linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <b4f32cab-2b34-4002-83d1-3ae038a4bb38@amd.com>

On Fri, 2026-02-27 at 10:30 +0100, Christian König wrote:
> On 2/26/26 16:55, Jeff Layton wrote:
> > Christian said [1] to "just do it" when I proposed this, so here we are!
> > 
> > For historical reasons, the inode->i_ino field is an unsigned long,
> > which means that it's 32 bits on 32 bit architectures. This has caused a
> > number of filesystems to implement hacks to hash a 64-bit identifier
> > into a 32-bit field, and deprives us of a universal identifier field for
> > an inode.
> > 
> > This patchset changes the inode->i_ino field from an unsigned long to a
> > u64. This shouldn't make any material difference on 64-bit hosts, but
> > 32-bit hosts will see struct inode grow by at least 4 bytes. This could
> > have effects on slabcache sizes and field alignment.
> > 
> > The bulk of the changes are to format strings and tracepoints, since the
> > kernel itself doesn't care that much about the i_ino field. The first
> > patch changes some vfs function arguments, so check that one out
> > carefully.
> > 
> > With this change, we may be able to shrink some inode structures. For
> > instance, struct nfs_inode has a fileid field that holds the 64-bit
> > inode number. With this set of changes, that field could be eliminated.
> > I'd rather leave that sort of cleanups for later just to keep this
> > simple.
> > 
> > Much of this set was generated by LLM, but I attributed it to myself
> > since I consider this to be in the "menial tasks" category of LLM usage.
> 
> Sounds reasonable to me, should get_next_ino() also be changed to return an 64bit ino?
> 

I'm not opposed to doing that, but I'd probably leave that for a
follow-on cleanup. Just doing the i_ino conversion is already making
for a huge patchset.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply

* Re: [PATCH 50/61] zonefs: update format strings for u64 i_ino
From: Johannes Thumshirn @ 2026-02-27 11:55 UTC (permalink / raw)
  To: Jeff Layton, Alexander Viro, Christian Brauner, Jan Kara,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Dan Williams,
	Matthew Wilcox, Eric Biggers, Theodore Y. Ts'o, Muchun Song,
	Oscar Salvador, David Hildenbrand, David Howells, Paulo Alcantara,
	Andreas Dilger, Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust,
	Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
	Dai Ngo, Tom Talpey, Steve French, Ronnie Sahlberg,
	Shyam Prasad N, Bharath SM, Alexander Aring, Ryusuke Konishi,
	Viacheslav Dubeyko, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	Marc Dionne, Ian Kent, Luis de Bethencourt, Salah Triki,
	Tigran A. Aivazian, Ilya Dryomov, Alex Markuze, Jan Harkes,
	coda@cs.cmu.edu, Nicolas Pitre, Tyler Hicks, Amir Goldstein,
	hch@infradead.org, John Paul Adrian Glaubitz, Yangtao Li,
	Mikulas Patocka, David Woodhouse, Richard Weinberger,
	Dave Kleikamp, Konstantin Komarov, Mark Fasheh, Joel Becker,
	Joseph Qi, Mike Marshall, Martin Brandenburg, Miklos Szeredi,
	Anders Larsen, Zhihao Cheng, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, John Johansen, Paul Moore, James Morris,
	Serge E. Hallyn, Mimi Zohar, Roberto Sassu, Dmitry Kasatkin,
	Eric Snowberg, Fan Wu, Stephen Smalley, Ondrej Mosnacek,
	Casey Schaufler, Alex Deucher, Christian König, David Airlie,
	Simona Vetter, Sumit Semwal, Eric Dumazet, Kuniyuki Iwashima,
	Paolo Abeni, Willem de Bruijn, David S. Miller, Jakub Kicinski,
	Simon Horman, Oleg Nesterov, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Darrick J. Wong, Martin Schiller
  Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org, nvdimm@lists.linux.dev,
	fsverity@lists.linux.dev, linux-mm@kvack.org,
	netfs@lists.linux.dev, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, linux-nfs@vger.kernel.org,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-nilfs@vger.kernel.org, v9fs@lists.linux.dev,
	linux-afs@lists.infradead.org, autofs@vger.kernel.org,
	ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu,
	ecryptfs@vger.kernel.org, linux-mtd@lists.infradead.org,
	jfs-discussion@lists.sourceforge.net, ntfs3@lists.linux.dev,
	ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org,
	linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com,
	linux-security-module@vger.kernel.org,
	linux-integrity@vger.kernel.org, selinux@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
	netdev@vger.kernel.org, linux-perf-users@vger.kernel.org,
	linux-fscrypt@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-hams@vger.kernel.org, linux-x25@vger.kernel.org
In-Reply-To: <20260226-iino-u64-v1-50-ccceff366db9@kernel.org>

Looks good,

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>


^ permalink raw reply

* [PATCH v2] ima: Define and use a digest_size field in the ima_algo_desc structure
From: Roberto Sassu @ 2026-02-27 12:06 UTC (permalink / raw)
  To: zohar, dmitry.kasatkin, eric.snowberg, paul, jmorris, serge
  Cc: linux-integrity, linux-security-module, linux-kernel,
	devnull+dima.arista.com, Roberto Sassu

From: Roberto Sassu <roberto.sassu@huawei.com>

Add the digest_size field to the ima_algo_desc structure to determine the
digest size from the correct source.

If the hash algorithm is among allocated PCR banks, take the value from the
TPM bank info (equal to the value from the crypto subsystem if the TPM
algorithm is supported by it; otherwise, not exceding the size of the
digest buffer in the tpm_digest structure, used by IMA).

If the hash algorithm is SHA1, use the predefined value. Lastly, if the
hash algorithm is the default one but not among the PCR banks, take the
digest size from the crypto subsystem (the default hash algorithm is
checked when parsing the ima_hash= command line option).

Finally, use the new information to correctly show the template digest in
ima_measurements_show() and ima_ascii_measurements_show().

Link: https://github.com/linux-integrity/linux/issues/14
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 security/integrity/ima/ima.h        |  1 +
 security/integrity/ima/ima_crypto.c |  6 ++++++
 security/integrity/ima/ima_fs.c     | 18 ++++++------------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index 89ebe98ffc5e..c38a9eb945b6 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -53,6 +53,7 @@ extern atomic_t ima_setxattr_allowed_hash_algorithms;
 struct ima_algo_desc {
 	struct crypto_shash *tfm;
 	enum hash_algo algo;
+	unsigned int digest_size;
 };
 
 /* set during initialization */
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
index 8ae7821a65c2..c2a859710d20 100644
--- a/security/integrity/ima/ima_crypto.c
+++ b/security/integrity/ima/ima_crypto.c
@@ -109,6 +109,7 @@ static struct crypto_shash *ima_alloc_tfm(enum hash_algo algo)
 
 int __init ima_init_crypto(void)
 {
+	unsigned int digest_size;
 	enum hash_algo algo;
 	long rc;
 	int i;
@@ -147,7 +148,9 @@ int __init ima_init_crypto(void)
 
 	for (i = 0; i < NR_BANKS(ima_tpm_chip); i++) {
 		algo = ima_tpm_chip->allocated_banks[i].crypto_id;
+		digest_size = ima_tpm_chip->allocated_banks[i].digest_size;
 		ima_algo_array[i].algo = algo;
+		ima_algo_array[i].digest_size = digest_size;
 
 		/* unknown TPM algorithm */
 		if (algo == HASH_ALGO__LAST)
@@ -183,12 +186,15 @@ int __init ima_init_crypto(void)
 		}
 
 		ima_algo_array[ima_sha1_idx].algo = HASH_ALGO_SHA1;
+		ima_algo_array[ima_sha1_idx].digest_size = SHA1_DIGEST_SIZE;
 	}
 
 	if (ima_hash_algo_idx >= NR_BANKS(ima_tpm_chip) &&
 	    ima_hash_algo_idx != ima_sha1_idx) {
+		digest_size = hash_digest_size[ima_hash_algo];
 		ima_algo_array[ima_hash_algo_idx].tfm = ima_shash_tfm;
 		ima_algo_array[ima_hash_algo_idx].algo = ima_hash_algo;
+		ima_algo_array[ima_hash_algo_idx].digest_size = digest_size;
 	}
 
 	return 0;
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index 012a58959ff0..23d3a14b8ce3 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -132,16 +132,12 @@ int ima_measurements_show(struct seq_file *m, void *v)
 	char *template_name;
 	u32 pcr, namelen, template_data_len; /* temporary fields */
 	bool is_ima_template = false;
-	enum hash_algo algo;
 	int i, algo_idx;
 
 	algo_idx = ima_sha1_idx;
-	algo = HASH_ALGO_SHA1;
 
-	if (m->file != NULL) {
+	if (m->file != NULL)
 		algo_idx = (unsigned long)file_inode(m->file)->i_private;
-		algo = ima_algo_array[algo_idx].algo;
-	}
 
 	/* get entry */
 	e = qe->entry;
@@ -160,7 +156,8 @@ int ima_measurements_show(struct seq_file *m, void *v)
 	ima_putc(m, &pcr, sizeof(e->pcr));
 
 	/* 2nd: template digest */
-	ima_putc(m, e->digests[algo_idx].digest, hash_digest_size[algo]);
+	ima_putc(m, e->digests[algo_idx].digest,
+		 ima_algo_array[algo_idx].digest_size);
 
 	/* 3rd: template name size */
 	namelen = !ima_canonical_fmt ? strlen(template_name) :
@@ -229,16 +226,12 @@ static int ima_ascii_measurements_show(struct seq_file *m, void *v)
 	struct ima_queue_entry *qe = v;
 	struct ima_template_entry *e;
 	char *template_name;
-	enum hash_algo algo;
 	int i, algo_idx;
 
 	algo_idx = ima_sha1_idx;
-	algo = HASH_ALGO_SHA1;
 
-	if (m->file != NULL) {
+	if (m->file != NULL)
 		algo_idx = (unsigned long)file_inode(m->file)->i_private;
-		algo = ima_algo_array[algo_idx].algo;
-	}
 
 	/* get entry */
 	e = qe->entry;
@@ -252,7 +245,8 @@ static int ima_ascii_measurements_show(struct seq_file *m, void *v)
 	seq_printf(m, "%2d ", e->pcr);
 
 	/* 2nd: template hash */
-	ima_print_digest(m, e->digests[algo_idx].digest, hash_digest_size[algo]);
+	ima_print_digest(m, e->digests[algo_idx].digest,
+			 ima_algo_array[algo_idx].digest_size);
 
 	/* 3th:  template name */
 	seq_printf(m, " %s", template_name);
-- 
2.43.0


^ permalink raw reply related

* Re: [PATCH 51/61] security: update audit format strings for u64 i_ino
From: Ryan Lee @ 2026-02-27 16:46 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Dan Williams, Matthew Wilcox,
	Eric Biggers, Theodore Y. Ts'o, Muchun Song, Oscar Salvador,
	David Hildenbrand, David Howells, Paulo Alcantara, Andreas Dilger,
	Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Steve French, Ronnie Sahlberg, Shyam Prasad N, Bharath SM,
	Alexander Aring, Ryusuke Konishi, Viacheslav Dubeyko,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, Marc Dionne, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Ilya Dryomov, Alex Markuze, Jan Harkes, coda, Nicolas Pitre,
	Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller, linux-fsdevel, linux-kernel, linux-trace-kernel,
	nvdimm, fsverity, linux-mm, netfs, linux-ext4, linux-f2fs-devel,
	linux-nfs, linux-cifs, samba-technical, linux-nilfs, v9fs,
	linux-afs, autofs, ceph-devel, codalist, ecryptfs, linux-mtd,
	jfs-discussion, ntfs3, ocfs2-devel, devel, linux-unionfs,
	apparmor, linux-security-module, linux-integrity, selinux,
	amd-gfx, dri-devel, linux-media, linaro-mm-sig, netdev,
	linux-perf-users, linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226-iino-u64-v1-51-ccceff366db9@kernel.org>

On Thu, Feb 26, 2026 at 9:13 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> Update %lu/%ld to %llu/%lld in security audit logging functions that
> print inode->i_ino, since i_ino is now u64.
>
> Files updated: apparmor/apparmorfs.c, integrity/integrity_audit.c,
> ipe/audit.c, lsm_audit.c.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  security/apparmor/apparmorfs.c       |  4 ++--
>  security/integrity/integrity_audit.c |  2 +-
>  security/ipe/audit.c                 |  2 +-
>  security/lsm_audit.c                 | 10 +++++-----
>  security/selinux/hooks.c             |  4 ++--
>  security/smack/smack_lsm.c           | 12 ++++++------
>  6 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 2f84bd23edb69e7e69cb097e554091df0132816d..7b645f40e71c956f216fa6a7d69c3ecd4e2a5ff4 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -149,7 +149,7 @@ static int aafs_count;
>
>  static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
>  {
> -       seq_printf(seq, "%s:[%lu]", AAFS_NAME, d_inode(dentry)->i_ino);
> +       seq_printf(seq, "%s:[%llu]", AAFS_NAME, d_inode(dentry)->i_ino);
>         return 0;
>  }
>
> @@ -2644,7 +2644,7 @@ static int policy_readlink(struct dentry *dentry, char __user *buffer,
>         char name[32];

I have confirmed that the buffer is still big enough for a 64-bit inode number.

>         int res;
>
> -       res = snprintf(name, sizeof(name), "%s:[%lu]", AAFS_NAME,
> +       res = snprintf(name, sizeof(name), "%s:[%llu]", AAFS_NAME,
>                        d_inode(dentry)->i_ino);
>         if (res > 0 && res < sizeof(name))
>                 res = readlink_copy(buffer, buflen, name, strlen(name));

For the AppArmor portion:

Reviewed-By: Ryan Lee <ryan.lee@canonical.com>

> diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c
> index 0ec5e4c22cb2a1066c2b897776ead6d3db72635c..d8d9e5ff1cd22b091f462d1e83d28d2d6bd983e9 100644
> --- a/security/integrity/integrity_audit.c
> +++ b/security/integrity/integrity_audit.c
> @@ -62,7 +62,7 @@ void integrity_audit_message(int audit_msgno, struct inode *inode,
>         if (inode) {
>                 audit_log_format(ab, " dev=");
>                 audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -               audit_log_format(ab, " ino=%lu", inode->i_ino);
> +               audit_log_format(ab, " ino=%llu", inode->i_ino);
>         }
>         audit_log_format(ab, " res=%d errno=%d", !result, errno);
>         audit_log_end(ab);
> diff --git a/security/ipe/audit.c b/security/ipe/audit.c
> index 3f0deeb54912730d9acf5e021a4a0cb29a34e982..93fb59fbddd60b56c0b22be2a38b809ef9e18b76 100644
> --- a/security/ipe/audit.c
> +++ b/security/ipe/audit.c
> @@ -153,7 +153,7 @@ void ipe_audit_match(const struct ipe_eval_ctx *const ctx,
>                 if (inode) {
>                         audit_log_format(ab, " dev=");
>                         audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -                       audit_log_format(ab, " ino=%lu", inode->i_ino);
> +                       audit_log_format(ab, " ino=%llu", inode->i_ino);
>                 } else {
>                         audit_log_format(ab, " dev=? ino=?");
>                 }
> diff --git a/security/lsm_audit.c b/security/lsm_audit.c
> index 7d623b00495c14b079e10e963c21a9f949c11f07..737f5a263a8f79416133315edf363ece3d79c722 100644
> --- a/security/lsm_audit.c
> +++ b/security/lsm_audit.c
> @@ -202,7 +202,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
>                 if (inode) {
>                         audit_log_format(ab, " dev=");
>                         audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -                       audit_log_format(ab, " ino=%lu", inode->i_ino);
> +                       audit_log_format(ab, " ino=%llu", inode->i_ino);
>                 }
>                 break;
>         }
> @@ -215,7 +215,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
>                 if (inode) {
>                         audit_log_format(ab, " dev=");
>                         audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -                       audit_log_format(ab, " ino=%lu", inode->i_ino);
> +                       audit_log_format(ab, " ino=%llu", inode->i_ino);
>                 }
>                 break;
>         }
> @@ -228,7 +228,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
>                 if (inode) {
>                         audit_log_format(ab, " dev=");
>                         audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -                       audit_log_format(ab, " ino=%lu", inode->i_ino);
> +                       audit_log_format(ab, " ino=%llu", inode->i_ino);
>                 }
>
>                 audit_log_format(ab, " ioctlcmd=0x%hx", a->u.op->cmd);
> @@ -246,7 +246,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
>                 if (inode) {
>                         audit_log_format(ab, " dev=");
>                         audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -                       audit_log_format(ab, " ino=%lu", inode->i_ino);
> +                       audit_log_format(ab, " ino=%llu", inode->i_ino);
>                 }
>                 break;
>         }
> @@ -265,7 +265,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
>                 }
>                 audit_log_format(ab, " dev=");
>                 audit_log_untrustedstring(ab, inode->i_sb->s_id);
> -               audit_log_format(ab, " ino=%lu", inode->i_ino);
> +               audit_log_format(ab, " ino=%llu", inode->i_ino);
>                 rcu_read_unlock();
>                 break;
>         }
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index d8224ea113d1ac273aac1fb52324f00b3301ae75..150ea86ebc1f7c7f8391af4109a3da82b12d00d2 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -1400,7 +1400,7 @@ static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry,
>         if (rc < 0) {
>                 kfree(context);
>                 if (rc != -ENODATA) {
> -                       pr_warn("SELinux: %s:  getxattr returned %d for dev=%s ino=%ld\n",
> +                       pr_warn("SELinux: %s:  getxattr returned %d for dev=%s ino=%lld\n",
>                                 __func__, -rc, inode->i_sb->s_id, inode->i_ino);
>                         return rc;
>                 }
> @@ -3477,7 +3477,7 @@ static void selinux_inode_post_setxattr(struct dentry *dentry, const char *name,
>                                            &newsid);
>         if (rc) {
>                 pr_err("SELinux:  unable to map context to SID"
> -                      "for (%s, %lu), rc=%d\n",
> +                      "for (%s, %llu), rc=%d\n",
>                        inode->i_sb->s_id, inode->i_ino, -rc);
>                 return;
>         }
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 98af9d7b943469d0ddd344fc78c0b87ca40c16c4..7e2f54c17a5d5c70740bbfa92ba4d4f1aca2cf22 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -182,7 +182,7 @@ static int smk_bu_inode(struct inode *inode, int mode, int rc)
>         char acc[SMK_NUM_ACCESS_TYPE + 1];
>
>         if (isp->smk_flags & SMK_INODE_IMPURE)
> -               pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n",
> +               pr_info("Smack Unconfined Corruption: inode=(%s %lld) %s\n",
>                         inode->i_sb->s_id, inode->i_ino, current->comm);
>
>         if (rc <= 0)
> @@ -195,7 +195,7 @@ static int smk_bu_inode(struct inode *inode, int mode, int rc)
>
>         smk_bu_mode(mode, acc);
>
> -       pr_info("Smack %s: (%s %s %s) inode=(%s %ld) %s\n", smk_bu_mess[rc],
> +       pr_info("Smack %s: (%s %s %s) inode=(%s %lld) %s\n", smk_bu_mess[rc],
>                 tsp->smk_task->smk_known, isp->smk_inode->smk_known, acc,
>                 inode->i_sb->s_id, inode->i_ino, current->comm);
>         return 0;
> @@ -214,7 +214,7 @@ static int smk_bu_file(struct file *file, int mode, int rc)
>         char acc[SMK_NUM_ACCESS_TYPE + 1];
>
>         if (isp->smk_flags & SMK_INODE_IMPURE)
> -               pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n",
> +               pr_info("Smack Unconfined Corruption: inode=(%s %lld) %s\n",
>                         inode->i_sb->s_id, inode->i_ino, current->comm);
>
>         if (rc <= 0)
> @@ -223,7 +223,7 @@ static int smk_bu_file(struct file *file, int mode, int rc)
>                 rc = 0;
>
>         smk_bu_mode(mode, acc);
> -       pr_info("Smack %s: (%s %s %s) file=(%s %ld %pD) %s\n", smk_bu_mess[rc],
> +       pr_info("Smack %s: (%s %s %s) file=(%s %lld %pD) %s\n", smk_bu_mess[rc],
>                 sskp->smk_known, smk_of_inode(inode)->smk_known, acc,
>                 inode->i_sb->s_id, inode->i_ino, file,
>                 current->comm);
> @@ -244,7 +244,7 @@ static int smk_bu_credfile(const struct cred *cred, struct file *file,
>         char acc[SMK_NUM_ACCESS_TYPE + 1];
>
>         if (isp->smk_flags & SMK_INODE_IMPURE)
> -               pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n",
> +               pr_info("Smack Unconfined Corruption: inode=(%s %lld) %s\n",
>                         inode->i_sb->s_id, inode->i_ino, current->comm);
>
>         if (rc <= 0)
> @@ -253,7 +253,7 @@ static int smk_bu_credfile(const struct cred *cred, struct file *file,
>                 rc = 0;
>
>         smk_bu_mode(mode, acc);
> -       pr_info("Smack %s: (%s %s %s) file=(%s %ld %pD) %s\n", smk_bu_mess[rc],
> +       pr_info("Smack %s: (%s %s %s) file=(%s %lld %pD) %s\n", smk_bu_mess[rc],
>                 sskp->smk_known, smk_of_inode(inode)->smk_known, acc,
>                 inode->i_sb->s_id, inode->i_ino, file,
>                 current->comm);
>
> --
> 2.53.0
>
>

^ permalink raw reply

* Re: [PATCH 00/61] vfs: change inode->i_ino from unsigned long to u64
From: Jeff Layton @ 2026-02-27 17:19 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Dan Williams, Eric Biggers,
	Theodore Y. Ts'o, Muchun Song, Oscar Salvador,
	David Hildenbrand, David Howells, Paulo Alcantara, Andreas Dilger,
	Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Steve French, Ronnie Sahlberg, Shyam Prasad N, Bharath SM,
	Alexander Aring, Ryusuke Konishi, Viacheslav Dubeyko,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, Marc Dionne, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Ilya Dryomov, Alex Markuze, Jan Harkes, coda, Nicolas Pitre,
	Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller, linux-fsdevel, linux-kernel, linux-trace-kernel,
	nvdimm, fsverity, linux-mm, netfs, linux-ext4, linux-f2fs-devel,
	linux-nfs, linux-cifs, samba-technical, linux-nilfs, v9fs,
	linux-afs, autofs, ceph-devel, codalist, ecryptfs, linux-mtd,
	jfs-discussion, ntfs3, ocfs2-devel, devel, linux-unionfs,
	apparmor, linux-security-module, linux-integrity, selinux,
	amd-gfx, dri-devel, linux-media, linaro-mm-sig, netdev,
	linux-perf-users, linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <aaB5lgKd8FOIizPg@casper.infradead.org>

On Thu, 2026-02-26 at 16:49 +0000, Matthew Wilcox wrote:
> On Thu, Feb 26, 2026 at 10:55:02AM -0500, Jeff Layton wrote:
> > The bulk of the changes are to format strings and tracepoints, since the
> > kernel itself doesn't care that much about the i_ino field. The first
> > patch changes some vfs function arguments, so check that one out
> > carefully.
> 
> Why are the format strings all done as separate patches?  Don't we get
> bisection hazards by splitting it apart this way?

Circling back to this...

I have a v2 series (~107 patches) that I'm testing now that does this
more bisectably with the typedef and macro scaffolding that Mathieu
suggested. I'll probably send it early next week.

I had done it this way originally since I figured it was best to break
this up by subsystem. Should I continue with this series as a set of
patches broken up this way, or is it preferable to combine the pile of
format changes into fewer patches?
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply

* Re: [PATCH 1/2] ima: efi: Drop unnecessary check for CONFIG_MODULE_SIG/CONFIG_KEXEC_SIG
From: Mimi Zohar @ 2026-02-27 18:21 UTC (permalink / raw)
  To: Thomas Weißschuh, Roberto Sassu, Dmitry Kasatkin,
	Eric Snowberg, Paul Moore, James Morris, Serge E. Hallyn,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP)
  Cc: linux-integrity, linux-security-module, linux-kernel,
	linuxppc-dev, Aaron Tomlin, Nicolas Schier
In-Reply-To: <20260226-ima-ifdef-v1-1-8b9613edbbdb@weissschuh.net>

On Thu, 2026-02-26 at 08:20 +0100, Thomas Weißschuh wrote:
> When configuration settings are disabled the guarded functions are
> defined as empty stubs, so the check is unnecessary.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
> Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
> Reviewed-by: Nicolas Schier <nsc@kernel.org>
> ---
>  security/integrity/ima/ima_efi.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_efi.c b/security/integrity/ima/ima_efi.c
> index 138029bfcce1..a35dd166ad47 100644
> --- a/security/integrity/ima/ima_efi.c
> +++ b/security/integrity/ima/ima_efi.c
> @@ -68,10 +68,8 @@ static const char * const sb_arch_rules[] = {
>  const char * const *arch_get_ima_policy(void)
>  {
>  	if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot()) {
> -		if (IS_ENABLED(CONFIG_MODULE_SIG))
> -			set_module_sig_enforced();
> -		if (IS_ENABLED(CONFIG_KEXEC_SIG))
> -			set_kexec_sig_enforced();
> +		set_module_sig_enforced();
> +		set_kexec_sig_enforced();
>  		return sb_arch_rules;
>  	}
>  	return NULL;

Thanks, Thomas.

With commit 63e8a44395a4 ("integrity: Make arch_ima_get_secureboot integrity-
wide"), there was a merge conflict.  After fixing the merge conflict, your
patches are now queued in next-integrity.

Mimi

^ permalink raw reply

* Re: [PATCH v5] ima_fs: Avoid creating measurement lists for unsupported hash algos
From: Mimi Zohar @ 2026-02-27 18:46 UTC (permalink / raw)
  To: Roberto Sassu, dima, Roberto Sassu, Dmitry Kasatkin,
	Eric Snowberg, Paul Moore, James Morris, Serge E. Hallyn,
	Silvia Sisinni, Enrico Bravi
  Cc: Jonathan McDowell, linux-integrity, linux-security-module,
	linux-kernel, stable, Dmitry Safonov
In-Reply-To: <0fde824faace320c6d3ef6137bf50cee0289c6c0.camel@huaweicloud.com>


> > > @@ -404,16 +398,24 @@ static int __init create_securityfs_measurement_lists(void)
> > >  		char file_name[NAME_MAX + 1];
> > >  		struct dentry *dentry;
> > >  
> > > -		sprintf(file_name, "ascii_runtime_measurements_%s",
> > > -			hash_algo_name[algo]);
> > > +		if (algo == HASH_ALGO__LAST)
> > > +			sprintf(file_name, "ascii_runtime_measurements_tpm_alg_%x",
> > > +				ima_tpm_chip->allocated_banks[i].alg_id);
> > > +		else
> > > +			sprintf(file_name, "ascii_runtime_measurements_%s",
> > > +				hash_algo_name[algo]);
> > >  		dentry = securityfs_create_file(file_name, S_IRUSR | S_IRGRP,
> > >  						ima_dir, (void *)(uintptr_t)i,
> > >  						&ima_ascii_measurements_ops);
> > >  		if (IS_ERR(dentry))
> > >  			return PTR_ERR(dentry);
> > >  
> > > -		sprintf(file_name, "binary_runtime_measurements_%s",
> > > -			hash_algo_name[algo]);
> > > +		if (algo == HASH_ALGO__LAST)
> > > +			sprintf(file_name, "binary_runtime_measurements_tpm_alg_%x",
> > > +				ima_tpm_chip->allocated_banks[i].alg_id);
> > 
> > There's no point in creating either of the securityfs files if the kernel
> > doesn't support the hash algorithm.
> 
> It is not useful per se, but since it is an information that it is
> produced and maintained by IMA, we can print it. And second, it will
> expose the fact that there is an unsupported algorithm (in the case of
> SHA3-256, the fix is add to the TPM - crypto subsystem mapping in tpm2-
> cmd.c).

Yes, agreed.

Dmitry, the Subject line implies the measurement lists aren't being created, yet
you're actually creating them.  Please update the patch description before re-
posting.

thanks,

Mimi

^ permalink raw reply

* Re: [PATCH 00/61] vfs: change inode->i_ino from unsigned long to u64
From: Mathieu Desnoyers @ 2026-02-27 19:01 UTC (permalink / raw)
  To: Jeff Layton, Matthew Wilcox
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Steven Rostedt,
	Masami Hiramatsu, Dan Williams, Eric Biggers,
	Theodore Y. Ts'o, Muchun Song, Oscar Salvador,
	David Hildenbrand, David Howells, Paulo Alcantara, Andreas Dilger,
	Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Steve French, Ronnie Sahlberg, Shyam Prasad N, Bharath SM,
	Alexander Aring, Ryusuke Konishi, Viacheslav Dubeyko,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, Marc Dionne, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Ilya Dryomov, Alex Markuze, Jan Harkes, coda, Nicolas Pitre,
	Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller, linux-fsdevel, linux-kernel, linux-trace-kernel,
	nvdimm, fsverity, linux-mm, netfs, linux-ext4, linux-f2fs-devel,
	linux-nfs, linux-cifs, samba-technical, linux-nilfs, v9fs,
	linux-afs, autofs, ceph-devel, codalist, ecryptfs, linux-mtd,
	jfs-discussion, ntfs3, ocfs2-devel, devel, linux-unionfs,
	apparmor, linux-security-module, linux-integrity, selinux,
	amd-gfx, dri-devel, linux-media, linaro-mm-sig, netdev,
	linux-perf-users, linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <4a462d40899698586c110add96ce3fab6ddac30b.camel@kernel.org>

On 2026-02-27 12:19, Jeff Layton wrote:
> On Thu, 2026-02-26 at 16:49 +0000, Matthew Wilcox wrote:
>> On Thu, Feb 26, 2026 at 10:55:02AM -0500, Jeff Layton wrote:
>>> The bulk of the changes are to format strings and tracepoints, since the
>>> kernel itself doesn't care that much about the i_ino field. The first
>>> patch changes some vfs function arguments, so check that one out
>>> carefully.
>>
>> Why are the format strings all done as separate patches?  Don't we get
>> bisection hazards by splitting it apart this way?
> 
> Circling back to this...
> 
> I have a v2 series (~107 patches) that I'm testing now that does this
> more bisectably with the typedef and macro scaffolding that Mathieu
> suggested. I'll probably send it early next week.
> 
> I had done it this way originally since I figured it was best to break
> this up by subsystem. Should I continue with this series as a set of
> patches broken up this way, or is it preferable to combine the pile of
> format changes into fewer patches?

Here is the approach I would recommend to maximize signal over noise
for the follow up email thread discussions:

Now that your series is bisectable, you could post a [RFC PATCH v2]
series with the following:

- Patch 00 introduces the series, points to your git branch implementing
   the whole series,
- The first few patches introduce the new type (kino_t) and macro to
   do the format string transition. Initially kino_t would typedef to
   unsigned long (no changes).
- Followed by patches implementing the type + format string changes for
   a few key subsystems.
- The final patch would change kino_t and the format string macro to
   64-bit integers.

Once everyone agree on those core changes, you could proceed to post
patches that change additional subsystems in a subsequent round.

One more comment: have you tried using Coccinelle to do this kind of
semantic code change ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

^ permalink raw reply

* Re: [PATCH 00/61] vfs: change inode->i_ino from unsigned long to u64
From: Jeff Layton @ 2026-02-27 19:35 UTC (permalink / raw)
  To: Mathieu Desnoyers, Matthew Wilcox
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Steven Rostedt,
	Masami Hiramatsu, Dan Williams, Eric Biggers,
	Theodore Y. Ts'o, Muchun Song, Oscar Salvador,
	David Hildenbrand, David Howells, Paulo Alcantara, Andreas Dilger,
	Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Steve French, Ronnie Sahlberg, Shyam Prasad N, Bharath SM,
	Alexander Aring, Ryusuke Konishi, Viacheslav Dubeyko,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, Marc Dionne, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Ilya Dryomov, Alex Markuze, Jan Harkes, coda, Nicolas Pitre,
	Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller, linux-fsdevel, linux-kernel, linux-trace-kernel,
	nvdimm, fsverity, linux-mm, netfs, linux-ext4, linux-f2fs-devel,
	linux-nfs, linux-cifs, samba-technical, linux-nilfs, v9fs,
	linux-afs, autofs, ceph-devel, codalist, ecryptfs, linux-mtd,
	jfs-discussion, ntfs3, ocfs2-devel, devel, linux-unionfs,
	apparmor, linux-security-module, linux-integrity, selinux,
	amd-gfx, dri-devel, linux-media, linaro-mm-sig, netdev,
	linux-perf-users, linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <b808e186-3eeb-46ed-9826-b0ae6cdcdb8b@efficios.com>

On Fri, 2026-02-27 at 14:01 -0500, Mathieu Desnoyers wrote:
> On 2026-02-27 12:19, Jeff Layton wrote:
> > On Thu, 2026-02-26 at 16:49 +0000, Matthew Wilcox wrote:
> > > On Thu, Feb 26, 2026 at 10:55:02AM -0500, Jeff Layton wrote:
> > > > The bulk of the changes are to format strings and tracepoints, since the
> > > > kernel itself doesn't care that much about the i_ino field. The first
> > > > patch changes some vfs function arguments, so check that one out
> > > > carefully.
> > > 
> > > Why are the format strings all done as separate patches?  Don't we get
> > > bisection hazards by splitting it apart this way?
> > 
> > Circling back to this...
> > 
> > I have a v2 series (~107 patches) that I'm testing now that does this
> > more bisectably with the typedef and macro scaffolding that Mathieu
> > suggested. I'll probably send it early next week.
> > 
> > I had done it this way originally since I figured it was best to break
> > this up by subsystem. Should I continue with this series as a set of
> > patches broken up this way, or is it preferable to combine the pile of
> > format changes into fewer patches?
> 
> Here is the approach I would recommend to maximize signal over noise
> for the follow up email thread discussions:
> 
> Now that your series is bisectable, you could post a [RFC PATCH v2]
> series with the following:
> 
> - Patch 00 introduces the series, points to your git branch implementing
>    the whole series,
> - The first few patches introduce the new type (kino_t) and macro to
>    do the format string transition. Initially kino_t would typedef to
>    unsigned long (no changes).
> - Followed by patches implementing the type + format string changes for
>    a few key subsystems.
> - The final patch would change kino_t and the format string macro to
>    64-bit integers.
> 

That's pretty much the approach the set I have takes. The current set
is here:

    https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/log/?h=iino-u64

My question was more about whether I should batch some of the changes
together. My inclination is that doing it in small, incremental patches
is a good thing, but I figured I'd ask before I spam everyone with a
100+ patch series.

> Once everyone agree on those core changes, you could proceed to post
> patches that change additional subsystems in a subsequent round.
> 
> One more comment: have you tried using Coccinelle to do this kind of
> semantic code change ?

I've use coccinelle before for this sort of change, but my skills with
it are pretty primitive. The problem I saw with using it here is that
the main set of changes involved format strings, and that didn't look
straightforward to do with coccinelle. The LLM seems to have sorted it
out with no trouble though.

On a related note, has anyone has taught an LLM how to use Coccinelle.
I wonder if it might give it a better tool for its toolbox, since
Claude at least seems to mostly use bash, perl or python to make
changes across the tree.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply

* Re: [PATCH] cred: clarify usage of get_cred_rcu()
From: Paul Moore @ 2026-02-27 20:49 UTC (permalink / raw)
  To: Alice Ryhl; +Cc: Serge Hallyn, linux-security-module, linux-kernel
In-Reply-To: <aaFsRbMZl2OIlSCg@google.com>

On Fri, Feb 27, 2026 at 5:04 AM Alice Ryhl <aliceryhl@google.com> wrote:
> On Thu, Feb 26, 2026 at 09:18:29PM -0500, Paul Moore wrote:
> > On Fri, Feb 20, 2026 at 4:19 AM Alice Ryhl <aliceryhl@google.com> wrote:
> > >
> > > After being confused by looking at get_cred() and get_cred_rcu(), I
> > > figured out what's going on. Thus, add some comments to clarify how
> > > get_cred_rcu() works for the benefit of others looking in the future.
> > >
> > > Note that in principle we could add an assertion that non_rcu is zero in
> > > the failure path of atomic_long_inc_not_zero().
> >
> > That would be interesting to add a WARN_ON() there and see what
> > happens.  Hopefully nothing, but one never knows ;)  Have you tried
> > this?
>
> I tried just now. I put it on an Android phone, and it did not seem to
> be triggered after a few minute of usage.
>
> I can send a patch adding it if you would like?

It would need much more testing than running it on Android for a few
minutes before I would consider merging it :)  I suspect it's probably
not worth the effort, I just thought it would be mildly interesting to
see if anything tripped the assertion.

> > > Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> > > ---
> > >  include/linux/cred.h | 18 ++++++++++++++++++
> > >  1 file changed, 18 insertions(+)
> >
> > ...
> >
> > > +/*
> > > + * get_cred_rcu - Get a reference on a set of credentials under rcu
> >
> > I agree this is a bit pedantic, but it looks like the bulk of the file
> > capitalizes RCU and technically that is correct as it is an acronym.
>
> Will do.
>
> > > + * @cred: The credentials to reference
> > > + *
> > > + * Get a reference on the specified set of credentials, or %NULL if the last
> > > + * refcount has already been put.
> > > + *
> > > + * This is used to obtain a reference under an rcu read lock.
> >
> > I would suggest a different description:
> >
> > "Get a reference to the specified set of credentials and return a
> > pointer to the cred struct, or %NULL if it is not possible to obtain a
> > new reference.  After successfully taking a new reference to the
> > specified credentials, the cred struct will be marked for free'ing via
> > RCU."
>
> I actually think it's confusing to include
>
>         After successfully taking a new reference to the specified
>         credentials, the cred struct will be marked for free'ing via
>         RCU.
>
> in the documentation, because it makes it sounds like this method has
> the _rcu() suffix because it marks the struct for free'ing via RCU. But
> that is not the case. After all, get_cred() also marks it for free'ing
> via RCU.
>
> It has the _rcu() suffix because - if the cred struct is *already*
> marked for free'ing via RCU, then you are allowed to do this:
>
>         rcu_read_lock();
>         cred = get_cred_rcu(&foo->my_cred);
>         rcu_read_unlock();
>
> even if another thread might put foo->my_cred in parallel with the above
> piece of code.

To be really nit picky, the code doesn't actually enforce these usage
guidelines, so both are "allowed" in that sense.  The key difference
is that the rcu variant checks if the refcount is zero (the cred has
had its last ref dropped, but has not yet been free'd via rcu),
whereas the non-rcu variant always assumes the refcount is greater
than zero.

If you want to add a description/comment to the functions, I'd focus on that.

> > I suppose we could consider adding the zero check in the get_cred()
> > case, but even if we ignore the KCSAN barrier, it looks like the arch
> > support for the inc_not_zero() case isn't nearly as good, likely
> > resulting in more code to execute.
>
> I don't think that's necessary ...

I didn't say it was, in fact I was trying to dissuade anyone from
trying that because it will likely negatively impact performance for
minimal, if any, benefit.

-- 
paul-moore.com

^ permalink raw reply

* Re: [PATCH 03/61] trace: update VFS-layer trace events for u64 i_ino
From: Jeff Layton @ 2026-02-27 21:05 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Masami Hiramatsu,
	Mathieu Desnoyers, Dan Williams, Matthew Wilcox, Eric Biggers,
	Theodore Y. Ts'o, Muchun Song, Oscar Salvador,
	David Hildenbrand, David Howells, Paulo Alcantara, Andreas Dilger,
	Jan Kara, Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Steve French, Ronnie Sahlberg, Shyam Prasad N, Bharath SM,
	Alexander Aring, Ryusuke Konishi, Viacheslav Dubeyko,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, Marc Dionne, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Ilya Dryomov, Alex Markuze, Jan Harkes, coda, Nicolas Pitre,
	Tyler Hicks, Amir Goldstein, Christoph Hellwig,
	John Paul Adrian Glaubitz, Yangtao Li, Mikulas Patocka,
	David Woodhouse, Richard Weinberger, Dave Kleikamp,
	Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
	Mike Marshall, Martin Brandenburg, Miklos Szeredi, Anders Larsen,
	Zhihao Cheng, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Fan Wu,
	Stephen Smalley, Ondrej Mosnacek, Casey Schaufler, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Sumit Semwal,
	Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
	David S. Miller, Jakub Kicinski, Simon Horman, Oleg Nesterov,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Darrick J. Wong,
	Martin Schiller, linux-fsdevel, linux-kernel, linux-trace-kernel,
	nvdimm, fsverity, linux-mm, netfs, linux-ext4, linux-f2fs-devel,
	linux-nfs, linux-cifs, samba-technical, linux-nilfs, v9fs,
	linux-afs, autofs, ceph-devel, codalist, ecryptfs, linux-mtd,
	jfs-discussion, ntfs3, ocfs2-devel, devel, linux-unionfs,
	apparmor, linux-security-module, linux-integrity, selinux,
	amd-gfx, dri-devel, linux-media, linaro-mm-sig, netdev,
	linux-perf-users, linux-fscrypt, linux-xfs, linux-hams, linux-x25
In-Reply-To: <20260226124842.5593ed85@gandalf.local.home>

On Thu, 2026-02-26 at 12:48 -0500, Steven Rostedt wrote:
> On Thu, 26 Feb 2026 10:55:05 -0500
> Jeff Layton <jlayton@kernel.org> wrote:
> 
> > Update trace event definitions in VFS-layer trace headers to use u64
> > instead of ino_t/unsigned long for inode number fields, and change
> > format strings from %lu/%lx to %llu/%llx to match.
> > 
> > This is needed because i_ino is now u64. Changing trace event field
> > types changes the binary trace format, but the self-describing format
> > metadata handles this transparently for modern trace-cmd and perf.
> > 
> > Files updated:
> >   - cachefiles.h, filelock.h, filemap.h, fs_dax.h, fsverity.h,
> >     hugetlbfs.h, netfs.h, readahead.h, timestamp.h, writeback.h
> > 
> 
> Hmm, on 32 bit systems, this will likely cause "holes" in a lot of these
> events.
> 
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> >  include/trace/events/cachefiles.h |  18 ++---
> >  include/trace/events/filelock.h   |  16 ++---
> >  include/trace/events/filemap.h    |  20 +++---
> >  include/trace/events/fs_dax.h     |  20 +++---
> >  include/trace/events/fsverity.h   |  30 ++++----
> >  include/trace/events/hugetlbfs.h  |  28 ++++----
> >  include/trace/events/netfs.h      |   4 +-
> >  include/trace/events/readahead.h  |  12 ++--
> >  include/trace/events/timestamp.h  |  12 ++--
> >  include/trace/events/writeback.h  | 148 +++++++++++++++++++-------------------
> >  10 files changed, 154 insertions(+), 154 deletions(-)
> > 
> > diff --git a/include/trace/events/cachefiles.h b/include/trace/events/cachefiles.h
> > index a743b2a35ea7001447b3e05d41539cb88013bc7f..f967027711ee823f224abc1b8ab03f63da06ae6f 100644
> > --- a/include/trace/events/cachefiles.h
> > +++ b/include/trace/events/cachefiles.h
> > @@ -251,8 +251,8 @@ TRACE_EVENT(cachefiles_lookup,
> >  	    TP_STRUCT__entry(
> >  		    __field(unsigned int,		obj)
> >  		    __field(short,			error)
> 
> There was already a 2 byte hole here, but that's not a big deal.
> 
> > -		    __field(unsigned long,		dino)
> > -		    __field(unsigned long,		ino)
> > +		    __field(u64,			dino)
> > +		    __field(u64,			ino)
> >  			     ),
> >  
> >  	    TP_fast_assign(
> > @@ -263,7 +263,7 @@ TRACE_EVENT(cachefiles_lookup,
> >  		    __entry->error	= IS_ERR(de) ? PTR_ERR(de) : 0;
> >  			   ),
> >  
> > -	    TP_printk("o=%08x dB=%lx B=%lx e=%d",
> > +	    TP_printk("o=%08x dB=%llx B=%llx e=%d",
> >  		      __entry->obj, __entry->dino, __entry->ino, __entry->error)
> >  	    );
> >  
> > @@ -579,7 +579,7 @@ TRACE_EVENT(cachefiles_mark_active,
> >  	    /* Note that obj may be NULL */
> >  	    TP_STRUCT__entry(
> >  		    __field(unsigned int,		obj)
> > -		    __field(ino_t,			inode)
> > +		    __field(u64,			inode)
> 
> Might be better to reorder any of these that have int first.
> 
> 		u64	inode;
> 		int	obj;
> 
> Will be packed tighter than:
> 
> 		int	obj
> 		u64	inode;
> 
> Probably should have changed that before anyway.
> 

Ok, I'll look at that. Given the number of places that need it though I
may do it in a separate patch.

> >  			     ),
> >  
> >  	    TP_fast_assign(
> > @@ -587,7 +587,7 @@ TRACE_EVENT(cachefiles_mark_active,
> >  		    __entry->inode	= inode->i_ino;
> >  			   ),
> >  
> > -	    TP_printk("o=%08x B=%lx",
> > +	    TP_printk("o=%08x B=%llx",
> >  		      __entry->obj, __entry->inode)
> >  	    );
> >  
> > @@ -600,7 +600,7 @@ TRACE_EVENT(cachefiles_mark_failed,
> >  	    /* Note that obj may be NULL */
> >  	    TP_STRUCT__entry(
> >  		    __field(unsigned int,		obj)
> > -		    __field(ino_t,			inode)
> > +		    __field(u64,			inode)
> 
> Is ino_t being changed? Why the update here?
> 

No, ino_t isn't. That's part of the ABI and has to remain unsigned
long. The point of this series is to make inode->i_ino a u64. Any event
holding an ino_t today is going to need a 64-bit field to fully
describe it.

And to be clear, this should make things better for 32-bit boxes in the
long run. Once this change is done, i_ino should be a reliable source
of info regardless of machine's word size.

For the tracepoints, I think it's best to just extend them to 64-bit
fields outright rather than using the new (temporary) kino_t typedef
that I'm adding.

> >  			     ),
> >  
> >  	    TP_fast_assign(
> > @@ -608,7 +608,7 @@ TRACE_EVENT(cachefiles_mark_failed,
> >  		    __entry->inode	= inode->i_ino;
> >  			   ),
> >  
> > -	    TP_printk("o=%08x B=%lx",
> > +	    TP_printk("o=%08x B=%llx",
> >  		      __entry->obj, __entry->inode)
> >  	    );
> >  
> > @@ -621,7 +621,7 @@ TRACE_EVENT(cachefiles_mark_inactive,
> >  	    /* Note that obj may be NULL */
> >  	    TP_STRUCT__entry(
> >  		    __field(unsigned int,		obj)
> > -		    __field(ino_t,			inode)
> > +		    __field(u64,			inode)
> 
> Ditto.
> 
> >  			     ),
> >  
> >  	    TP_fast_assign(
> > @@ -629,7 +629,7 @@ TRACE_EVENT(cachefiles_mark_inactive,
> >  		    __entry->inode	= inode->i_ino;
> >  			   ),
> >  
> > -	    TP_printk("o=%08x B=%lx",
> > +	    TP_printk("o=%08x B=%llx",
> >  		      __entry->obj, __entry->inode)
> >  	    );
> >  
> > diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
> > index 370016c38a5bbc07d5ba6c102030b49c9eb6424d..41bc752616b25d6cd7955203e2c604029d0b440c 100644
> > --- a/include/trace/events/filelock.h
> > +++ b/include/trace/events/filelock.h
> > @@ -42,7 +42,7 @@ TRACE_EVENT(locks_get_lock_context,
> >  	TP_ARGS(inode, type, ctx),
> >  
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> >  		__field(dev_t, s_dev)
> >  		__field(unsigned char, type)
> >  		__field(struct file_lock_context *, ctx)
> > @@ -55,7 +55,7 @@ TRACE_EVENT(locks_get_lock_context,
> >  		__entry->ctx = ctx;
> >  	),
> >  
> > -	TP_printk("dev=0x%x:0x%x ino=0x%lx type=%s ctx=%p",
> > +	TP_printk("dev=0x%x:0x%x ino=0x%llx type=%s ctx=%p",
> >  		  MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> >  		  __entry->i_ino, show_fl_type(__entry->type), __entry->ctx)
> >  );
> > @@ -67,7 +67,7 @@ DECLARE_EVENT_CLASS(filelock_lock,
> >  
> >  	TP_STRUCT__entry(
> >  		__field(struct file_lock *, fl)
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> 
> Having u64 before a pointer would be tighter on 32 bit systems, and leaves
> out any holes in the trace.
>
> >  		__field(dev_t, s_dev)
> >  		__field(struct file_lock_core *, blocker)
> >  		__field(fl_owner_t, owner)
> > @@ -93,7 +93,7 @@ DECLARE_EVENT_CLASS(filelock_lock,
> >  		__entry->ret = ret;
> >  	),
> >  
> > -	TP_printk("fl=%p dev=0x%x:0x%x ino=0x%lx fl_blocker=%p fl_owner=%p fl_pid=%u fl_flags=%s fl_type=%s fl_start=%lld fl_end=%lld ret=%d",
> > +	TP_printk("fl=%p dev=0x%x:0x%x ino=0x%llx fl_blocker=%p fl_owner=%p fl_pid=%u fl_flags=%s fl_type=%s fl_start=%lld fl_end=%lld ret=%d",
> >  		__entry->fl, MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> >  		__entry->i_ino, __entry->blocker, __entry->owner,
> >  		__entry->pid, show_fl_flags(__entry->flags),
> > @@ -124,7 +124,7 @@ DECLARE_EVENT_CLASS(filelock_lease,
> >  
> >  	TP_STRUCT__entry(
> >  		__field(struct file_lease *, fl)
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> 
> Same here.
> 
> >  		__field(dev_t, s_dev)
> >  		__field(struct file_lock_core *, blocker)
> >  		__field(fl_owner_t, owner)
> > @@ -146,7 +146,7 @@ DECLARE_EVENT_CLASS(filelock_lease,
> >  		__entry->downgrade_time = fl ? fl->fl_downgrade_time : 0;
> >  	),
> >  
> > -	TP_printk("fl=%p dev=0x%x:0x%x ino=0x%lx fl_blocker=%p fl_owner=%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu",
> > +	TP_printk("fl=%p dev=0x%x:0x%x ino=0x%llx fl_blocker=%p fl_owner=%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu",
> >  		__entry->fl, MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> >  		__entry->i_ino, __entry->blocker, __entry->owner,
> >  		show_fl_flags(__entry->flags),
> > @@ -175,7 +175,7 @@ TRACE_EVENT(generic_add_lease,
> >  	TP_ARGS(inode, fl),
> >  
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> >  		__field(int, wcount)
> >  		__field(int, rcount)
> >  		__field(int, icount)
> > @@ -196,7 +196,7 @@ TRACE_EVENT(generic_add_lease,
> >  		__entry->type = fl->c.flc_type;
> >  	),
> >  
> > -	TP_printk("dev=0x%x:0x%x ino=0x%lx wcount=%d rcount=%d icount=%d fl_owner=%p fl_flags=%s fl_type=%s",
> > +	TP_printk("dev=0x%x:0x%x ino=0x%llx wcount=%d rcount=%d icount=%d fl_owner=%p fl_flags=%s fl_type=%s",
> >  		MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> >  		__entry->i_ino, __entry->wcount, __entry->rcount,
> >  		__entry->icount, __entry->owner,
> > diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h
> > index f48fe637bfd25885dc6daaf09336ab60626b4944..153491e57cce6df73e30ddee60a52ed7d8923c24 100644
> > --- a/include/trace/events/filemap.h
> > +++ b/include/trace/events/filemap.h
> > @@ -21,7 +21,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
> >  
> >  	TP_STRUCT__entry(
> >  		__field(unsigned long, pfn)
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> 
> Again, this would cause a 32 bit hole.
> 
> >  		__field(unsigned long, index)
> >  		__field(dev_t, s_dev)
> >  		__field(unsigned char, order)
> > @@ -38,7 +38,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
> >  		__entry->order = folio_order(folio);
> >  	),
> >  
> > -	TP_printk("dev %d:%d ino %lx pfn=0x%lx ofs=%lu order=%u",
> > +	TP_printk("dev %d:%d ino %llx pfn=0x%lx ofs=%lu order=%u",
> >  		MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> >  		__entry->i_ino,
> >  		__entry->pfn,
> > @@ -67,7 +67,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache_range,
> >  	TP_ARGS(mapping, index, last_index),
> >  
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> >  		__field(dev_t, s_dev)
> >  		__field(unsigned long, index)
> >  		__field(unsigned long, last_index)
> > @@ -85,7 +85,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache_range,
> >  	),
> >  
> >  	TP_printk(
> > -		"dev=%d:%d ino=%lx ofs=%lld-%lld",
> > +		"dev=%d:%d ino=%llx ofs=%lld-%lld",
> >  		MAJOR(__entry->s_dev),
> >  		MINOR(__entry->s_dev), __entry->i_ino,
> >  		((loff_t)__entry->index) << PAGE_SHIFT,
> > @@ -117,7 +117,7 @@ TRACE_EVENT(mm_filemap_fault,
> >  	TP_ARGS(mapping, index),
> >  
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, i_ino)
> > +		__field(u64, i_ino)
> >  		__field(dev_t, s_dev)
> >  		__field(unsigned long, index)
> >  	),
> > @@ -133,7 +133,7 @@ TRACE_EVENT(mm_filemap_fault,
> >  	),
> >  
> >  	TP_printk(
> > -		"dev=%d:%d ino=%lx ofs=%lld",
> > +		"dev=%d:%d ino=%llx ofs=%lld",
> >  		MAJOR(__entry->s_dev),
> >  		MINOR(__entry->s_dev), __entry->i_ino,
> >  		((loff_t)__entry->index) << PAGE_SHIFT
> > @@ -146,7 +146,7 @@ TRACE_EVENT(filemap_set_wb_err,
> >  		TP_ARGS(mapping, eseq),
> >  
> >  		TP_STRUCT__entry(
> > -			__field(unsigned long, i_ino)
> > +			__field(u64, i_ino)
> >  			__field(dev_t, s_dev)
> >  			__field(errseq_t, errseq)
> >  		),
> > @@ -160,7 +160,7 @@ TRACE_EVENT(filemap_set_wb_err,
> >  				__entry->s_dev = mapping->host->i_rdev;
> >  		),
> >  
> > -		TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x",
> > +		TP_printk("dev=%d:%d ino=0x%llx errseq=0x%x",
> >  			MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> >  			__entry->i_ino, __entry->errseq)
> >  );
> > @@ -172,7 +172,7 @@ TRACE_EVENT(file_check_and_advance_wb_err,
> >  
> >  		TP_STRUCT__entry(
> >  			__field(struct file *, file)
> > -			__field(unsigned long, i_ino)
> > +			__field(u64, i_ino)
> 
> Having a pointer after the u64 is better.
> 
> >  			__field(dev_t, s_dev)
> >  			__field(errseq_t, old)
> >  			__field(errseq_t, new)
> > @@ -191,7 +191,7 @@ TRACE_EVENT(file_check_and_advance_wb_err,
> >  			__entry->new = file->f_wb_err;
> >  		),
> >  
> > -		TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x",
> > +		TP_printk("file=%p dev=%d:%d ino=0x%llx old=0x%x new=0x%x",
> >  			__entry->file, MAJOR(__entry->s_dev),
> >  			MINOR(__entry->s_dev), __entry->i_ino, __entry->old,
> >  			__entry->new)
> > diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
> > index 50ebc1290ab062a9c30ab00049fb96691f9a0f23..11121baa8ece7928c653b4f874fb10ffbdd02fd0 100644
> > --- a/include/trace/events/fs_dax.h
> > +++ b/include/trace/events/fs_dax.h
> > @@ -12,7 +12,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class,
> >  		pgoff_t max_pgoff, int result),
> >  	TP_ARGS(inode, vmf, max_pgoff, result),
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, ino)
> > +		__field(u64, ino)
> >  		__field(unsigned long, vm_start)
> >  		__field(unsigned long, vm_end)
> >  		__field(vm_flags_t, vm_flags)
> > @@ -35,7 +35,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class,
> >  		__entry->max_pgoff = max_pgoff;
> >  		__entry->result = result;
> >  	),
> > -	TP_printk("dev %d:%d ino %#lx %s %s address %#lx vm_start "
> > +	TP_printk("dev %d:%d ino %#llx %s %s address %#lx vm_start "
> >  			"%#lx vm_end %#lx pgoff %#lx max_pgoff %#lx %s",
> >  		MAJOR(__entry->dev),
> >  		MINOR(__entry->dev),
> > @@ -66,7 +66,7 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
> >  		void *radix_entry),
> >  	TP_ARGS(inode, vmf, zero_folio, radix_entry),
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, ino)
> > +		__field(u64, ino)
> >  		__field(vm_flags_t, vm_flags)
> >  		__field(unsigned long, address)
> >  		__field(struct folio *, zero_folio)
> > @@ -81,7 +81,7 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_class,
> >  		__entry->zero_folio = zero_folio;
> >  		__entry->radix_entry = radix_entry;
> >  	),
> > -	TP_printk("dev %d:%d ino %#lx %s address %#lx zero_folio %p "
> > +	TP_printk("dev %d:%d ino %#llx %s address %#lx zero_folio %p "
> >  			"radix_entry %#lx",
> >  		MAJOR(__entry->dev),
> >  		MINOR(__entry->dev),
> > @@ -106,7 +106,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class,
> >  	TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result),
> >  	TP_ARGS(inode, vmf, result),
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, ino)
> > +		__field(u64, ino)
> >  		__field(vm_flags_t, vm_flags)
> >  		__field(unsigned long, address)
> >  		__field(pgoff_t, pgoff)
> > @@ -123,7 +123,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class,
> >  		__entry->pgoff = vmf->pgoff;
> >  		__entry->result = result;
> >  	),
> > -	TP_printk("dev %d:%d ino %#lx %s %s address %#lx pgoff %#lx %s",
> > +	TP_printk("dev %d:%d ino %#llx %s %s address %#lx pgoff %#lx %s",
> >  		MAJOR(__entry->dev),
> >  		MINOR(__entry->dev),
> >  		__entry->ino,
> > @@ -150,7 +150,7 @@ DECLARE_EVENT_CLASS(dax_writeback_range_class,
> >  	TP_PROTO(struct inode *inode, pgoff_t start_index, pgoff_t end_index),
> >  	TP_ARGS(inode, start_index, end_index),
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, ino)
> > +		__field(u64, ino)
> >  		__field(pgoff_t, start_index)
> >  		__field(pgoff_t, end_index)
> >  		__field(dev_t, dev)
> > @@ -161,7 +161,7 @@ DECLARE_EVENT_CLASS(dax_writeback_range_class,
> >  		__entry->start_index = start_index;
> >  		__entry->end_index = end_index;
> >  	),
> > -	TP_printk("dev %d:%d ino %#lx pgoff %#lx-%#lx",
> > +	TP_printk("dev %d:%d ino %#llx pgoff %#lx-%#lx",
> >  		MAJOR(__entry->dev),
> >  		MINOR(__entry->dev),
> >  		__entry->ino,
> > @@ -182,7 +182,7 @@ TRACE_EVENT(dax_writeback_one,
> >  	TP_PROTO(struct inode *inode, pgoff_t pgoff, pgoff_t pglen),
> >  	TP_ARGS(inode, pgoff, pglen),
> >  	TP_STRUCT__entry(
> > -		__field(unsigned long, ino)
> > +		__field(u64, ino)
> >  		__field(pgoff_t, pgoff)
> >  		__field(pgoff_t, pglen)
> >  		__field(dev_t, dev)
> > @@ -193,7 +193,7 @@ TRACE_EVENT(dax_writeback_one,
> >  		__entry->pgoff = pgoff;
> >  		__entry->pglen = pglen;
> >  	),
> > -	TP_printk("dev %d:%d ino %#lx pgoff %#lx pglen %#lx",
> > +	TP_printk("dev %d:%d ino %#llx pgoff %#lx pglen %#lx",
> >  		MAJOR(__entry->dev),
> >  		MINOR(__entry->dev),
> >  		__entry->ino,
> > diff --git a/include/trace/events/fsverity.h b/include/trace/events/fsverity.h
> > index a8c52f21cbd5eb010c7e7b2fdb8f9de49c8ea326..4477c17e05748360965c4e1840590efe96d6335e 100644
> > --- a/include/trace/events/fsverity.h
> > +++ b/include/trace/events/fsverity.h
> > @@ -16,7 +16,7 @@ TRACE_EVENT(fsverity_enable,
> >  		 const struct merkle_tree_params *params),
> >  	TP_ARGS(inode, params),
> >  	TP_STRUCT__entry(
> > -		__field(ino_t, ino)
> > +		__field(u64, ino)
> 
> Do you need to convert all these ino_t's?
> 
> >  		__field(u64, data_size)
> >  		__field(u64, tree_size)
> >  		__field(unsigned int, merkle_block)
> > @@ -29,8 +29,8 @@ TRACE_EVENT(fsverity_enable,
> >  		__entry->merkle_block = params->block_size;
> >  		__entry->num_levels = params->num_levels;
> >  	),
> > -	TP_printk("ino %lu data_size %llu tree_size %llu merkle_block %u levels %u",
> > -		(unsigned long) __entry->ino,
> > +	TP_printk("ino %llu data_size %llu tree_size %llu merkle_block %u levels %u",
> > +		__entry->ino,
> >  		__entry->data_size,
> >  		__entry->tree_size,
> >  		__entry->merkle_block,
> > @@ -42,7 +42,7 @@ TRACE_EVENT(fsverity_tree_done,
> >  		 const struct merkle_tree_params *params),
> >  	TP_ARGS(inode, vi, params),
> >  	TP_STRUCT__entry(
> > -		__field(ino_t, ino)
> > +		__field(u64, ino)
> >  		__field(u64, data_size)
> >  		__field(u64, tree_size)
> >  		__field(unsigned int, merkle_block)
> > @@ -59,8 +59,8 @@ TRACE_EVENT(fsverity_tree_done,
> >  		memcpy(__get_dynamic_array(root_hash), vi->root_hash, __get_dynamic_array_len(root_hash));
> >  		memcpy(__get_dynamic_array(file_digest), vi->file_digest, __get_dynamic_array_len(file_digest));
> >  	),
> > -	TP_printk("ino %lu data_size %llu tree_size %lld merkle_block %u levels %u root_hash %s digest %s",
> > -		(unsigned long) __entry->ino,
> > +	TP_printk("ino %llu data_size %llu tree_size %lld merkle_block %u levels %u root_hash %s digest %s",
> > +		__entry->ino,
> >  		__entry->data_size,
> >  		__entry->tree_size,
> >  		__entry->merkle_block,
> > @@ -75,7 +75,7 @@ TRACE_EVENT(fsverity_verify_data_block,
> >  		 u64 data_pos),
> >  	TP_ARGS(inode, params, data_pos),
> >  	TP_STRUCT__entry(
> > -		__field(ino_t, ino)
> > +		__field(u64, ino)
> >  		__field(u64, data_pos)
> >  		__field(unsigned int, merkle_block)
> >  	),
> > @@ -84,8 +84,8 @@ TRACE_EVENT(fsverity_verify_data_block,
> >  		__entry->data_pos = data_pos;
> >  		__entry->merkle_block = params->block_size;
> >  	),
> > -	TP_printk("ino %lu data_pos %llu merkle_block %u",
> > -		(unsigned long) __entry->ino,
> > +	TP_printk("ino %llu data_pos %llu merkle_block %u",
> > +		__entry->ino,
> >  		__entry->data_pos,
> >  		__entry->merkle_block)
> >  );
> > @@ -96,7 +96,7 @@ TRACE_EVENT(fsverity_merkle_hit,
> >  		 unsigned int hidx),
> >  	TP_ARGS(inode, data_pos, hblock_idx, level, hidx),
> >  	TP_STRUCT__entry(
> > -		__field(ino_t, ino)
> > +		__field(u64, ino)
> >  		__field(u64, data_pos)
> 
> Heh, this actually removed a hole, but again, why convert ino_t?
> 
> Anyway, I stopped here. But you get the idea.
>
> 
> >  		__field(unsigned long, hblock_idx)
> >  		__field(unsigned int, level)

Thanks for the review! I'll definitely look at reordering the
tracepoint fields for better packing since that has material
consequences.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply

* [PATCH v2 00/10] Reintrodce Hornet LSM
From: Blaise Boscaccy @ 2026-02-27 23:38 UTC (permalink / raw)
  To: Blaise Boscaccy, Jonathan Corbet, Paul Moore, James Morris,
	Serge E. Hallyn, Mickaël Salaün, Günther Noack,
	Dr. David Alan Gilbert, Andrew Morton, James.Bottomley, dhowells,
	Fan Wu, Ryan Foster, linux-security-module, linux-doc,
	linux-kernel, bpf

This patch series introduces the next iteration of the Hornet LSM.
Hornet’s goal is to provide a secure and extensible in-kernel
signature verification mechanism for eBPF programs.

Hornet addresses concerns from users who require strict audit trails and
verification guarantees for eBPF programs, especially in
security-sensitive environments. Many production systems need assurance
that only authorized, unmodified eBPF programs are loaded into the
kernel. Hornet provides this assurance through cryptographic signature
verification.

The currently accepted loader-plus-map signature verification scheme,
mandated by Alexei and KP, is simple to implement and generally
acceptable if users and administrators are satisfied with it. However,
verifying both the loader and the maps offers additional benefits
beyond verifying the loader alone:

1. Security and Audit Integrity

A key advantage is that the LSM hook for authorizing BPF program loads
can operate after signature verification. This ensures:

* Access control decisions are based on verified signature status.
* Accurate system state measurement and logging.
* Log entries claiming a verified signature are truthful, avoiding
  misleading records where only the loader was verified while the actual
  BPF program verification occurs later without logging.

2. TOCTOU Attack Prevention

The current map hash implementation may be vulnerable to a TOCTOU
attack because it allows unfrozen maps to cache a previously
calculated hash. The accepted “trusted loader” scheme cannot detect
this and may permit loading altered maps.

3. Supply Chain Integrity

Verify that eBPF programs and their associated map data have not been
modified since they were built and signed, in the kernel proper, may
aid in protecting against supply chain attacks.

This approach addresses concerns from users who require strict audit
trails and verification guarantees, especially in security-sensitive
environments. Map hashes for extended verification are passed via the
existing PKCS#7 UAPI and verified by the crypto subsystem. Hornet then
calculates the program’s verification state.  Hornet itself does not
enforce a policy on whether unsigned or partially signed programs
should be rejected. It delegates that decision to downstream LSMs
hook, making it a composable building block in a larger security
architecture.


Changes in V2:
- Addressed possible TocTou races in hash verification
- Improved documentation and tooling
- Added Alexie's nack

Link to RFC: https://lore.kernel.org/linux-security-module/20251211021257.1208712-1-bboscaccy@linux.microsoft.com/


Blaise Boscaccy (4):
  security: Hornet LSM
  hornet: Introduce gen_sig
  hornet: Add a light skeleton data extractor scripts
  selftests/hornet: Add a selftest for the Hornet LSM

James Bottomley (5):
  certs: break out pkcs7 check into its own function
  crypto: pkcs7: add flag for validated trust on a signed info block
  crypto: pkcs7: allow pkcs7_digest() to be called from pkcs7_trust
  crypto: pkcs7: add ability to extract signed attributes by OID
  crypto: pkcs7: add tests for pkcs7_get_authattr

Paul Moore (1):
  lsm: framework for BPF integrity verification

 Documentation/admin-guide/LSM/Hornet.rst     | 310 +++++++++++++++
 Documentation/admin-guide/LSM/index.rst      |   1 +
 MAINTAINERS                                  |   9 +
 certs/system_keyring.c                       |  76 ++--
 crypto/asymmetric_keys/Makefile              |   4 +-
 crypto/asymmetric_keys/pkcs7_aa.asn1         |  18 +
 crypto/asymmetric_keys/pkcs7_key_type.c      |  42 +-
 crypto/asymmetric_keys/pkcs7_parser.c        |  81 ++++
 crypto/asymmetric_keys/pkcs7_parser.h        |   4 +
 crypto/asymmetric_keys/pkcs7_trust.c         |   9 +
 crypto/asymmetric_keys/pkcs7_verify.c        |  13 +-
 include/crypto/pkcs7.h                       |   4 +
 include/linux/lsm_hook_defs.h                |   5 +
 include/linux/oid_registry.h                 |   3 +
 include/linux/security.h                     |  25 ++
 include/linux/verification.h                 |   2 +
 include/uapi/linux/lsm.h                     |   1 +
 scripts/Makefile                             |   1 +
 scripts/hornet/Makefile                      |   5 +
 scripts/hornet/extract-insn.sh               |  27 ++
 scripts/hornet/extract-map.sh                |  27 ++
 scripts/hornet/extract-skel.sh               |  27 ++
 scripts/hornet/gen_sig.c                     | 392 +++++++++++++++++++
 scripts/hornet/write-sig.sh                  |  27 ++
 security/Kconfig                             |   3 +-
 security/Makefile                            |   1 +
 security/hornet/Kconfig                      |  11 +
 security/hornet/Makefile                     |   7 +
 security/hornet/hornet.asn1                  |  13 +
 security/hornet/hornet_lsm.c                 | 323 +++++++++++++++
 security/security.c                          |  75 +++-
 tools/testing/selftests/Makefile             |   1 +
 tools/testing/selftests/hornet/Makefile      |  63 +++
 tools/testing/selftests/hornet/loader.c      |  21 +
 tools/testing/selftests/hornet/trivial.bpf.c |  33 ++
 35 files changed, 1623 insertions(+), 41 deletions(-)
 create mode 100644 Documentation/admin-guide/LSM/Hornet.rst
 create mode 100644 crypto/asymmetric_keys/pkcs7_aa.asn1
 create mode 100644 scripts/hornet/Makefile
 create mode 100755 scripts/hornet/extract-insn.sh
 create mode 100755 scripts/hornet/extract-map.sh
 create mode 100755 scripts/hornet/extract-skel.sh
 create mode 100644 scripts/hornet/gen_sig.c
 create mode 100755 scripts/hornet/write-sig.sh
 create mode 100644 security/hornet/Kconfig
 create mode 100644 security/hornet/Makefile
 create mode 100644 security/hornet/hornet.asn1
 create mode 100644 security/hornet/hornet_lsm.c
 create mode 100644 tools/testing/selftests/hornet/Makefile
 create mode 100644 tools/testing/selftests/hornet/loader.c
 create mode 100644 tools/testing/selftests/hornet/trivial.bpf.c

-- 
2.52.0


^ permalink raw reply

* [PATCH v2 01/10] certs: break out pkcs7 check into its own function
From: Blaise Boscaccy @ 2026-02-27 23:38 UTC (permalink / raw)
  To: Blaise Boscaccy, Jonathan Corbet, Paul Moore, James Morris,
	Serge E. Hallyn, Mickaël Salaün, Günther Noack,
	Dr. David Alan Gilbert, Andrew Morton, James.Bottomley, dhowells,
	Fan Wu, Ryan Foster, linux-security-module, linux-doc,
	linux-kernel, bpf
In-Reply-To: <20260227233930.2418522-1-bboscaccy@linux.microsoft.com>

From: James Bottomley <James.Bottomley@HansenPartnership.com>

Add new validate_pkcs7_trust() function which can operate on the
system keyrings and is simply some of the innards of
verify_pkcs7_message_sig().

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 certs/system_keyring.c       | 76 +++++++++++++++++++++---------------
 include/linux/verification.h |  2 +
 2 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/certs/system_keyring.c b/certs/system_keyring.c
index e0761436ec7f..dcbefc2d3f6d 100644
--- a/certs/system_keyring.c
+++ b/certs/system_keyring.c
@@ -298,42 +298,19 @@ late_initcall(load_system_certificate_list);
 #ifdef CONFIG_SYSTEM_DATA_VERIFICATION
 
 /**
- * verify_pkcs7_message_sig - Verify a PKCS#7-based signature on system data.
- * @data: The data to be verified (NULL if expecting internal data).
- * @len: Size of @data.
+ * validate_pkcs7_trust - add trust markers based on keyring
  * @pkcs7: The PKCS#7 message that is the signature.
  * @trusted_keys: Trusted keys to use (NULL for builtin trusted keys only,
  *					(void *)1UL for all trusted keys).
- * @usage: The use to which the key is being put.
- * @view_content: Callback to gain access to content.
- * @ctx: Context for callback.
  */
-int verify_pkcs7_message_sig(const void *data, size_t len,
-			     struct pkcs7_message *pkcs7,
-			     struct key *trusted_keys,
-			     enum key_being_used_for usage,
-			     int (*view_content)(void *ctx,
-						 const void *data, size_t len,
-						 size_t asn1hdrlen),
-			     void *ctx)
+int validate_pkcs7_trust(struct pkcs7_message *pkcs7, struct key *trusted_keys)
 {
 	int ret;
 
-	/* The data should be detached - so we need to supply it. */
-	if (data && pkcs7_supply_detached_data(pkcs7, data, len) < 0) {
-		pr_err("PKCS#7 signature with non-detached data\n");
-		ret = -EBADMSG;
-		goto error;
-	}
-
-	ret = pkcs7_verify(pkcs7, usage);
-	if (ret < 0)
-		goto error;
-
 	ret = is_key_on_revocation_list(pkcs7);
 	if (ret != -ENOKEY) {
 		pr_devel("PKCS#7 key is on revocation list\n");
-		goto error;
+		return ret;
 	}
 
 	if (!trusted_keys) {
@@ -351,18 +328,55 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
 		trusted_keys = NULL;
 #endif
 		if (!trusted_keys) {
-			ret = -ENOKEY;
 			pr_devel("PKCS#7 platform keyring is not available\n");
-			goto error;
+			return -ENOKEY;
 		}
 	}
 	ret = pkcs7_validate_trust(pkcs7, trusted_keys);
-	if (ret < 0) {
-		if (ret == -ENOKEY)
-			pr_devel("PKCS#7 signature not signed with a trusted key\n");
+	if (ret == -ENOKEY)
+		pr_devel("PKCS#7 signature not signed with a trusted key\n");
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(validate_pkcs7_trust);
+
+/**
+ * verify_pkcs7_message_sig - Verify a PKCS#7-based signature on system data.
+ * @data: The data to be verified (NULL if expecting internal data).
+ * @len: Size of @data.
+ * @pkcs7: The PKCS#7 message that is the signature.
+ * @trusted_keys: Trusted keys to use (NULL for builtin trusted keys only,
+ *					(void *)1UL for all trusted keys).
+ * @usage: The use to which the key is being put.
+ * @view_content: Callback to gain access to content.
+ * @ctx: Context for callback.
+ */
+int verify_pkcs7_message_sig(const void *data, size_t len,
+			     struct pkcs7_message *pkcs7,
+			     struct key *trusted_keys,
+			     enum key_being_used_for usage,
+			     int (*view_content)(void *ctx,
+						 const void *data, size_t len,
+						 size_t asn1hdrlen),
+			     void *ctx)
+{
+	int ret;
+
+	/* The data should be detached - so we need to supply it. */
+	if (data && pkcs7_supply_detached_data(pkcs7, data, len) < 0) {
+		pr_err("PKCS#7 signature with non-detached data\n");
+		ret = -EBADMSG;
 		goto error;
 	}
 
+	ret = pkcs7_verify(pkcs7, usage);
+	if (ret < 0)
+		goto error;
+
+	ret = validate_pkcs7_trust(pkcs7, trusted_keys);
+	if (ret < 0)
+		goto error;
+
 	if (view_content) {
 		size_t asn1hdrlen;
 
diff --git a/include/linux/verification.h b/include/linux/verification.h
index dec7f2beabfd..57f1460d36f1 100644
--- a/include/linux/verification.h
+++ b/include/linux/verification.h
@@ -44,6 +44,8 @@ enum key_being_used_for {
 struct key;
 struct pkcs7_message;
 
+extern int validate_pkcs7_trust(struct pkcs7_message *pkcs7,
+				struct key *trusted_keys);
 extern int verify_pkcs7_signature(const void *data, size_t len,
 				  const void *raw_pkcs7, size_t pkcs7_len,
 				  struct key *trusted_keys,
-- 
2.52.0


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox