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]
Date:   Fri, 14 Jul 2023 21:56:04 +0200
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Ian Rogers" <irogers@...gle.com>,
        "Tiezhu Yang" <yangtiezhu@...ngson.cn>
Cc:     linux-arm-kernel@...ts.infradead.org,
        linux-riscv@...ts.infradead.org, loongarch@...ts.linux.dev,
        Linux-Arch <linux-arch@...r.kernel.org>, bpf@...r.kernel.org,
        linux-perf-users@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org, loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH v3 0/2] Unify uapi bitsperlong.h

On Fri, Jul 14, 2023, at 20:34, Ian Rogers wrote:
> On Thu, Jun 22, 2023 at 8:10 AM Arnd Bergmann <arnd@...db.de> wrote:
>>
>> On Thu, Jun 22, 2023, at 16:13, Tiezhu Yang wrote:
>> > v3:
>> >   -- Check the definition of __BITS_PER_LONG first at
>> >      the beginning of uapi/asm-generic/bitsperlong.h
>> >
>
> Thanks for doing this cleanup! I just wanted to report an issue I ran
> into with building the Linux perf tool. The header guard in:
> tools/include/asm-generic/bitsperlong.h
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/asm-generic/bitsperlong.h
>
> Caused an issue with building:
> tools/perf/util/cs-etm.c
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/util/cs-etm.c
>
> The issue was that cs-etm.c would #include a system header, which
> would transitively include a header with the same header guard. This
> led to the tools/include/asm-generic/bitsperlong.h being ignored and
> the compilation of tools/perf/util/cs-etm.c failing due to a missing
> define. My local workaround is:
>
> ```
> diff --git a/tools/include/asm-generic/bitsperlong.h
> b/tools/include/asm-generic/bitsperlong.h
> index 2093d56ddd11..88508a35cb45 100644
> --- a/tools/include/asm-generic/bitsperlong.h
> +++ b/tools/include/asm-generic/bitsperlong.h
> @@ -1,6 +1,6 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef __ASM_GENERIC_BITS_PER_LONG
> -#define __ASM_GENERIC_BITS_PER_LONG
> +#ifndef __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG
> +#define __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG
> #include <uapi/asm-generic/bitsperlong.h>
> @@ -21,4 +21,4 @@
> #define small_const_nbits(nbits) \
> (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0)
> -#endif /* __ASM_GENERIC_BITS_PER_LONG */
> +#endif /* __LINUX_TOOLS_ASM_GENERIC_BITS_PER_LONG */
> ```
>
> I'm not sure if a wider fix is necessary for this, but I thought it
> worthwhile to report that there are potential issues. I don't think we
> can use #pragma once, as an alternative to header guards, to avoid
> this kind of name collision.

Thanks for the report! I think the correct fix is to update
the tools/include/ headers to have the same change as the kernel
itself. I don't know why we end up including both, that sounds
like a separate issue but should normally be harmless as long
as the contents are the same.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ