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] [day] [month] [year] [list]
Message-ID: <CADHxFxQuVjh4zVtVhjim1Ppobpb+CyeG1h6bRFFcxTCKpmaHkg@mail.gmail.com>
Date: Fri, 21 Nov 2025 18:17:48 +0800
From: hupu <hupu.gm@...il.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Leo Yan <leo.yan@....com>, acme@...nel.org, adrian.hunter@...el.com, 
	alexander.shishkin@...ux.intel.com, irogers@...gle.com, jolsa@...nel.org, 
	justinstitt@...gle.com, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org, mark.rutland@....com, mingo@...hat.com, 
	morbo@...gle.com, nathan@...nel.org, nick.desaulniers+lkml@...il.com, 
	peterz@...radead.org
Subject: Re: [PATCH] perf build: Support passing extra Clang options via EXTRA_BPF_FLAGS

Hi Namhyung,
Thank you very much for your reply.

On Fri, Nov 21, 2025 at 3:23 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> Hello,
>
> On Wed, Nov 19, 2025 at 05:43:41PM +0800, hupu wrote:
> > RESEND
> >
> > On Tue, Nov 18, 2025 at 3:28 PM hupu <hupu.gm@...il.com> wrote:
> > >
> > > Hi Leo and Namhyung,
> > >
> > > On Tue, Nov 18, 2025 at 3:18 PM hupu <hupu.gm@...il.com> wrote:
> > > >
> > > > I then added KHDR_INCLUDES to BPF_INCLUDE, pointing it to the kernel’s
> > > > self-contained header directory so that the build prefers headers
> > > > provided by the kernel.
> > > >
> > > >
> > > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > > > index 47c906b807ef..65c6e871988b 100644
> > > > --- a/tools/perf/Makefile.perf
> > > > +++ b/tools/perf/Makefile.perf
> > > > @@ -1202,7 +1202,8 @@ endif
> > > >
> > > >  CLANG_OPTIONS = -Wall
> > > >  CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
> > > > -BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES)
> > > > +KHDR_INCLUDES := $(abspath $(OUTPUT)/../../usr/include)
> > > > +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE)
> > > > -I$(KHDR_INCLUDES) $(CLANG_SYS_INCLUDES)
>
> I think your patch was wrapped around.
>

Oh, yes — that line was automatically wrapped by the mail system
because it exceeded 80 characters.
I’ve slightly adjusted it so that it can be displayed correctly in
email clients, as shown below:

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 47c906b807ef..eaccaae87e3c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1202,7 +1202,9 @@ endif

 CLANG_OPTIONS = -Wall
 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
-BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES)
+KHDR_INCLUDES := $(abspath $(OUTPUT)/../../usr/include)
+BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) \
+               -I$(KHDR_INCLUDES) $(CLANG_SYS_INCLUDES)
 TOOLS_UAPI_INCLUDE := -I$(srctree)/tools/include/uapi

 ifneq ($(WERROR),0)


> > > >  TOOLS_UAPI_INCLUDE := -I$(srctree)/tools/include/uapi
> > > >
> > > >  ifneq ($(WERROR),0)
> > > >
> > > >
> > > > With this change verified, perf compiles successfully even without
> > > > explicitly specifying the cross-toolchain sysroot in the compile
> > > > command.
>
> I'm not familiar with the usr directory in the kernel source.  Will it
> contain some generated headers?
>

Yes, the headers in KHDR_INCLUDES are directly copied from the kernel
source tree (sometimes with very minor modifications). They are
exactly the headers required during perf compilation.

> > > >
> > >
> > > As an additional suggestion, I’d prefer to keep both the above patch
> > > and the previously discussed PATCH v3, which would mean submitting two
> > > PRs. From my perspective, allowing users to pass custom compilation
> > > options via EXTRA_BPF_FLAGS is more flexible than only configuring
> > > headers, so I’d like to hear your thoughts.
>
> Yep, I'm ok with the extra flag variable.
>
> Thanks,
> Namhyung
>

Leo, what are your thoughts on this? I’d appreciate hearing your suggestions.

Thanks,
hupu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ