lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6637c6db-bd9a-43cc-a1dc-d2adb097f53c@lucifer.local>
Date: Thu, 6 Nov 2025 14:26:50 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Cc: "David Hildenbrand (Red Hat)" <david@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
        Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
        Shuah Khan <shuah@...nel.org>, linux-mm@...ck.org,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftest/mm: fix pointer comparison in mremap_test

On Thu, Nov 06, 2025 at 05:32:47PM +0530, Ankit Khushwaha wrote:
> On Thu, Nov 06, 2025 at 12:18:57PM +0100, David Hildenbrand (Red Hat) wrote:
> > On 06.11.25 11:49, Ankit Khushwaha wrote:
> > > Pointer arthemitic with 'void * addr' and 'unsigned long long dest_alignment'
> > > triggers following warning:
> > >
> > > mremap_test.c:1035:31: warning: pointer comparison always evaluates to
> > > false [-Wtautological-compare]
> > >   1035 |                 if (addr + c.dest_alignment < addr) {
> > >        |                                             ^
> > >
> > > typecasting 'addr' to 'unsigned long long' to fix pointer comparison.
> >
> > With which compiler are you seeing this?
>
> Hi David,
>
> clang version 20.1.8 (Fedora 20.1.8-4.fc42) raised this warning.
>
> To reproduce:
> 	make -C tools/testing/selftests/mm CC=clang

FYI That doesn't work:

$ make -C tools/testing/selftests/mm CC=clang
make: Entering directory '/data/kerndev/kernels/mm/tools/testing/selftests/mm'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 15.2.1 20250813
  You are using:           clang version 20.1.8
  CC [M]  page_frag_test.o
clang: error: unknown argument: '-fmin-function-alignment=16'
clang: error: unknown argument: '-fconserve-stack'
clang: error: unsupported option '-mrecord-mcount' for target 'x86_64-unknown-linux-gnu'
make[4]: *** [/usr/lib/modules/6.17.2-arch1-1/build/scripts/Makefile.build:287: page_frag_test.o] Error 1
make[3]: *** [/usr/lib/modules/6.17.2-arch1-1/build/Makefile:2011: .] Error 2
make[2]: *** [Makefile:248: __sub-make] Error 2
make[1]: *** [Makefile:15: all] Error 2
make: *** [../lib.mk:146: gen_mods_dir] Error 2
make: Leaving directory '/data/kerndev/kernels/mm/tools/testing/selftests/mm'
[649ms][2][review/loz-v2][~/kerndev/kernels/mm]$ cd tools/testing/selftests/mm

Even if I rebuild the entire kernel using clang via LLVM=1 it doesn't work.

The following KIND OF works:

$ make -C tools/testing/selftests/mm clean
$ make tools/testing/selftests/mm LLVM=1

But I still get:

warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 15.2.1 20250813
  You are using:           clang version 20.1.8
  CC [M]  page_frag_test.o
clang: error: unknown argument: '-fmin-function-alignment=16'
clang: error: unknown argument: '-fconserve-stack'
clang: error: unsupported option '-mrecord-mcount' for target 'x86_64-unknown-linux-gnu'
make[4]: *** [/usr/lib/modules/6.17.2-arch1-1/build/scripts/Makefile.build:287: page_frag_test.o] Error 1
make[3]: *** [/usr/lib/modules/6.17.2-arch1-1/build/Makefile:2011: .] Error 2
make[2]: *** [Makefile:248: __sub-make] Error 2
make[1]: *** [Makefile:15: all] Error 2
make: *** [../lib.mk:146: gen_mods_dir] Error 2
make: Leaving directory '/data/kerndev/kernels/mm/tools/testing/selftests/mm'

Errors, presumably unless you build _the entire kernel_ using LLVM=1 :)

>
> Thanks,
> --
> Ankit

It may be worth looking at how to make this behave better because this seems
silly if clang will pick up additional warnings.

Cheers, Lorenzo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ