Following the build fixes for bpftool [1], here are a few fixes for
cross-building the sefltests out of tree. This will enable wider
automated testing on various Arm hardware.
[1] https://lore.kernel.org/bpf/20201110164310.2600671-1-jean-philippe@linaro.o…
Jean-Philippe Brucker (5):
selftests/bpf: Enable cross-building
selftests/bpf: Fix out-of-tree build
selftests/bpf: Move generated test files to $(TEST_GEN_FILES)
selftests/bpf: Fix installation of urandom_read
selftests/bpf: Install btf_dump test cases
tools/testing/selftests/bpf/Makefile | 61 +++++++++++++++++++++-------
1 file changed, 46 insertions(+), 15 deletions(-)
--
2.30.0
The BPF Type Format (BTF) can be used in conjunction with the helper
bpf_snprintf_btf() to display kernel data with type information.
This series generalizes that support and shares it with libbpf so
that libbpf can display typed data. BTF display functionality is
factored out of kernel/bpf/btf.c into kernel/bpf/btf_show_common.c,
and that file is duplicated in tools/lib/bpf. Similarly, common
definitions and inline functions needed for this support are
extracted into include/linux/btf_common.h and this header is again
duplicated in tools/lib/bpf.
Patch 1 carries out the refactoring, for which no kernel changes
are intended, and introduces btf__snprintf() a libbpf function
that supports dumping a string representation of typed data using
the struct btf * and id associated with that type.
Patch 2 tests btf__snprintf() with built-in and kernel types to
ensure data is of expected format. The test closely mirrors
the BPF program associated with the snprintf_btf.c; in this case
however the string representations are verified in userspace rather
than in BPF program context.
Alan Maguire (2):
bpf: share BTF "show" implementation between kernel and libbpf
selftests/bpf: test libbpf-based type display
include/linux/btf.h | 121 +-
include/linux/btf_common.h | 286 +++++
kernel/bpf/Makefile | 2 +-
kernel/bpf/arraymap.c | 1 +
kernel/bpf/bpf_struct_ops.c | 1 +
kernel/bpf/btf.c | 1215 +------------------
kernel/bpf/btf_show_common.c | 1218 ++++++++++++++++++++
kernel/bpf/core.c | 1 +
kernel/bpf/hashtab.c | 1 +
kernel/bpf/local_storage.c | 1 +
kernel/bpf/verifier.c | 1 +
kernel/trace/bpf_trace.c | 1 +
tools/lib/bpf/Build | 2 +-
tools/lib/bpf/btf.h | 7 +
tools/lib/bpf/btf_common.h | 286 +++++
tools/lib/bpf/btf_show_common.c | 1218 ++++++++++++++++++++
tools/lib/bpf/libbpf.map | 1 +
.../selftests/bpf/prog_tests/snprintf_btf_user.c | 192 +++
18 files changed, 3236 insertions(+), 1319 deletions(-)
create mode 100644 include/linux/btf_common.h
create mode 100644 kernel/bpf/btf_show_common.c
create mode 100644 tools/lib/bpf/btf_common.h
create mode 100644 tools/lib/bpf/btf_show_common.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/snprintf_btf_user.c
--
1.8.3.1
If a signed number field starts with a '-' the field width must be > 1,
or unlimited, to allow at least one digit after the '-'.
This patch adds a check for this. If a signed field starts with '-'
and field_width == 1 the scanf will quit.
It is ok for a signed number field to have a field width of 1 if it
starts with a digit. In that case the single digit can be converted.
Signed-off-by: Richard Fitzgerald <rf(a)opensource.cirrus.com>
---
lib/vsprintf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 14c9a6af1b23..8954ff94a53c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3433,8 +3433,12 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
str = skip_spaces(str);
digit = *str;
- if (is_sign && digit == '-')
+ if (is_sign && digit == '-') {
+ if (field_width == 1)
+ break;
+
digit = *(str + 1);
+ }
if (!digit
|| (base == 16 && !isxdigit(digit))
--
2.20.1
Hi Linus,
Please pull the following KUnit fixes update for Linux 5.11-rc3.
This kunit update for Linux 5.11-rc3 consists one fix to force the use
of the 'tty' console for UML. Given that kunit tool requires the console
output, explicitly stating the dependency makes sense than relying on
it being the default.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62:
Linux 5.11-rc2 (2021-01-03 15:55:30 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-kunit-fixes-5.11-rc3
for you to fetch changes up to 65a4e5299739abe0888cda0938d21f8ea3b5c606:
kunit: tool: Force the use of the 'tty' console for UML (2021-01-04
09:18:38 -0700)
----------------------------------------------------------------
linux-kselftest-kunit-fixes-5.11-rc3
This kunit update for Linux 5.11-rc3 consists one fix to force the use
of the 'tty' console for UML. Given that kunit tool requires the console
output, explicitly stating the dependency makes sense than relying on
it being the default.
----------------------------------------------------------------
David Gow (1):
kunit: tool: Force the use of the 'tty' console for UML
tools/testing/kunit/kunit_kernel.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------
Hi Linus,
Please pull the following fixes update for Linux 5.11-rc3.
This fixes update for 5.11-rc3 consists of two minor fixes to vDSO test
changes in 5.11-rc1 update.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62:
Linux 5.11-rc2 (2021-01-03 15:55:30 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-next-5.11-rc3
for you to fetch changes up to df00d02989024d193a6efd1a85513a5658c6a10f:
selftests/vDSO: fix -Wformat warning in vdso_test_correctness
(2021-01-04 09:25:45 -0700)
----------------------------------------------------------------
linux-kselftest-next-5.11-rc3
This fixes update for 5.11-rc3 consists of two minor fixes to vDSO test
changes in 5.11-rc1 update.
----------------------------------------------------------------
Tobias Klauser (2):
selftests/vDSO: add additional binaries to .gitignore
selftests/vDSO: fix -Wformat warning in vdso_test_correctness
tools/testing/selftests/vDSO/.gitignore | 3 +++
tools/testing/selftests/vDSO/vdso_test_correctness.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------