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: <CAEf4BzZ3jqKRap4h9n-JY=-Sp1RdsDDX=1fnX2ZPxbXURdnvvQ@mail.gmail.com>
Date:   Wed, 2 Oct 2019 14:13:16 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Song Liu <songliubraving@...com>
Cc:     KP Singh <kpsingh@...omium.org>,
        open list <linux-kernel@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, Florent Revest <revest@...gle.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin Lau <kafai@...com>, Yonghong Song <yhs@...com>,
        Florent Revest <revest@...omium.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH v2] samples/bpf: Add a workaround for asm_inline

On Wed, Oct 2, 2019 at 2:05 PM Song Liu <songliubraving@...com> wrote:
>
>
>
> > On Oct 2, 2019, at 1:22 PM, Andrii Nakryiko <andrii.nakryiko@...il.com> wrote:
> >
> > On Wed, Oct 2, 2019 at 12:17 PM KP Singh <kpsingh@...omium.org> wrote:
> >>
> >> From: KP Singh <kpsingh@...gle.com>
> >>
> >> This was added in:
> >>
> >>  commit eb111869301e ("compiler-types.h: add asm_inline definition")
> >>
> >> and breaks samples/bpf as clang does not support asm __inline.
> >>
> >> Co-developed-by: Florent Revest <revest@...gle.com>
> >> Signed-off-by: Florent Revest <revest@...gle.com>
> >> Signed-off-by: KP Singh <kpsingh@...gle.com>
> >> ---
> >>
> >> Changes since v1:
> >>
> >> - Dropped the rename from asm_workaround.h to asm_goto_workaround.h
> >> - Dropped the fix for task_fd_query_user.c as it is updated in
> >>  https://lore.kernel.org/bpf/20191001112249.27341-1-bjorn.topel@gmail.com/
> >>
> >> samples/bpf/asm_goto_workaround.h | 13 ++++++++++++-
> >> 1 file changed, 12 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/samples/bpf/asm_goto_workaround.h b/samples/bpf/asm_goto_workaround.h
> >> index 7409722727ca..7048bb3594d6 100644
> >> --- a/samples/bpf/asm_goto_workaround.h
> >> +++ b/samples/bpf/asm_goto_workaround.h
> >> @@ -3,7 +3,8 @@
> >> #ifndef __ASM_GOTO_WORKAROUND_H
> >> #define __ASM_GOTO_WORKAROUND_H
> >>
> >> -/* this will bring in asm_volatile_goto macro definition
> >> +/*
> >> + * This will bring in asm_volatile_goto and asm_inline macro definitions
> >>  * if enabled by compiler and config options.
> >>  */
> >> #include <linux/types.h>
> >> @@ -13,5 +14,15 @@
> >> #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto")
> >> #endif
> >>
> >> +/*
> >> + * asm_inline is defined as asm __inline in "include/linux/compiler_types.h"
> >> + * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not
> >> + * supported by CLANG.
> >> + */
> >> +#ifdef asm_inline
> >> +#undef asm_inline
> >> +#define asm_inline asm
> >> +#endif
> >
> > Would it be better to just #undef CONFIG_CC_HAS_ASM_INLINE for BPF programs?
>
> I guess that is still useful when gcc fully support BPF?

Ah, I missed that it's Clang-specific, not BPF target-specific thing.
Yeah, then it makes sense.

Acked-by: Andrii Nakryiko <andriin@...com>

>
> Thanks,
> Song
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ