![]() |
|
Message-ID: <aEx_QIaidayYDuFq@x1> Date: Fri, 13 Jun 2025 16:42:56 -0300 From: Arnaldo Carvalho de Melo <acme@...nel.org> To: Rich Felker <dalias@...c.org>, Sebastian Andrzej Siewior <bigeasy@...utronix.de> Cc: enh <enh@...gle.com>, musl@...ts.openwall.com, Namhyung Kim <namhyung@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>, Ian Rogers <irogers@...gle.com>, James Clark <james.clark@...aro.org>, Jiri Olsa <jolsa@...nel.org>, Kan Liang <kan.liang@...ux.intel.com> Subject: Re: sys/prctl.h differences vs man page On Thu, Jun 12, 2025 at 01:21:26PM -0400, Rich Felker wrote: > On Thu, Jun 12, 2025 at 06:50:00PM +0200, Sebastian Andrzej Siewior wrote: > > On 2025-06-12 12:34:08 [-0400], Rich Felker wrote: > > > On Thu, Jun 12, 2025 at 12:28:24PM -0400, enh wrote: > > > > https://man7.org/linux/man-pages/man2/prctl.2.html > > > OK, apparently this is either a regression since the man-pages 6.8-r0 > > > package I have here on Alpine, or an old version. Guess we should look > > > at the git history and how that happened... > > That would be commit > > ae31bd15b65ce ("prctl.2, PR_*.2const: SYNOPSIS: #include <linux/prctl.h> for the PR_* constants") > > https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=ae31bd15b65ce > > Commit is present since man-pages-6.9. > > Yes, that looks completely unmotivated and should be reverted. > In general, you should never include both the linux uapi and > userspace/libc header for the same thing. So glibc has: ⬢ [acme@...lbx perf-tools]$ rpm -qf /usr/include/sys/prctl.h glibc-devel-2.41-5.fc42.x86_64 ⬢ [acme@...lbx perf-tools]$ grep include /usr/include/sys/prctl.h #include <features.h> #include <linux/prctl.h> /* The magic values come from here */ ⬢ [acme@...lbx perf-tools]$ So we don't need to include linux/prctl.h We do it in perf to get the newest stuff, and then it works, but since musl doesn't do this, i.e. includes linux/prctl.h, it doesn't get the copy we have, so I think at this point we're stuck with: diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c index fdf133c9520f73a4..d2d6d7f3ea331c84 100644 --- a/tools/perf/bench/futex-hash.c +++ b/tools/perf/bench/futex-hash.c @@ -18,7 +18,6 @@ #include <stdlib.h> #include <linux/compiler.h> #include <linux/kernel.h> -#include <linux/prctl.h> #include <linux/zalloc.h> #include <sys/time.h> #include <sys/mman.h> diff --git a/tools/perf/bench/futex.c b/tools/perf/bench/futex.c index 26382e4d8d4ce2ff..4c4fee107e5912d5 100644 --- a/tools/perf/bench/futex.c +++ b/tools/perf/bench/futex.c @@ -2,11 +2,18 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> -#include <linux/prctl.h> #include <sys/prctl.h> #include "futex.h" +#ifndef PR_FUTEX_HASH +#define PR_FUTEX_HASH 78 +# define PR_FUTEX_HASH_SET_SLOTS 1 +# define FH_FLAG_IMMUTABLE (1ULL << 0) +# define PR_FUTEX_HASH_GET_SLOTS 2 +# define PR_FUTEX_HASH_GET_IMMUTABLE 3 +#endif // PR_FUTEX_HASH + void futex_set_nbuckets_param(struct bench_futex_parameters *params) { unsigned long flags; (END) Which at this point is, as I added stuff after trying to build it in the set of containers I have, attributed to: commit 699450aed5456001d1c9232562a753b1ca96ea73 (HEAD -> perf-tools) Author: Sebastian Andrzej Siewior <bigeasy@...utronix.de> Date: Wed Jun 11 11:25:42 2025 +0200 perf bench futex: Fix prctl include in musl libc With: Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de> Reported-by: Namhyung Kim <namhyung@...nel.org> Closes: https://lore.kernel.org/r/20250611092542.F4ooE2FL@linutronix.de [ Remove one more in tools/perf/bench/futex-hash.c and conditionally define PR_FUTEX_HASH and friends ] Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com> Sebastian, can I keep this? If you disagree with this attribution and prefer for me to take the blame, lemme know, but I want to get this moving. - Arnaldo
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.