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: <8257315.FuKUqIaFJu@nvdebian>
Date:   Thu, 20 Jan 2022 12:20:51 +1100
From:   Alistair Popple <apopple@...dia.com>
To:     Shuah Khan <shuah@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Ingo Molnar" <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Darren Hart <dvhart@...radead.org>,
        Davidlohr Bueso <dave@...olabs.net>,
        André Almeida <andrealmeid@...labora.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Mickaël Salaün <mic@...ikod.net>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Mat Martineau <mathew.j.martineau@...ux.intel.com>,
        Matthieu Baerts <matthieu.baerts@...sares.net>,
        Andrew Morton <akpm@...ux-foundation.org>,
        chiminghao <chi.minghao@....com.cn>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        "open list:KERNEL VIRTUAL MACHINE (KVM)" <kvm@...r.kernel.org>,
        "open list:LANDLOCK SECURITY MODULE" 
        <linux-security-module@...r.kernel.org>,
        "open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
        "open list:NETWORKING [MPTCP]" <mptcp@...ts.linux.dev>,
        "open list:MEMORY MANAGEMENT" <linux-mm@...ck.org>,
        Muhammad Usama Anjum <usama.anjum@...labora.com>
CC:     Muhammad Usama Anjum <usama.anjum@...labora.com>,
        <kernel@...labora.com>
Subject: Re: [PATCH V2 10/10] selftests: vm: remove dependecy from internal kernel macros

Reviewed-by: Alistair Popple <apopple@...dia.com>

On Wednesday, 19 January 2022 9:15:31 PM AEDT Muhammad Usama Anjum wrote:
> The defination of swap() is used from kernel's internal header when this
> test is built in source tree. The build fails when this test is built
> out of source tree as defination of swap() isn't found. Selftests
> shouldn't depend on kernel's internal header files. They can only depend
> on uapi header files. Add the defination of swap() to fix the build
> error:
> 
> 	gcc -Wall  -I/linux_mainline2/build/usr/include -no-pie    userfaultfd.c -lrt -lpthread -o /linux_mainline2/build/kselftest/vm/userfaultfd
> 	userfaultfd.c: In function ‘userfaultfd_stress’:
> 	userfaultfd.c:1530:3: warning: implicit declaration of function ‘swap’; did you mean ‘swab’? [-Wimplicit-function-declaration]
> 	 1530 |   swap(area_src, area_dst);
> 	      |   ^~~~
> 	      |   swab
> 	/usr/bin/ld: /tmp/cclUUH7V.o: in function `userfaultfd_stress':
> 	userfaultfd.c:(.text+0x4d64): undefined reference to `swap'
> 	/usr/bin/ld: userfaultfd.c:(.text+0x4d82): undefined reference to `swap'
> 	collect2: error: ld returned 1 exit status
> 
> Fixes: 2c769ed7137a ("tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
> ---
>  tools/testing/selftests/vm/userfaultfd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
> index d3fd24f9fae8..d2480ab93037 100644
> --- a/tools/testing/selftests/vm/userfaultfd.c
> +++ b/tools/testing/selftests/vm/userfaultfd.c
> @@ -119,6 +119,9 @@ struct uffd_stats {
>  				 ~(unsigned long)(sizeof(unsigned long long) \
>  						  -  1)))
>  
> +#define swap(a, b) \
> +	do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
> +
>  const char *examples =
>      "# Run anonymous memory test on 100MiB region with 99999 bounces:\n"
>      "./userfaultfd anon 100 99999\n\n"
> 




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ