Re: [PATCH] selinux: use explicit 64-bit division
From: Paul Moore
Date: Tue Sep 15 2026 - 17:40:31 EST
On Tue, Sep 15, 2026 at 4:43 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> On Tue, Sep 15, 2026, at 22:36, Paul Moore wrote:
> > On Tue, Sep 15, 2026 at 3:57 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> >>
> >> From: Arnd Bergmann <arnd@xxxxxxxx>
> >>
> >> On 32-bit targets, the division of a 64-bit integer by 33 causes a
> >> function call:
> >>
> >> arm-linux-gnueabi-ld: security/selinux/selinuxfs.o: in function `sel_read_class':
> >> selinuxfs.c:(.text+0xdcc): undefined reference to `__aeabi_uldivmod'
> >> arm-linux-gnueabi-ld: security/selinux/selinuxfs.o: in function `sel_read_perm':
> >> selinuxfs.c:(.text+0xed0): undefined reference to `__aeabi_uldivmod'
> >>
> >> Replace this with an explicit call to div_u64() and div_u64_rem() to
> >> annotate that these are potentially very slow.
> >>
> >> Fixes: fc68b6a45f16 ("selinux: convert selinuxfs inode numbers from unsigned long to u64")
> >> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> >> ---
> >> security/selinux/selinuxfs.c | 8 ++++++--
> >> 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > Thanks Arnd.
> >
> > As sashiko pointed out[1], since we don't really use the full 64-bit
> > inode space, what do you think about the following fix instead?
>
> Ah right, I hadn't checked the actual value of SEL_INO_MASK, and the
> description of your patch made it sound like the 64-bit space
> was actually required.
No worries, selinuxfs is a bit odd sometimes.
> Your patch is better then, you can treat my mail as Reported-by.
Done, patch link below. Thanks again!
https://lore.kernel.org/selinux/20260915213807.481355-2-paul@xxxxxxxxxxxxxx
--
paul-moore.com