public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] vfs: follow-on fixes for i_ino widening
@ 2026-03-10 11:43 Jeff Layton
  2026-03-10 11:43 ` [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group() Jeff Layton
  2026-03-10 11:43 ` [PATCH 2/2] EVM: add comment describing why ino field is still unsigned long Jeff Layton
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Layton @ 2026-03-10 11:43 UTC (permalink / raw)
  To: Christian Brauner, Ryusuke Konishi, Viacheslav Dubeyko,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg,
	Paul Moore, James Morris, Serge E. Hallyn
  Cc: linux-nilfs, linux-kernel, linux-integrity, linux-security-module,
	Jeff Layton, kernel test robot

Just some patches to fix follow-on issues reported after the
inode->i_ino widening series. Christian, please toss these onto
vfs-7.1.kino, assuming they pass review.

Thanks,
Jeff

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Jeff Layton (2):
      nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group()
      EVM: add comment describing why ino field is still unsigned long

 fs/nilfs2/bmap.c                    | 9 ++++++---
 security/integrity/evm/evm_crypto.c | 6 ++++++
 2 files changed, 12 insertions(+), 3 deletions(-)
---
base-commit: 9840bb66e7e5dffd72b03201318f154a10b06b4a
change-id: 20260310-iino-u64-424fa570d850

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group()
  2026-03-10 11:43 [PATCH 0/2] vfs: follow-on fixes for i_ino widening Jeff Layton
@ 2026-03-10 11:43 ` Jeff Layton
  2026-03-10 13:01   ` Ryusuke Konishi
  2026-03-10 16:54   ` Viacheslav Dubeyko
  2026-03-10 11:43 ` [PATCH 2/2] EVM: add comment describing why ino field is still unsigned long Jeff Layton
  1 sibling, 2 replies; 7+ messages in thread
From: Jeff Layton @ 2026-03-10 11:43 UTC (permalink / raw)
  To: Christian Brauner, Ryusuke Konishi, Viacheslav Dubeyko,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg,
	Paul Moore, James Morris, Serge E. Hallyn
  Cc: linux-nilfs, linux-kernel, linux-integrity, linux-security-module,
	Jeff Layton, kernel test robot

With the change to make inode->i_ino a u64, the build started failing on
32-bit ARM with:

    ERROR: modpost: "__aeabi_uldivmod" [fs/nilfs2/nilfs2.ko] undefined!

Fix this by using the 64-bit division interfaces in
nilfs_bmap_find_target_in_group().

Fixes: 998a59d371c2 ("treewide: fix missed i_ino format specifier conversions")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603100602.KPxiClIO-lkp@intel.com/
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nilfs2/bmap.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
index 824f2bd91c167965ec3a660202b6e6c5f1fe007e..4ce9a93149a5af13bc215cc1877a757e2c6cf49b 100644
--- a/fs/nilfs2/bmap.c
+++ b/fs/nilfs2/bmap.c
@@ -455,11 +455,14 @@ __u64 nilfs_bmap_find_target_in_group(const struct nilfs_bmap *bmap)
 {
 	struct inode *dat = nilfs_bmap_get_dat(bmap);
 	unsigned long entries_per_group = nilfs_palloc_entries_per_group(dat);
-	unsigned long group = bmap->b_inode->i_ino / entries_per_group;
+	unsigned long group;
+	u32 rem;
+
+	group = div_u64(bmap->b_inode->i_ino, entries_per_group);
+	div_u64_rem(bmap->b_inode->i_ino, NILFS_BMAP_GROUP_DIV, &rem);
 
 	return group * entries_per_group +
-		(bmap->b_inode->i_ino % NILFS_BMAP_GROUP_DIV) *
-		(entries_per_group / NILFS_BMAP_GROUP_DIV);
+	       rem * (entries_per_group / NILFS_BMAP_GROUP_DIV);
 }
 
 static struct lock_class_key nilfs_bmap_dat_lock_key;

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] EVM: add comment describing why ino field is still unsigned long
  2026-03-10 11:43 [PATCH 0/2] vfs: follow-on fixes for i_ino widening Jeff Layton
  2026-03-10 11:43 ` [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group() Jeff Layton
@ 2026-03-10 11:43 ` Jeff Layton
  2026-03-10 16:05   ` Mimi Zohar
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Layton @ 2026-03-10 11:43 UTC (permalink / raw)
  To: Christian Brauner, Ryusuke Konishi, Viacheslav Dubeyko,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg,
	Paul Moore, James Morris, Serge E. Hallyn
  Cc: linux-nilfs, linux-kernel, linux-integrity, linux-security-module,
	Jeff Layton

Mimi pointed out that we didn't widen the inode number field in struct
h_misc alongside the inode->i_ino widening. While we could make an
equivalent change there, that would force EVM remeasurement on all
32-bit hosts.

Instead, leave the field as an unsigned long. This should have no effect
on 64-bit hosts, and allow things to continue working on 32-bit hosts in
the cases where the i_ino fits in 32-bits.

Add a comment explaining why it's being left as unsigned long.

Cc: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 security/integrity/evm/evm_crypto.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index c0ca4eedb0fe5d5c30f45f515a4bc90248ec64ea..3445f4c2097f7e8af61de6299b721fc4a1d8afb4 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -144,6 +144,12 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
 			  char type, char *digest)
 {
 	struct h_misc {
+		/*
+		 * Although inode->i_ino is now u64, this field remains
+		 * unsigned long to allow existing hashes from 32-bit hosts
+		 * to continue working when i_ino hasn't changed and fitsxi
+		 * in a u32.
+		 */
 		unsigned long ino;
 		__u32 generation;
 		uid_t uid;

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group()
  2026-03-10 11:43 ` [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group() Jeff Layton
@ 2026-03-10 13:01   ` Ryusuke Konishi
  2026-03-10 16:54   ` Viacheslav Dubeyko
  1 sibling, 0 replies; 7+ messages in thread
From: Ryusuke Konishi @ 2026-03-10 13:01 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Christian Brauner, Viacheslav Dubeyko, Mimi Zohar, Roberto Sassu,
	Dmitry Kasatkin, Eric Snowberg, Paul Moore, James Morris,
	Serge E. Hallyn, linux-nilfs, linux-kernel, linux-integrity,
	linux-security-module, kernel test robot

On Tue, Mar 10, 2026 at 8:44 PM Jeff Layton wrote:
>
> With the change to make inode->i_ino a u64, the build started failing on
> 32-bit ARM with:
>
>     ERROR: modpost: "__aeabi_uldivmod" [fs/nilfs2/nilfs2.ko] undefined!
>
> Fix this by using the 64-bit division interfaces in
> nilfs_bmap_find_target_in_group().
>
> Fixes: 998a59d371c2 ("treewide: fix missed i_ino format specifier conversions")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202603100602.KPxiClIO-lkp@intel.com/
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>

Thank you.  The conversion seems reasonable.

Ryusuke Konishi

> ---
>  fs/nilfs2/bmap.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
> index 824f2bd91c167965ec3a660202b6e6c5f1fe007e..4ce9a93149a5af13bc215cc1877a757e2c6cf49b 100644
> --- a/fs/nilfs2/bmap.c
> +++ b/fs/nilfs2/bmap.c
> @@ -455,11 +455,14 @@ __u64 nilfs_bmap_find_target_in_group(const struct nilfs_bmap *bmap)
>  {
>         struct inode *dat = nilfs_bmap_get_dat(bmap);
>         unsigned long entries_per_group = nilfs_palloc_entries_per_group(dat);
> -       unsigned long group = bmap->b_inode->i_ino / entries_per_group;
> +       unsigned long group;
> +       u32 rem;
> +
> +       group = div_u64(bmap->b_inode->i_ino, entries_per_group);
> +       div_u64_rem(bmap->b_inode->i_ino, NILFS_BMAP_GROUP_DIV, &rem);
>
>         return group * entries_per_group +
> -               (bmap->b_inode->i_ino % NILFS_BMAP_GROUP_DIV) *
> -               (entries_per_group / NILFS_BMAP_GROUP_DIV);
> +              rem * (entries_per_group / NILFS_BMAP_GROUP_DIV);
>  }
>
>  static struct lock_class_key nilfs_bmap_dat_lock_key;
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] EVM: add comment describing why ino field is still unsigned long
  2026-03-10 11:43 ` [PATCH 2/2] EVM: add comment describing why ino field is still unsigned long Jeff Layton
@ 2026-03-10 16:05   ` Mimi Zohar
  0 siblings, 0 replies; 7+ messages in thread
From: Mimi Zohar @ 2026-03-10 16:05 UTC (permalink / raw)
  To: Jeff Layton, Christian Brauner, Ryusuke Konishi,
	Viacheslav Dubeyko, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg,
	Paul Moore, James Morris, Serge E. Hallyn
  Cc: linux-nilfs, linux-kernel, linux-integrity, linux-security-module

On Tue, 2026-03-10 at 07:43 -0400, Jeff Layton wrote:
> Mimi pointed out that we didn't widen the inode number field in struct
> h_misc alongside the inode->i_ino widening. While we could make an
> equivalent change there, that would force EVM remeasurement on all
> 32-bit hosts.

Instead of saying "force EVM remeasurement" say, "require EVM resigning".

> 
> Instead, leave the field as an unsigned long. This should have no effect
> on 64-bit hosts, and allow things to continue working on 32-bit hosts in
> the cases where the i_ino fits in 32-bits.
> 
> Add a comment explaining why it's being left as unsigned long.
> 
> Cc: Mimi Zohar <zohar@linux.ibm.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  security/integrity/evm/evm_crypto.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index c0ca4eedb0fe5d5c30f45f515a4bc90248ec64ea..3445f4c2097f7e8af61de6299b721fc4a1d8afb4 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -144,6 +144,12 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
>  			  char type, char *digest)
>  {
>  	struct h_misc {
> +		/*
> +		 * Although inode->i_ino is now u64, this field remains
> +		 * unsigned long to allow existing hashes from 32-bit hosts
> +		 * to continue working when i_ino hasn't changed and fitsxi
> +		 * in a u32.

security.evm contains either an HMAC or signature.  Change "hashes" -> HMAC and
signatures"

Mimi

> +		 */
>  		unsigned long ino;
>  		__u32 generation;
>  		uid_t uid;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group()
  2026-03-10 11:43 ` [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group() Jeff Layton
  2026-03-10 13:01   ` Ryusuke Konishi
@ 2026-03-10 16:54   ` Viacheslav Dubeyko
  2026-03-10 17:28     ` Jeff Layton
  1 sibling, 1 reply; 7+ messages in thread
From: Viacheslav Dubeyko @ 2026-03-10 16:54 UTC (permalink / raw)
  To: Jeff Layton, Christian Brauner, Ryusuke Konishi, Mimi Zohar,
	Roberto Sassu, Dmitry Kasatkin, Eric Snowberg, Paul Moore,
	James Morris, Serge E. Hallyn
  Cc: linux-nilfs, linux-kernel, linux-integrity, linux-security-module,
	kernel test robot

On Tue, 2026-03-10 at 07:43 -0400, Jeff Layton wrote:
> With the change to make inode->i_ino a u64, the build started failing
> on
> 32-bit ARM with:
> 
>     ERROR: modpost: "__aeabi_uldivmod" [fs/nilfs2/nilfs2.ko]
> undefined!
> 
> Fix this by using the 64-bit division interfaces in
> nilfs_bmap_find_target_in_group().
> 
> Fixes: 998a59d371c2 ("treewide: fix missed i_ino format specifier
> conversions")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes:
> https://lore.kernel.org/oe-kbuild-all/202603100602.KPxiClIO-lkp@intel.com/
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/nilfs2/bmap.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
> index
> 824f2bd91c167965ec3a660202b6e6c5f1fe007e..4ce9a93149a5af13bc215cc1877
> a757e2c6cf49b 100644
> --- a/fs/nilfs2/bmap.c
> +++ b/fs/nilfs2/bmap.c
> @@ -455,11 +455,14 @@ __u64 nilfs_bmap_find_target_in_group(const
> struct nilfs_bmap *bmap)
>  {
>  	struct inode *dat = nilfs_bmap_get_dat(bmap);
>  	unsigned long entries_per_group =
> nilfs_palloc_entries_per_group(dat);
> -	unsigned long group = bmap->b_inode->i_ino /
> entries_per_group;
> +	unsigned long group;
> +	u32 rem;
> +
> +	group = div_u64(bmap->b_inode->i_ino, entries_per_group);
> +	div_u64_rem(bmap->b_inode->i_ino, NILFS_BMAP_GROUP_DIV,
> &rem);
>  
>  	return group * entries_per_group +
> -		(bmap->b_inode->i_ino % NILFS_BMAP_GROUP_DIV) *
> -		(entries_per_group / NILFS_BMAP_GROUP_DIV);
> +	       rem * (entries_per_group / NILFS_BMAP_GROUP_DIV);
>  }
>  
>  static struct lock_class_key nilfs_bmap_dat_lock_key;

Makes sense. :) Maybe, rem is not very good variable name, but the
whole logic looks good.

Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>

Thanks,
Slava.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group()
  2026-03-10 16:54   ` Viacheslav Dubeyko
@ 2026-03-10 17:28     ` Jeff Layton
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Layton @ 2026-03-10 17:28 UTC (permalink / raw)
  To: Viacheslav Dubeyko, Christian Brauner, Ryusuke Konishi,
	Mimi Zohar, Roberto Sassu, Dmitry Kasatkin, Eric Snowberg,
	Paul Moore, James Morris, Serge E. Hallyn
  Cc: linux-nilfs, linux-kernel, linux-integrity, linux-security-module,
	kernel test robot

On Tue, 2026-03-10 at 09:54 -0700, Viacheslav Dubeyko wrote:
> On Tue, 2026-03-10 at 07:43 -0400, Jeff Layton wrote:
> > With the change to make inode->i_ino a u64, the build started failing
> > on
> > 32-bit ARM with:
> > 
> >     ERROR: modpost: "__aeabi_uldivmod" [fs/nilfs2/nilfs2.ko]
> > undefined!
> > 
> > Fix this by using the 64-bit division interfaces in
> > nilfs_bmap_find_target_in_group().
> > 
> > Fixes: 998a59d371c2 ("treewide: fix missed i_ino format specifier
> > conversions")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes:
> > https://lore.kernel.org/oe-kbuild-all/202603100602.KPxiClIO-lkp@intel.com/
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> >  fs/nilfs2/bmap.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
> > index
> > 824f2bd91c167965ec3a660202b6e6c5f1fe007e..4ce9a93149a5af13bc215cc1877
> > a757e2c6cf49b 100644
> > --- a/fs/nilfs2/bmap.c
> > +++ b/fs/nilfs2/bmap.c
> > @@ -455,11 +455,14 @@ __u64 nilfs_bmap_find_target_in_group(const
> > struct nilfs_bmap *bmap)
> >  {
> >  	struct inode *dat = nilfs_bmap_get_dat(bmap);
> >  	unsigned long entries_per_group =
> > nilfs_palloc_entries_per_group(dat);
> > -	unsigned long group = bmap->b_inode->i_ino /
> > entries_per_group;
> > +	unsigned long group;
> > +	u32 rem;
> > +
> > +	group = div_u64(bmap->b_inode->i_ino, entries_per_group);
> > +	div_u64_rem(bmap->b_inode->i_ino, NILFS_BMAP_GROUP_DIV,
> > &rem);
> >  
> >  	return group * entries_per_group +
> > -		(bmap->b_inode->i_ino % NILFS_BMAP_GROUP_DIV) *
> > -		(entries_per_group / NILFS_BMAP_GROUP_DIV);
> > +	       rem * (entries_per_group / NILFS_BMAP_GROUP_DIV);
> >  }
> >  
> >  static struct lock_class_key nilfs_bmap_dat_lock_key;
> 
> Makes sense. :) Maybe, rem is not very good variable name, but the
> whole logic looks good.
> 
> Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
> 

Thanks. My thinking was "remainder" but I don't have an objection if
you guys want to change it.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-10 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 11:43 [PATCH 0/2] vfs: follow-on fixes for i_ino widening Jeff Layton
2026-03-10 11:43 ` [PATCH 1/2] nilfs2: fix 64-bit division operations in nilfs_bmap_find_target_in_group() Jeff Layton
2026-03-10 13:01   ` Ryusuke Konishi
2026-03-10 16:54   ` Viacheslav Dubeyko
2026-03-10 17:28     ` Jeff Layton
2026-03-10 11:43 ` [PATCH 2/2] EVM: add comment describing why ino field is still unsigned long Jeff Layton
2026-03-10 16:05   ` Mimi Zohar

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