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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 Apr 2024 15:55:25 +0100
From: Ryan Roberts <ryan.roberts@....com>
To: Arnd Bergmann <arnd@...db.de>, kernel test robot <yujie.liu@...el.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
 Andrew Morton <akpm@...ux-foundation.org>, llvm@...ts.linux.dev,
 Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: clang: error: unknown argument '-static-libasan'; did you mean
 '-static-libsan'?

On 16/04/2024 15:42, Arnd Bergmann wrote:
> On Tue, Apr 16, 2024, at 16:33, Ryan Roberts wrote:
>> On 16/04/2024 08:42, kernel test robot wrote:
>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>> head:   7efd0a74039fb6b584be2cb91c1d0ef0bd796ee1
>>> commit: c652df8a4a9d7853fa1100b244024fd6f1a9c18a selftests: link libasan statically for tests with -fsanitize=address
>>> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
>>>
>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>> the same patch/commit), kindly add following tags
>>> | Reported-by: kernel test robot <yujie.liu@...el.com>
>>> | Closes: https://lore.kernel.org/r/202404141807.LgsqXPY5-lkp@intel.com/
>>>
>>> All errors (new ones prefixed by >>):
>>>
>>> # tools/testing/selftests/fchmodat2$ make CC=clang
>>> clang -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan -isystem usr/include     fchmodat2_test.c  -o tools/testing/selftests/fchmodat2/fchmodat2_test
>>> clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'?
>>> make: *** [../lib.mk:181: tools/testing/selftests/fchmodat2/fchmodat2_test] Error 1
>>>
>>> # tools/testing/selftests/openat2$ make CC=clang
>>> clang -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan     openat2_test.c helpers.c helpers.h  -o tools/testing/selftests/openat2/openat2_test
>>> clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'?
>>> clang: error: cannot specify -o when generating multiple output files
>>> make: *** [../lib.mk:181: tools/testing/selftests/openat2/openat2_test] Error 1
>>>
>>
>> Hi Arnd,
>>
>> This change went in quite a while ago and is on;y just blowing up. I saw your
>> comment in another thread [1] that Andrew merged your change to set -Wextra.
>> Perhaps that's what has caused this to show up only now? *although I don't
>> actually see -Wextra in the command line).
>>
>> I guess the problem is that `-static-libasan` is only supported by gcc. But I'm
>> Makefile-illiterate. Can anyone advise on what's the best way to make this
>> argument gcc-only?
> 
> Thanks for letting me know about the problem, I had indeed missed
> build-testing any of tools/testing, so this might not be
> the only problem there.
> 
> I'm not entirely sure how much of the Kbuild infrastructure we
> can rely on here. If the .config file gets included, this should
> work:
> 
> --- a/tools/testing/selftests/fchmodat2/Makefile
> +++ b/tools/testing/selftests/fchmodat2/Makefile
> @@ -1,6 +1,12 @@
>  # SPDX-License-Identifier: GPL-2.0-or-later
>  
> -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES)
> +CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES)
> +ifdef CONFIG_CC_IS_GCC
> +CFLAGS += -static-libasan
> +else
> +CFLAGS += -static-libsan
> +endif
> +
>  TEST_GEN_PROGS := fchmodat2_test
>  
>  include ../lib.mk
> 
> Alternatively, if the cc-option macro is available, you could
> try this one
> 
> CFLAGS += $(call cc-option, -static-libasan) $(call cc-option, -static-libsan) 
> 
>      Arnd

Thanks! I'll give this a try. Although I can't actually find any mention of
-static-libsan in the clang manual. I believe I read somewhere that static
linking is default for clang, so worst case, I guess we just leave it out
(presumably that's effectively been the case so far anyway).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ