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: <CAP-5=fWhvTCNR9Orjw4vvrrV_GV27V4rRTnym9qWaNtMdOJpjw@mail.gmail.com>
Date:   Wed, 5 Jan 2022 23:01:52 -0800
From:   Ian Rogers <irogers@...gle.com>
To:     Jiri Slaby <jirislaby@...nel.org>,
        linux-trace-devel@...r.kernel.org,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Tzvetomir Stoyanov <tz.stoyanov@...il.com>,
        "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
        eranian@...gle.com
Subject: Re: [was: libtraceevent: Increase libtraceevent logging when verbose]

On Mon, Jan 3, 2022 at 10:17 PM Jiri Slaby <jirislaby@...nel.org> wrote:
>
> On 03. 01. 22, 16:15, Arnaldo Carvalho de Melo wrote:
> > Tried reproducing here on fedora 34 but it is at 1.1.1:
>
> FWIW, it's openSUSE Tumbleweed:
> $ rpm -q libtraceevent1
> libtraceevent1-1.3.0-1.3.x86_64

I was able to reproduce in an opensuse tumbleweed container.

$ pkg-config --modversion libtraceevent
1.3.0

$ make -C tools/perf O=/tmp/perf V=1 LIBTRACEEVENT_DYNAMIC=1
...
util/debug.c:245:34: error: 'TEP_LOG_DEBUG' undeclared (first use in
this function)
  245 |                 tep_set_loglevel(TEP_LOG_DEBUG);
      |                                  ^~~~~~~~~~~~~
util/debug.c:247:34: error: 'TEP_LOG_ALL' undeclared (first use in
this function)
  247 |                 tep_set_loglevel(TEP_LOG_ALL);
      |                                  ^~~~~~~~~~~

When I look at libtraceevent tagged as 1.3.0 I see TEP_LOG_ALL and
TEP_LOG_DEBUG:
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/tree/src/event-parse.h?h=libtraceevent-1.3.0#n760

and checking opensuse's event-parse.h I see the values there. This
makes it look like we're using the kernel libtraceevent header file
(version 1.1.0) rather than the system one.

The command line is:

gcc -Wp,-MD,/tmp/perf/util/.debug.o.d -Wp,-MT,/tmp/perf/util/debug.o
-Wbad-function-cast -Wdeclaration-after-statement -Wformat-security
-Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes
-Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls
-Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef
-Wwrite-strings -Wformat -Wno-type-limits -Wstrict-aliasing=3 -Wshadow
-DHAVE_SYSCALL_TABLE_SUPPORT -DHAVE_ARCH_X86_64_SUPPORT
-I/tmp/perf/arch/x86/include/generated -DHAVE_PERF_REGS_SUPPORT
-DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -Werror -O6
-fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra
-std=gnu99 -fstack-protector-all -D_FORTIFY_SOURCE=2
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-I/kernel-src/tools/lib/perf/include
-I/kernel-src/tools/perf/util/include
-I/kernel-src/tools/perf/arch/x86/include -I/kernel-src/tools/include/
-I/kernel-src/tools/arch/x86/include/uapi
-I/kernel-src/tools/include/uapi -I/kernel-src/tools/arch/x86/include/
-I/kernel-src/tools/arch/x86/ -I/tmp/perf//util -I/tmp/perf/
-I/kernel-src/tools/perf/util -I/kernel-src/tools/perf
-I/kernel-src/tools/lib/ -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
-DHAVE_PTHREAD_BARRIER -DHAVE_EVENTFD_SUPPORT
-DHAVE_GET_CURRENT_DIR_NAME -DHAVE_GETTID -DHAVE_FILE_HANDLE
-DHAVE_GLIBC_SUPPORT -DHAVE_AIO_SUPPORT -DHAVE_SCHED_GETCPU_SUPPORT
-DHAVE_SETNS_SUPPORT -DHAVE_LIBELF_SUPPORT
-DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_GELF_GETNOTE_SUPPORT
-DHAVE_ELF_GETSHDRSTRNDX_SUPPORT -DHAVE_LIBBPF_SUPPORT -DHAVE_JITDUMP
-DHAVE_LIBPERL_SUPPORT -DHAVE_TIMERFD_SUPPORT -DNO_LIBPYTHON
-DNO_DEMANGLE -DHAVE_ZLIB_SUPPORT -DHAVE_BACKTRACE_SUPPORT
-DHAVE_KVM_STAT_SUPPORT -DHAVE_AUXTRACE_SUPPORT
-DLIBTRACEEVENT_VERSION=65790 -I/tmp/perf/ -D"BUILD_STR(s)=#s" -c -o
/tmp/perf/util/debug.o util/debug.c

The #include is:
#include <traceevent/event-parse.h>

The system header is at:
/usr/include/traceevent/event-parse.h
The kernel one is at /kernel-src/tools/lib/traceevent/event-parse.h.
Adding a #error to that confirms it is indeed being picked up.

Checking with:
https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
it is true from case 3 that -I:
3. Directories specified with -I options are scanned in left-to-right order.
has priority over system:
4. Directories specified with -isystem options are scanned in
left-to-right order.
5. Standard system directories are scanned.

Which means we need to lower the priority of
/kernel-src/tools/lib/traceevent or raise the priority of
/usr/include/traceevent/. I thought I might be able to hack this with
EXTRA_CFLAGS="-I/usr/include"
but it still fails even though the -I is by my reading on the left of tools/lib:

gcc -Wp,-MD,/tmp/perf/util/.debug.o.d -Wp,-MT,/tmp/perf/util/debug.o
-I/usr/include -Wbad-function-cast -Wdeclaration-after-statement
-Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations
-Wmissing-prototypes -Wno-system-headers -Wold-style-definition
-Wpacked -Wredundant-decls -Wstrict-prototypes -Wswitch-default
-Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wno-type-limits
-Wstrict-aliasing=3 -Wshadow -DHAVE_SYSCALL_TABLE_SUPPORT
-DHAVE_ARCH_X86_64_SUPPORT -I/tmp/perf/arch/x86/include/generated
-DHAVE_PERF_REGS_SUPPORT -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
-Werror -O6 -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall
-Wextra -std=gnu99 -fstack-protector-all -D_FORTIFY_SOURCE=2
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-I/kernel-src/tools/lib/perf/include
-I/kernel-src/tools/perf/util/include
-I/kernel-src/tools/perf/arch/x86/include -I/kernel-src/tools/include/
-I/kernel-src/tools/arch/x86/include/uapi
-I/kernel-src/tools/include/uapi -I/kernel-src/tools/arch/x86/include/
-I/kernel-src/tools/arch/x86/ -I/tmp/perf//util -I/tmp/perf/
-I/kernel-src/tools/perf/util -I/kernel-src/tools/perf
-I/kernel-src/tools/lib/ -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
-DHAVE_PTHREAD_BARRIER -DHAVE_EVENTFD_SUPPORT
-DHAVE_GET_CURRENT_DIR_NAME -DHAVE_GETTID -DHAVE_FILE_HANDLE
-DHAVE_GLIBC_SUPPORT -DHAVE_AIO_SUPPORT -DHAVE_SCHED_GETCPU_SUPPORT
-DHAVE_SETNS_SUPPORT -DHAVE_LIBELF_SUPPORT
-DHAVE_ELF_GETPHDRNUM_SUPPORT -DHAVE_GELF_GETNOTE_SUPPORT
-DHAVE_ELF_GETSHDRSTRNDX_SUPPORT -DHAVE_LIBBPF_SUPPORT -DHAVE_JITDUMP
-DHAVE_LIBPERL_SUPPORT -DHAVE_TIMERFD_SUPPORT -DNO_LIBPYTHON
-DNO_DEMANGLE -DHAVE_ZLIB_SUPPORT -DHAVE_BACKTRACE_SUPPORT
-DHAVE_KVM_STAT_SUPPORT -DHAVE_AUXTRACE_SUPPORT
-DLIBTRACEEVENT_VERSION=65790 -I/tmp/perf/ -D"BUILD_STR(s)=#s" -c -o
/tmp/perf/util/debug.o util/debug.c

Probably some sysroot related magic. Anyway, doing this 1 line fix
solves it for me:
-----
$ git diff
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 96ad944ca6a8..0627286380fa 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -346,7 +346,7 @@ endif

 INC_FLAGS += -I$(src-perf)/util
 INC_FLAGS += -I$(src-perf)
-INC_FLAGS += -I$(srctree)/tools/lib/
+INC_FLAGS += -idirafter$(srctree)/tools/lib/

 CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 -----

I'll send out a patch.

Sorry for the trouble. Thanks,
Ian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ