License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-10-02 21:21:37 +07:00
|
|
|
/*
|
|
|
|
* test-all.c: Try to build all the main testcases at once.
|
|
|
|
*
|
|
|
|
* A well-configured system will have all the prereqs installed, so we can speed
|
|
|
|
* up auto-detection on such systems.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Quirk: Python and Perl headers cannot be in arbitrary places, so keep
|
|
|
|
* these 3 testcases at the top:
|
|
|
|
*/
|
|
|
|
#define main main_test_libpython
|
|
|
|
# include "test-libpython.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libpython_version
|
|
|
|
# include "test-libpython-version.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libperl
|
|
|
|
# include "test-libperl.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_hello
|
|
|
|
# include "test-hello.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libelf
|
|
|
|
# include "test-libelf.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libelf_mmap
|
|
|
|
# include "test-libelf-mmap.c"
|
|
|
|
#undef main
|
|
|
|
|
2018-11-20 02:56:22 +07:00
|
|
|
#define main main_test_get_current_dir_name
|
|
|
|
# include "test-get_current_dir_name.c"
|
|
|
|
#undef main
|
|
|
|
|
2019-06-13 22:04:19 +07:00
|
|
|
#define main main_test_gettid
|
|
|
|
# include "test-gettid.c"
|
|
|
|
#undef main
|
|
|
|
|
2013-10-02 21:21:37 +07:00
|
|
|
#define main main_test_glibc
|
|
|
|
# include "test-glibc.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_dwarf
|
|
|
|
# include "test-dwarf.c"
|
|
|
|
#undef main
|
|
|
|
|
2016-04-05 21:33:41 +07:00
|
|
|
#define main main_test_dwarf_getlocations
|
|
|
|
# include "test-dwarf_getlocations.c"
|
|
|
|
#undef main
|
|
|
|
|
2018-11-22 03:42:00 +07:00
|
|
|
#define main main_test_eventfd
|
|
|
|
# include "test-eventfd.c"
|
|
|
|
#undef main
|
|
|
|
|
2013-10-02 21:21:37 +07:00
|
|
|
#define main main_test_libelf_getphdrnum
|
|
|
|
# include "test-libelf-getphdrnum.c"
|
|
|
|
#undef main
|
|
|
|
|
2016-07-12 22:19:09 +07:00
|
|
|
#define main main_test_libelf_gelf_getnote
|
|
|
|
# include "test-libelf-gelf_getnote.c"
|
|
|
|
#undef main
|
|
|
|
|
2016-07-05 05:35:47 +07:00
|
|
|
#define main main_test_libelf_getshdrstrndx
|
|
|
|
# include "test-libelf-getshdrstrndx.c"
|
|
|
|
#undef main
|
|
|
|
|
2013-10-02 21:21:37 +07:00
|
|
|
#define main main_test_libunwind
|
|
|
|
# include "test-libunwind.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libaudit
|
|
|
|
# include "test-libaudit.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libslang
|
|
|
|
# include "test-libslang.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_gtk2
|
|
|
|
# include "test-gtk2.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_gtk2_infobar
|
|
|
|
# include "test-gtk2-infobar.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libbfd
|
|
|
|
# include "test-libbfd.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_backtrace
|
|
|
|
# include "test-backtrace.c"
|
|
|
|
#undef main
|
|
|
|
|
|
|
|
#define main main_test_libnuma
|
|
|
|
# include "test-libnuma.c"
|
|
|
|
#undef main
|
2013-10-01 19:14:31 +07:00
|
|
|
|
2015-09-17 22:20:28 +07:00
|
|
|
#define main main_test_numa_num_possible_cpus
|
|
|
|
# include "test-numa_num_possible_cpus.c"
|
|
|
|
#undef main
|
|
|
|
|
2013-10-29 23:43:16 +07:00
|
|
|
#define main main_test_timerfd
|
|
|
|
# include "test-timerfd.c"
|
|
|
|
#undef main
|
|
|
|
|
2013-11-28 18:33:01 +07:00
|
|
|
#define main main_test_stackprotector_all
|
|
|
|
# include "test-stackprotector-all.c"
|
|
|
|
#undef main
|
|
|
|
|
2014-02-19 22:52:56 +07:00
|
|
|
#define main main_test_libdw_dwarf_unwind
|
|
|
|
# include "test-libdw-dwarf-unwind.c"
|
|
|
|
#undef main
|
|
|
|
|
2014-07-14 17:02:53 +07:00
|
|
|
#define main main_test_sync_compare_and_swap
|
|
|
|
# include "test-sync-compare-and-swap.c"
|
|
|
|
#undef main
|
|
|
|
|
perf tools: Add gzip decompression support for kernel module
Now my Archlinux box shows module symbols correctly.
Before:
$ perf report --stdio
Failed to open /tmp/perf-3477.map, continuing without symbols
no symbols found in /usr/bin/date, maybe install a debug package?
No kallsyms or vmlinux with build-id 7b4ea0a49ae2111925857099aaf05c3246ff33e0 was found
[drm] with build id 7b4ea0a49ae2111925857099aaf05c3246ff33e0 not found, continuing without symbols
No kallsyms or vmlinux with build-id edd931629094b660ca9dec09a1b635c8d87aa2ee was found
[jbd2] with build id edd931629094b660ca9dec09a1b635c8d87aa2ee not found, continuing without symbols
No kallsyms or vmlinux with build-id a7b1eada671c34933e5610bb920b2ca4945a82c3 was found
[ext4] with build id a7b1eada671c34933e5610bb920b2ca4945a82c3 not found, continuing without symbols
No kallsyms or vmlinux with build-id d69511fa3e5840e770336ef45b06c83fef8d74e3 was found
[scsi_mod] with build id d69511fa3e5840e770336ef45b06c83fef8d74e3 not found, continuing without symbols
No kallsyms or vmlinux with build-id af0430af13461af058770ee9b87afc07922c2e77 was found
[libata] with build id af0430af13461af058770ee9b87afc07922c2e77 not found, continuing without symbols
No kallsyms or vmlinux with build-id aaeedff8160ce631a5f0333591c6ff291201d29f was found
[libahci] with build id aaeedff8160ce631a5f0333591c6ff291201d29f not found, continuing without symbols
No kallsyms or vmlinux with build-id c57907712becaf662dc4981824bb372c0441d605 was found
[mac80211] with build id c57907712becaf662dc4981824bb372c0441d605 not found, continuing without symbols
No kallsyms or vmlinux with build-id e0589077cc0ec8c3e4c40eb9f2d9e69d236bee8f was found
[iwldvm] with build id e0589077cc0ec8c3e4c40eb9f2d9e69d236bee8f not found, continuing without symbols
No kallsyms or vmlinux with build-id 2d86086bf136bf374a2f029cf85a48194f9b950b was found
[cfg80211] with build id 2d86086bf136bf374a2f029cf85a48194f9b950b not found, continuing without symbols
No kallsyms or vmlinux with build-id 4493c48599bdb3d91d0f8db5150e0be33fdd9221 was found
[iwlwifi] with build id 4493c48599bdb3d91d0f8db5150e0be33fdd9221 not found, continuing without symbols
...
#
# Overhead Command Shared Object Symbol
# ........ ............... ....................... ........................................................
#
0.03% swapper [ext4] [k] 0x000000000000fe2e
0.03% swapper [kernel.kallsyms] [k] account_entity_enqueue
0.03% swapper [ext4] [k] 0x000000000000fc2b
0.03% irq/50-iwlwifi [iwlwifi] [k] 0x000000000000200b
0.03% swapper [kernel.kallsyms] [k] ktime_add_safe
0.03% swapper [kernel.kallsyms] [k] elv_completed_request
0.03% swapper [libata] [k] 0x0000000000003997
0.03% swapper [libahci] [k] 0x0000000000001f25
0.03% swapper [kernel.kallsyms] [k] rb_next
0.03% swapper [kernel.kallsyms] [k] blk_finish_request
0.03% swapper [ext4] [k] 0x0000000000010248
0.00% perf [kernel.kallsyms] [k] native_write_msr_safe
After:
$ perf report --stdio
Failed to open /tmp/perf-3477.map, continuing without symbols
no symbols found in /usr/bin/tr, maybe install a debug package?
...
#
# Overhead Command Shared Object Symbol
# ........ ............... ........................... ......................................................
#
0.04% kworker/u16:3 [ext4] [k] ext4_read_block_bitmap
0.03% kworker/u16:0 [mac80211] [k] ieee80211_sta_reset_beacon_monitor
0.02% irq/50-iwlwifi [mac80211] [k] ieee80211_get_bssid
0.02% firefox [e1000e] [k] __ew32_prepare
0.02% swapper [libahci] [k] ahci_handle_port_interrupt
0.02% emacs libglib-2.0.so.0.4000.0 [.] g_mutex_unlock
0.02% swapper [e1000e] [k] e1000_clean_tx_irq
0.02% dwm [kernel.kallsyms] [k] __schedule
0.02% gnome-terminal- [vdso] [.] __vdso_clock_gettime
0.02% swapper [e1000e] [k] e1000_alloc_rx_buffers
0.02% irq/50-iwlwifi [mac80211] [k] ieee80211_rx
0.01% firefox [vdso] [.] __vdso_gettimeofday
0.01% irq/50-iwlwifi [iwlwifi] [k] iwl_pcie_rxq_restock.part.13
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/87h9yexshi.fsf@sejong.aot.lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-10-31 14:51:38 +07:00
|
|
|
#define main main_test_zlib
|
|
|
|
# include "test-zlib.c"
|
|
|
|
#undef main
|
|
|
|
|
2015-01-13 20:43:24 +07:00
|
|
|
#define main main_test_pthread_attr_setaffinity_np
|
2015-03-11 15:02:00 +07:00
|
|
|
# include "test-pthread-attr-setaffinity-np.c"
|
2015-01-13 20:43:24 +07:00
|
|
|
#undef main
|
|
|
|
|
2017-12-05 20:14:42 +07:00
|
|
|
#define main main_test_pthread_barrier
|
|
|
|
# include "test-pthread-barrier.c"
|
|
|
|
#undef main
|
|
|
|
|
2017-03-02 22:55:49 +07:00
|
|
|
#define main main_test_sched_getcpu
|
|
|
|
# include "test-sched_getcpu.c"
|
|
|
|
#undef main
|
|
|
|
|
2015-03-11 15:00:41 +07:00
|
|
|
# if 0
|
|
|
|
/*
|
|
|
|
* Disable libbabeltrace check for test-all, because the requested
|
|
|
|
* library version is not released yet in most distributions. Will
|
|
|
|
* reenable later.
|
|
|
|
*/
|
|
|
|
|
2015-02-21 05:16:58 +07:00
|
|
|
#define main main_test_libbabeltrace
|
|
|
|
# include "test-libbabeltrace.c"
|
|
|
|
#undef main
|
2015-03-11 15:00:41 +07:00
|
|
|
#endif
|
2015-02-21 05:16:58 +07:00
|
|
|
|
2015-03-04 17:35:47 +07:00
|
|
|
#define main main_test_lzma
|
|
|
|
# include "test-lzma.c"
|
|
|
|
#undef main
|
|
|
|
|
2015-09-17 22:54:30 +07:00
|
|
|
#define main main_test_get_cpuid
|
|
|
|
# include "test-get_cpuid.c"
|
|
|
|
#undef main
|
|
|
|
|
2016-01-11 20:48:01 +07:00
|
|
|
#define main main_test_bpf
|
|
|
|
# include "test-bpf.c"
|
|
|
|
#undef main
|
|
|
|
|
2015-11-30 16:02:21 +07:00
|
|
|
#define main main_test_libcrypto
|
|
|
|
# include "test-libcrypto.c"
|
|
|
|
#undef main
|
|
|
|
|
2016-07-12 17:05:56 +07:00
|
|
|
#define main main_test_sdt
|
|
|
|
# include "test-sdt.c"
|
|
|
|
#undef main
|
|
|
|
|
2017-07-19 03:15:29 +07:00
|
|
|
#define main main_test_setns
|
|
|
|
# include "test-setns.c"
|
|
|
|
#undef main
|
|
|
|
|
2018-11-06 16:03:35 +07:00
|
|
|
#define main main_test_libaio
|
|
|
|
# include "test-libaio.c"
|
|
|
|
#undef main
|
|
|
|
|
tools build: Add test-reallocarray.c to test-all.c to fix the build
When a test is in the FEATURE_TESTS_BASIC list in tools/build/Makefile.feature
must be added to tools/build/feature/test-all.c, because the successfull
compilation and linking of that test-all.bin file means that all the
features listed in FEATURE_TESTS_BASIC are present in the system, so we
don't have to go on feature by feature test building them.
Since reallocarray() is expected to be present in modern systems, it has
a place in FEATURE_TESTS_BASIC, so that we speed up the build process
building just that file.
For older systems, such as ubuntu:16.04 (build failure reported by Jin
Yao) debian:8, and for the current flagship RHEL distro, RHEL7, the
build will fail as test-all.bin (without test-reallocarray.c included)
passes but reallocarray() isn't present, making the build fail with:
CC /tmp/build/perf/libbpf.o
MKDIR /tmp/build/perf/fs/
CC /tmp/build/perf/fs/tracing_path.o
LD /tmp/build/perf/fd/libapi-in.o
CC /tmp/build/perf/bpf.o
libbpf.c: In function 'bpf_object__add_program':
libbpf.c:367:10: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:2: error: nested extern declaration of 'reallocarray' [-Werror=nested-externs]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:8: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c: In function 'bpf_object__elf_collect':
libbpf.c:887:10: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
reloc = reallocarray(reloc, nr_reloc,
^
libbpf.c: In function 'bpf_program__reloc_text':
libbpf.c:1394:12: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
new_insn = reallocarray(prog->insns, new_cnt, sizeof(*insn));
^
CC /tmp/build/perf/nlattr.o
Even with:
$ grep reallocarray /tmp/build/perf/FEATURE-DUMP
feature-reallocarray=1
$
Which ubuntu:16.04.5 LTS doesn't have:
perfbuilder@38a153a1bba8:/$ head -2 /etc/os-release
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
perfbuilder@38a153a1bba8:/$ find /usr/include/ -name "*.h" | xargs grep -w reallocarray
perfbuilder@38a153a1bba8:/$
Fix it by including it to test-all.c, which ends up forcing the
individual tests to be triggered and for the build process to notice
that indeed reallocarray() is not there:
perfbuilder@38a153a1bba8:/$ cat /tmp/build/perf/feature/test-all.make.output
In file included from test-all.c:178:0:
test-reallocarray.c: In function 'main_test_reallocarray':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/$
That is the only test that is failing on Ubuntu 16.03.5 LTS, so all
tests are forced:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ ls -lSr *.make.output
<SNIP successful tests>
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-dwarf.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 14:16 test-cplus-demangle.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-bpf.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-backtrace.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 104 Feb 14 15:00 test-bionic.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 107 Feb 14 15:00 test-libunwind-x86.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 115 Feb 14 15:00 test-libunwind-aarch64.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 122 Feb 14 15:00 test-libbabeltrace.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 254 Feb 14 15:00 test-reallocarray.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 312 Feb 14 15:00 test-all.make.output
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$
And that reallocarray() one shows:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ cat test-reallocarray.make.output
test-reallocarray.c: In function 'main':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$
Which now generates the expected result:
perfbuilder@38a153a1bba8:~$ grep reallocarray /tmp/build/perf/FEATURE-DUMP
feature-reallocarray=0
perfbuilder@38a153a1bba8:~$
The fallback mechanism kicks in and libbpf and perf are again buildable
in systems without reallocarray():
$ cat tools/include/tools/libc_compat.h
// SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
/* Copyright (C) 2018 Netronome Systems, Inc. */
#ifndef __TOOLS_LIBC_COMPAT_H
#define __TOOLS_LIBC_COMPAT_H
#include <stdlib.h>
#include <linux/overflow.h>
#ifdef COMPAT_NEED_REALLOCARRAY
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
{
size_t bytes;
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
return NULL;
return realloc(ptr, bytes);
}
#endif
#endif
$
Reported-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Fixes: 531b014e7a2f ("tools: bpf: make use of reallocarray")
Link: https://lkml.kernel.org/n/tip-aonqku8axii8rxki5g11w40b@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-14 22:01:04 +07:00
|
|
|
#define main main_test_reallocarray
|
|
|
|
# include "test-reallocarray.c"
|
|
|
|
#undef main
|
|
|
|
|
2019-03-12 12:30:48 +07:00
|
|
|
#define main main_test_disassembler_four_args
|
|
|
|
# include "test-disassembler-four-args.c"
|
|
|
|
#undef main
|
|
|
|
|
2019-06-19 03:59:16 +07:00
|
|
|
#define main main_test_libzstd
|
2019-03-19 00:39:49 +07:00
|
|
|
# include "test-libzstd.c"
|
|
|
|
#undef main
|
|
|
|
|
2013-10-01 19:14:31 +07:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2013-10-02 21:21:37 +07:00
|
|
|
main_test_libpython();
|
|
|
|
main_test_libpython_version();
|
|
|
|
main_test_libperl();
|
|
|
|
main_test_hello();
|
|
|
|
main_test_libelf();
|
|
|
|
main_test_libelf_mmap();
|
2018-11-20 02:56:22 +07:00
|
|
|
main_test_get_current_dir_name();
|
2019-06-13 22:04:19 +07:00
|
|
|
main_test_gettid();
|
2013-10-02 21:21:37 +07:00
|
|
|
main_test_glibc();
|
|
|
|
main_test_dwarf();
|
2016-04-05 21:33:41 +07:00
|
|
|
main_test_dwarf_getlocations();
|
2018-11-22 03:42:00 +07:00
|
|
|
main_test_eventfd();
|
2013-10-02 21:21:37 +07:00
|
|
|
main_test_libelf_getphdrnum();
|
2016-07-12 22:19:09 +07:00
|
|
|
main_test_libelf_gelf_getnote();
|
2016-07-05 05:35:47 +07:00
|
|
|
main_test_libelf_getshdrstrndx();
|
2013-10-02 21:21:37 +07:00
|
|
|
main_test_libunwind();
|
|
|
|
main_test_libaudit();
|
|
|
|
main_test_libslang();
|
|
|
|
main_test_gtk2(argc, argv);
|
|
|
|
main_test_gtk2_infobar(argc, argv);
|
|
|
|
main_test_libbfd();
|
|
|
|
main_test_backtrace();
|
|
|
|
main_test_libnuma();
|
2015-09-17 22:20:28 +07:00
|
|
|
main_test_numa_num_possible_cpus();
|
2013-10-29 23:43:16 +07:00
|
|
|
main_test_timerfd();
|
2013-11-28 18:33:01 +07:00
|
|
|
main_test_stackprotector_all();
|
2014-02-19 22:52:56 +07:00
|
|
|
main_test_libdw_dwarf_unwind();
|
2014-07-14 17:02:53 +07:00
|
|
|
main_test_sync_compare_and_swap(argc, argv);
|
perf tools: Add gzip decompression support for kernel module
Now my Archlinux box shows module symbols correctly.
Before:
$ perf report --stdio
Failed to open /tmp/perf-3477.map, continuing without symbols
no symbols found in /usr/bin/date, maybe install a debug package?
No kallsyms or vmlinux with build-id 7b4ea0a49ae2111925857099aaf05c3246ff33e0 was found
[drm] with build id 7b4ea0a49ae2111925857099aaf05c3246ff33e0 not found, continuing without symbols
No kallsyms or vmlinux with build-id edd931629094b660ca9dec09a1b635c8d87aa2ee was found
[jbd2] with build id edd931629094b660ca9dec09a1b635c8d87aa2ee not found, continuing without symbols
No kallsyms or vmlinux with build-id a7b1eada671c34933e5610bb920b2ca4945a82c3 was found
[ext4] with build id a7b1eada671c34933e5610bb920b2ca4945a82c3 not found, continuing without symbols
No kallsyms or vmlinux with build-id d69511fa3e5840e770336ef45b06c83fef8d74e3 was found
[scsi_mod] with build id d69511fa3e5840e770336ef45b06c83fef8d74e3 not found, continuing without symbols
No kallsyms or vmlinux with build-id af0430af13461af058770ee9b87afc07922c2e77 was found
[libata] with build id af0430af13461af058770ee9b87afc07922c2e77 not found, continuing without symbols
No kallsyms or vmlinux with build-id aaeedff8160ce631a5f0333591c6ff291201d29f was found
[libahci] with build id aaeedff8160ce631a5f0333591c6ff291201d29f not found, continuing without symbols
No kallsyms or vmlinux with build-id c57907712becaf662dc4981824bb372c0441d605 was found
[mac80211] with build id c57907712becaf662dc4981824bb372c0441d605 not found, continuing without symbols
No kallsyms or vmlinux with build-id e0589077cc0ec8c3e4c40eb9f2d9e69d236bee8f was found
[iwldvm] with build id e0589077cc0ec8c3e4c40eb9f2d9e69d236bee8f not found, continuing without symbols
No kallsyms or vmlinux with build-id 2d86086bf136bf374a2f029cf85a48194f9b950b was found
[cfg80211] with build id 2d86086bf136bf374a2f029cf85a48194f9b950b not found, continuing without symbols
No kallsyms or vmlinux with build-id 4493c48599bdb3d91d0f8db5150e0be33fdd9221 was found
[iwlwifi] with build id 4493c48599bdb3d91d0f8db5150e0be33fdd9221 not found, continuing without symbols
...
#
# Overhead Command Shared Object Symbol
# ........ ............... ....................... ........................................................
#
0.03% swapper [ext4] [k] 0x000000000000fe2e
0.03% swapper [kernel.kallsyms] [k] account_entity_enqueue
0.03% swapper [ext4] [k] 0x000000000000fc2b
0.03% irq/50-iwlwifi [iwlwifi] [k] 0x000000000000200b
0.03% swapper [kernel.kallsyms] [k] ktime_add_safe
0.03% swapper [kernel.kallsyms] [k] elv_completed_request
0.03% swapper [libata] [k] 0x0000000000003997
0.03% swapper [libahci] [k] 0x0000000000001f25
0.03% swapper [kernel.kallsyms] [k] rb_next
0.03% swapper [kernel.kallsyms] [k] blk_finish_request
0.03% swapper [ext4] [k] 0x0000000000010248
0.00% perf [kernel.kallsyms] [k] native_write_msr_safe
After:
$ perf report --stdio
Failed to open /tmp/perf-3477.map, continuing without symbols
no symbols found in /usr/bin/tr, maybe install a debug package?
...
#
# Overhead Command Shared Object Symbol
# ........ ............... ........................... ......................................................
#
0.04% kworker/u16:3 [ext4] [k] ext4_read_block_bitmap
0.03% kworker/u16:0 [mac80211] [k] ieee80211_sta_reset_beacon_monitor
0.02% irq/50-iwlwifi [mac80211] [k] ieee80211_get_bssid
0.02% firefox [e1000e] [k] __ew32_prepare
0.02% swapper [libahci] [k] ahci_handle_port_interrupt
0.02% emacs libglib-2.0.so.0.4000.0 [.] g_mutex_unlock
0.02% swapper [e1000e] [k] e1000_clean_tx_irq
0.02% dwm [kernel.kallsyms] [k] __schedule
0.02% gnome-terminal- [vdso] [.] __vdso_clock_gettime
0.02% swapper [e1000e] [k] e1000_alloc_rx_buffers
0.02% irq/50-iwlwifi [mac80211] [k] ieee80211_rx
0.01% firefox [vdso] [.] __vdso_gettimeofday
0.01% irq/50-iwlwifi [iwlwifi] [k] iwl_pcie_rxq_restock.part.13
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/87h9yexshi.fsf@sejong.aot.lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-10-31 14:51:38 +07:00
|
|
|
main_test_zlib();
|
2015-01-13 20:43:24 +07:00
|
|
|
main_test_pthread_attr_setaffinity_np();
|
2017-12-05 20:14:42 +07:00
|
|
|
main_test_pthread_barrier();
|
2015-03-04 17:35:47 +07:00
|
|
|
main_test_lzma();
|
2015-09-17 22:54:30 +07:00
|
|
|
main_test_get_cpuid();
|
2016-01-11 20:48:01 +07:00
|
|
|
main_test_bpf();
|
2015-11-30 16:02:21 +07:00
|
|
|
main_test_libcrypto();
|
2017-03-02 22:55:49 +07:00
|
|
|
main_test_sched_getcpu();
|
2016-07-12 17:05:56 +07:00
|
|
|
main_test_sdt();
|
2017-07-19 03:15:29 +07:00
|
|
|
main_test_setns();
|
2018-11-06 16:03:35 +07:00
|
|
|
main_test_libaio();
|
tools build: Add test-reallocarray.c to test-all.c to fix the build
When a test is in the FEATURE_TESTS_BASIC list in tools/build/Makefile.feature
must be added to tools/build/feature/test-all.c, because the successfull
compilation and linking of that test-all.bin file means that all the
features listed in FEATURE_TESTS_BASIC are present in the system, so we
don't have to go on feature by feature test building them.
Since reallocarray() is expected to be present in modern systems, it has
a place in FEATURE_TESTS_BASIC, so that we speed up the build process
building just that file.
For older systems, such as ubuntu:16.04 (build failure reported by Jin
Yao) debian:8, and for the current flagship RHEL distro, RHEL7, the
build will fail as test-all.bin (without test-reallocarray.c included)
passes but reallocarray() isn't present, making the build fail with:
CC /tmp/build/perf/libbpf.o
MKDIR /tmp/build/perf/fs/
CC /tmp/build/perf/fs/tracing_path.o
LD /tmp/build/perf/fd/libapi-in.o
CC /tmp/build/perf/bpf.o
libbpf.c: In function 'bpf_object__add_program':
libbpf.c:367:10: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:2: error: nested extern declaration of 'reallocarray' [-Werror=nested-externs]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:8: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c: In function 'bpf_object__elf_collect':
libbpf.c:887:10: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
reloc = reallocarray(reloc, nr_reloc,
^
libbpf.c: In function 'bpf_program__reloc_text':
libbpf.c:1394:12: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
new_insn = reallocarray(prog->insns, new_cnt, sizeof(*insn));
^
CC /tmp/build/perf/nlattr.o
Even with:
$ grep reallocarray /tmp/build/perf/FEATURE-DUMP
feature-reallocarray=1
$
Which ubuntu:16.04.5 LTS doesn't have:
perfbuilder@38a153a1bba8:/$ head -2 /etc/os-release
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
perfbuilder@38a153a1bba8:/$ find /usr/include/ -name "*.h" | xargs grep -w reallocarray
perfbuilder@38a153a1bba8:/$
Fix it by including it to test-all.c, which ends up forcing the
individual tests to be triggered and for the build process to notice
that indeed reallocarray() is not there:
perfbuilder@38a153a1bba8:/$ cat /tmp/build/perf/feature/test-all.make.output
In file included from test-all.c:178:0:
test-reallocarray.c: In function 'main_test_reallocarray':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/$
That is the only test that is failing on Ubuntu 16.03.5 LTS, so all
tests are forced:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ ls -lSr *.make.output
<SNIP successful tests>
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-dwarf.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 14:16 test-cplus-demangle.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-bpf.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-backtrace.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 104 Feb 14 15:00 test-bionic.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 107 Feb 14 15:00 test-libunwind-x86.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 115 Feb 14 15:00 test-libunwind-aarch64.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 122 Feb 14 15:00 test-libbabeltrace.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 254 Feb 14 15:00 test-reallocarray.make.output
-rw-r--r--. 1 perfbuilder perfbuilder 312 Feb 14 15:00 test-all.make.output
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$
And that reallocarray() one shows:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ cat test-reallocarray.make.output
test-reallocarray.c: In function 'main':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$
Which now generates the expected result:
perfbuilder@38a153a1bba8:~$ grep reallocarray /tmp/build/perf/FEATURE-DUMP
feature-reallocarray=0
perfbuilder@38a153a1bba8:~$
The fallback mechanism kicks in and libbpf and perf are again buildable
in systems without reallocarray():
$ cat tools/include/tools/libc_compat.h
// SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
/* Copyright (C) 2018 Netronome Systems, Inc. */
#ifndef __TOOLS_LIBC_COMPAT_H
#define __TOOLS_LIBC_COMPAT_H
#include <stdlib.h>
#include <linux/overflow.h>
#ifdef COMPAT_NEED_REALLOCARRAY
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
{
size_t bytes;
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
return NULL;
return realloc(ptr, bytes);
}
#endif
#endif
$
Reported-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Fixes: 531b014e7a2f ("tools: bpf: make use of reallocarray")
Link: https://lkml.kernel.org/n/tip-aonqku8axii8rxki5g11w40b@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-14 22:01:04 +07:00
|
|
|
main_test_reallocarray();
|
2019-03-12 12:30:48 +07:00
|
|
|
main_test_disassembler_four_args();
|
2019-03-19 00:39:49 +07:00
|
|
|
main_test_libzstd();
|
2013-10-01 19:14:31 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|