Bug 213417

Summary: implicit declaration of function 'swab' in mm/slub.c
Product: Memory Management Reporter: vannguye
Component: Slab AllocatorAssignee: Andrew Morton (akpm)
Status: RESOLVED CODE_FIX    
Severity: blocking    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: v5.7-rc1 Subsystem:
Regression: No Bisected commit-id:
Attachments: Build log from building kernel-4.18.0-305.3.1.el8_4.src.rpm
kernel-x86_64.config

Description vannguye 2021-06-11 16:38:43 UTC
Created attachment 297341 [details]
Build log from building kernel-4.18.0-305.3.1.el8_4.src.rpm

When build with kernel configuration option CONFIG_SLAB_FREELIST_HARDENED turned on, we hit an error with implicit declaration of function 'swab' in mm/slub.c.

Here is the error message:

mm/slub.c: In function 'freelist_ptr':
mm/slub.c:264:4: error: implicit declaration of function 'swab'; did you mean 'swap'? [-Werror=implicit-function-declaration]
    swab((unsigned long)kasan_reset_tag((void *)ptr_addr)));
    ^~~~
    swap
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:315: mm/slub.o] Error 1
make: *** [Makefile:1086: mm] Error 2
make: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.Ka7QF9 (%build)
    Bad exit status from /var/tmp/rpm-tmp.Ka7QF9 (%build)


Look like this is commit introduced the call to swab()
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/mm/slub.c?h=v5.7-rc1&id=1ad53d9fa3f6168ebcf48a50e08b170432da2257
Comment 1 Andrew Morton 2021-06-11 22:27:38 UTC
Thanks, I queued a fix (include linux/swab.h)
Comment 2 vannguye 2021-06-14 20:12:23 UTC
Hi Andrew,

I included linux/swab.h and still seeing the same error.  Did this include work in your environment ?

Thanks
Van

On 6/11/21, 6:27 PM, "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org> wrote:

    https://bugzilla.kernel.org/show_bug.cgi?id=213417

    --- Comment #1 from Andrew Morton (akpm@linux-foundation.org) ---
    Thanks, I queued a fix (include linux/swab.h)

    -- 
    You may reply to this email to add a comment.

    You are receiving this mail because:
    You reported the bug.
Comment 3 Andrew Morton 2021-06-14 22:07:52 UTC
hm I didn't realize that this was a 4.18 RHEL kernel.  That's very different from mainline.

This problem probably isn't present in current mainline, but slub.c should have swab.h anyway.

Can you please attach the .config?  I'll give it a try with mainline kernel.
Comment 4 vannguye 2021-06-16 15:43:11 UTC
Created attachment 297411 [details]
kernel-x86_64.config

Hi Andrew,

Here is the config.

Thanks

Van

On 6/14/21, 6:08 PM, "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org> wrote:

    https://bugzilla.kernel.org/show_bug.cgi?id=213417

    --- Comment #3 from Andrew Morton (akpm@linux-foundation.org) ---
    hm I didn't realize that this was a 4.18 RHEL kernel.  That's very different
    from mainline.

    This problem probably isn't present in current mainline, but slub.c should have
    swab.h anyway.

    Can you please attach the .config?  I'll give it a try with mainline kernel.

    -- 
    You may reply to this email to add a comment.

    You are receiving this mail because:
    You reported the bug.
Comment 5 Andrew Morton 2021-06-16 22:53:17 UTC
Can't reproduce with that config and current kernels.  A lot has changed...
Comment 6 vannguye 2021-06-22 13:21:43 UTC
Have you tried with 4.18 kernel ?

On 6/16/21, 6:53 PM, "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org> wrote:

    https://bugzilla.kernel.org/show_bug.cgi?id=213417

    --- Comment #5 from Andrew Morton (akpm@linux-foundation.org) ---
    Can't reproduce with that config and current kernels.  A lot has changed...

    -- 
    You may reply to this email to add a comment.

    You are receiving this mail because:
    You reported the bug.