This series is just a set of minor tweaks and improvements for the MTE
tests that I did while working on the asymmetric mode support for
userspace which seemed like they might be worth keeping even though the
prctl() for asymmetric mode got removed.
v2:
- Also log PC and fault address on unexpected async faults.
- Remove redundant system_has_mte variable.
Mark Brown (4):
kselftest/arm64: Handle more kselftest result codes in MTE helpers
kselftest/arm64: Log unexpected asynchronous MTE faults
kselftest/arm64: Refactor parameter checking in mte_switch_mode()
kselftest/arm64: Add simple test for MTE prctl
tools/testing/selftests/arm64/mte/.gitignore | 1 +
.../testing/selftests/arm64/mte/check_prctl.c | 119 ++++++++++++++++++
.../selftests/arm64/mte/mte_common_util.c | 19 ++-
.../selftests/arm64/mte/mte_common_util.h | 15 ++-
4 files changed, 149 insertions(+), 5 deletions(-)
create mode 100644 tools/testing/selftests/arm64/mte/check_prctl.c
base-commit: dfd42facf1e4ada021b939b4e19c935dcdd55566
--
2.30.2
Add support for a new kind of kunit_suite registration macro called
kunit_test_init_suite(); this new registration macro allows the
registration of kunit_suites that reference functions marked __init and
data marked __initdata.
Signed-off-by: Brendan Higgins <brendanhiggins(a)google.com>
---
This patch is in response to a KUnit user issue[1] in which the user was
attempting to test some init functions; although this is a functional
solution as long as KUnit tests only run during the init phase, we will
need to do more work if we ever allow tests to run after the init phase
is over; it is for this reason that this patch adds a new registration
macro rather than simply modifying the existing macros.
[1] https://groups.google.com/g/kunit-dev/c/XDjieRHEneg/m/D0rFCwVABgAJ
---
include/kunit/test.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/include/kunit/test.h b/include/kunit/test.h
index b26400731c02..1878e585f6d3 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -379,6 +379,27 @@ static inline int kunit_run_all_tests(void)
#define kunit_test_suite(suite) kunit_test_suites(&suite)
+/**
+ * kunit_test_init_suites() - used to register one or more &struct kunit_suite
+ * containing init functions or init data.
+ *
+ * @__suites: a statically allocated list of &struct kunit_suite.
+ *
+ * This functions identically as &kunit_test_suites() except that it suppresses
+ * modpost warnings for referencing functions marked __init or data marked
+ * __initdata; this is OK because currently KUnit only runs tests upon boot
+ * during the init phase or upon loading a module during the init phase.
+ *
+ * NOTE TO KUNIT DEVS: If we ever allow KUnit tests to be run after boot, these
+ * tests must be excluded.
+ */
+#define kunit_test_init_suites(__suites...) \
+ __kunit_test_suites(CONCATENATE(__UNIQUE_ID(array), _probe), \
+ CONCATENATE(__UNIQUE_ID(suites), _probe), \
+ ##__suites)
+
+#define kunit_test_init_suite(suite) kunit_test_init_suites(&suite)
+
#define kunit_suite_for_each_test_case(suite, test_case) \
for (test_case = suite->test_cases; test_case->run_case; test_case++)
base-commit: 330f4c53d3c2d8b11d86ec03a964b86dc81452f5
--
2.35.1.723.g4982287a31-goog
Extend the interoperability with IMA, to give wider flexibility for the
implementation of integrity-focused LSMs based on eBPF.
Patch 1 fixes some style issues.
Patches 2-6 give the ability to eBPF-based LSMs to take advantage of the
measurement capability of IMA without needing to setup a policy in IMA
(those LSMs might implement the policy capability themselves).
Patches 7-9 allow eBPF-based LSMs to evaluate files read by the kernel.
Changelog
v2:
- Add better description to patch 1 (suggested by Shuah)
- Recalculate digest if it is not fresh (when IMA_COLLECTED flag not set)
- Move declaration of bpf_ima_file_hash() at the end (suggested by
Yonghong)
- Add tests to check if the digest has been recalculated
- Add deny test for bpf_kernel_read_file()
- Add description to tests
v1:
- Modify ima_file_hash() only and allow the usage of the function with the
modified behavior by eBPF-based LSMs through the new function
bpf_ima_file_hash() (suggested by Mimi)
- Make bpf_lsm_kernel_read_file() sleepable so that bpf_ima_inode_hash()
and bpf_ima_file_hash() can be called inside the implementation of
eBPF-based LSMs for this hook
Roberto Sassu (9):
ima: Fix documentation-related warnings in ima_main.c
ima: Always return a file measurement in ima_file_hash()
bpf-lsm: Introduce new helper bpf_ima_file_hash()
selftests/bpf: Move sample generation code to ima_test_common()
selftests/bpf: Add test for bpf_ima_file_hash()
selftests/bpf: Check if the digest is refreshed after a file write
bpf-lsm: Make bpf_lsm_kernel_read_file() as sleepable
selftests/bpf: Add test for bpf_lsm_kernel_read_file()
selftests/bpf: Check that bpf_kernel_read_file() denies reading IMA
policy
include/uapi/linux/bpf.h | 11 ++
kernel/bpf/bpf_lsm.c | 21 +++
security/integrity/ima/ima_main.c | 57 ++++---
tools/include/uapi/linux/bpf.h | 11 ++
tools/testing/selftests/bpf/ima_setup.sh | 35 +++-
.../selftests/bpf/prog_tests/test_ima.c | 149 +++++++++++++++++-
tools/testing/selftests/bpf/progs/ima.c | 66 +++++++-
7 files changed, 321 insertions(+), 29 deletions(-)
--
2.32.0
According to "Intel Resource Director Technology (Intel RDT) on
2nd Generation Intel Xeon Scalable Processors Reference Manual",
When the Intel Sub-NUMA Clustering(SNC) feature is enabled,
Intel CMT and MBM counters may not be accurate.
However, there does not seem to be an architectural way to detect
if SNC is enabled.
If the result of MBM&CMT test fails on Intel CPU,
print a message to let users know a possible cause of failure.
Signed-off-by: Shaopeng Tan <tan.shaopeng(a)jp.fujitsu.com>
---
Hello,
In PATCH V2, I tried to detect whether SNC is enabled by NUMA info and
cpuinfo(socket_num), but it is not reliable and no future-proof.
I just print a message to let users know a possible cause of "not ok",
When CMT or MBM test runs on Intel CPU, and the result is "not ok".
This patch is based on v5.16.
tools/testing/selftests/resctrl/resctrl_tests.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 973f09a66e1e..ec2bdce7b85f 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -14,8 +14,9 @@
#define BENCHMARK_ARG_SIZE 64
bool is_amd;
+bool is_intel;
-void detect_amd(void)
+void detect_vendor(void)
{
FILE *inf = fopen("/proc/cpuinfo", "r");
char *res;
@@ -29,6 +30,7 @@ void detect_amd(void)
char *s = strchr(res, ':');
is_amd = s && !strcmp(s, ": AuthenticAMD\n");
+ is_intel = s && !strcmp(s, ": GenuineIntel\n");
free(res);
}
fclose(inf);
@@ -70,6 +72,8 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span,
sprintf(benchmark_cmd[5], "%s", MBA_STR);
res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd);
ksft_test_result(!res, "MBM: bw change\n");
+ if (is_intel && res)
+ ksft_print_msg("Intel CMT and MBM counters may be inaccurate when Sub-NUMA Clustering (SNC) is enabled. Ensure SNC is disabled in the BIOS if this system supports SNC.\n");
mbm_test_cleanup();
}
@@ -106,6 +110,8 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no)
sprintf(benchmark_cmd[5], "%s", CMT_STR);
res = cmt_resctrl_val(cpu_no, 5, benchmark_cmd);
ksft_test_result(!res, "CMT: test\n");
+ if (is_intel && res)
+ ksft_print_msg("Intel CMT and MBM counters may be inaccurate when Sub-NUMA Clustering (SNC) is enabled. Ensure SNC is disabled in the BIOS if this system supports SNC.\n");
cmt_test_cleanup();
}
@@ -207,8 +213,8 @@ int main(int argc, char **argv)
if (geteuid() != 0)
return ksft_exit_fail_msg("Not running as root, abort testing.\n");
- /* Detect AMD vendor */
- detect_amd();
+ /* Detect AMD/INTEL vendor */
+ detect_vendor();
if (has_ben) {
/* Extract benchmark command from command line. */
--
2.27.0
This series is just a set of minor tweaks and improvements for the MTE
tests that I did while working on the asymmetric mode support for
userspace which seemed like they might be worth keeping even though the
prctl() for asymmetric mode got removed.
Mark Brown (4):
kselftest/arm64: Handle more kselftest result codes in MTE helpers
kselftest/arm64: Log unexpected asynchronous MTE faults
kselftest/arm64: Refactor parameter checking in mte_switch_mode()
kselftest/arm64: Add simple test for MTE prctl
tools/testing/selftests/arm64/mte/.gitignore | 1 +
.../testing/selftests/arm64/mte/check_prctl.c | 123 ++++++++++++++++++
.../selftests/arm64/mte/mte_common_util.c | 17 ++-
.../selftests/arm64/mte/mte_common_util.h | 15 ++-
4 files changed, 151 insertions(+), 5 deletions(-)
create mode 100644 tools/testing/selftests/arm64/mte/check_prctl.c
base-commit: dfd42facf1e4ada021b939b4e19c935dcdd55566
--
2.30.2
This series is to fix UAF when running kfence test case test_gfpzero,
which is time costly. This UAF bug can be easily triggered by setting
CONFIG_KFENCE_NUM_OBJECTS = 65535. Furthermore, some optimization for
kunit tests has been done.
v1->v2:
Change log is updated.
Peng Liu (3):
kunit: fix UAF when run kfence test case test_gfpzero
kunit: make kunit_test_timeout compatible with comment
kfence: test: try to avoid test_gfpzero trigger rcu_stall
lib/kunit/try-catch.c | 3 ++-
mm/kfence/kfence_test.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
--
2.18.0.huawei.25
kernel/dma/map_benchmark.c and selftests/dma/dma_map_benchmark.c
have duplicate map_benchmark definitions, which tends to lead to
inconsistent changes to map_benchmark on both sides, extract a
common header file to avoid this problem.
Signed-off-by: Tian Tao <tiantao6(a)hisilicon.com>
Acked-by: Barry Song <song.bao.hua(a)hisilicon.com>
Reviewed-by: Shuah Khan <skhan(a)linuxfoundation.org>
---
v2:
move map_benchmark.h in a more appropriate directory
---
include/linux/map_benchmark.h | 31 +++++++++++++++++++
kernel/dma/map_benchmark.c | 25 +--------------
.../testing/selftests/dma/dma_map_benchmark.c | 25 +--------------
3 files changed, 33 insertions(+), 48 deletions(-)
create mode 100644 include/linux/map_benchmark.h
diff --git a/include/linux/map_benchmark.h b/include/linux/map_benchmark.h
new file mode 100644
index 000000000000..62674c83bde4
--- /dev/null
+++ b/include/linux/map_benchmark.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2022 HiSilicon Limited.
+ */
+
+#ifndef _KERNEL_DMA_BENCHMARK_H
+#define _KERNEL_DMA_BENCHMARK_H
+
+#define DMA_MAP_BENCHMARK _IOWR('d', 1, struct map_benchmark)
+#define DMA_MAP_MAX_THREADS 1024
+#define DMA_MAP_MAX_SECONDS 300
+#define DMA_MAP_MAX_TRANS_DELAY (10 * NSEC_PER_MSEC)
+
+#define DMA_MAP_BIDIRECTIONAL 0
+#define DMA_MAP_TO_DEVICE 1
+#define DMA_MAP_FROM_DEVICE 2
+
+struct map_benchmark {
+ __u64 avg_map_100ns; /* average map latency in 100ns */
+ __u64 map_stddev; /* standard deviation of map latency */
+ __u64 avg_unmap_100ns; /* as above */
+ __u64 unmap_stddev;
+ __u32 threads; /* how many threads will do map/unmap in parallel */
+ __u32 seconds; /* how long the test will last */
+ __s32 node; /* which numa node this benchmark will run on */
+ __u32 dma_bits; /* DMA addressing capability */
+ __u32 dma_dir; /* DMA data direction */
+ __u32 dma_trans_ns; /* time for DMA transmission in ns */
+ __u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */
+};
+#endif /* _KERNEL_DMA_BENCHMARK_H */
diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
index 9b9af1bd6be3..0520a8f4fb1d 100644
--- a/kernel/dma/map_benchmark.c
+++ b/kernel/dma/map_benchmark.c
@@ -11,6 +11,7 @@
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
+#include <linux/map_benchmark.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/pci.h>
@@ -18,30 +19,6 @@
#include <linux/slab.h>
#include <linux/timekeeping.h>
-#define DMA_MAP_BENCHMARK _IOWR('d', 1, struct map_benchmark)
-#define DMA_MAP_MAX_THREADS 1024
-#define DMA_MAP_MAX_SECONDS 300
-#define DMA_MAP_MAX_TRANS_DELAY (10 * NSEC_PER_MSEC)
-
-#define DMA_MAP_BIDIRECTIONAL 0
-#define DMA_MAP_TO_DEVICE 1
-#define DMA_MAP_FROM_DEVICE 2
-
-struct map_benchmark {
- __u64 avg_map_100ns; /* average map latency in 100ns */
- __u64 map_stddev; /* standard deviation of map latency */
- __u64 avg_unmap_100ns; /* as above */
- __u64 unmap_stddev;
- __u32 threads; /* how many threads will do map/unmap in parallel */
- __u32 seconds; /* how long the test will last */
- __s32 node; /* which numa node this benchmark will run on */
- __u32 dma_bits; /* DMA addressing capability */
- __u32 dma_dir; /* DMA data direction */
- __u32 dma_trans_ns; /* time for DMA transmission in ns */
- __u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */
- __u8 expansion[76]; /* For future use */
-};
-
struct map_benchmark_data {
struct map_benchmark bparam;
struct device *dev;
diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
index 485dff51bad2..c3b3c09e995e 100644
--- a/tools/testing/selftests/dma/dma_map_benchmark.c
+++ b/tools/testing/selftests/dma/dma_map_benchmark.c
@@ -10,40 +10,17 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <linux/map_benchmark.h>
#include <linux/types.h>
#define NSEC_PER_MSEC 1000000L
-#define DMA_MAP_BENCHMARK _IOWR('d', 1, struct map_benchmark)
-#define DMA_MAP_MAX_THREADS 1024
-#define DMA_MAP_MAX_SECONDS 300
-#define DMA_MAP_MAX_TRANS_DELAY (10 * NSEC_PER_MSEC)
-
-#define DMA_MAP_BIDIRECTIONAL 0
-#define DMA_MAP_TO_DEVICE 1
-#define DMA_MAP_FROM_DEVICE 2
-
static char *directions[] = {
"BIDIRECTIONAL",
"TO_DEVICE",
"FROM_DEVICE",
};
-struct map_benchmark {
- __u64 avg_map_100ns; /* average map latency in 100ns */
- __u64 map_stddev; /* standard deviation of map latency */
- __u64 avg_unmap_100ns; /* as above */
- __u64 unmap_stddev;
- __u32 threads; /* how many threads will do map/unmap in parallel */
- __u32 seconds; /* how long the test will last */
- __s32 node; /* which numa node this benchmark will run on */
- __u32 dma_bits; /* DMA addressing capability */
- __u32 dma_dir; /* DMA data direction */
- __u32 dma_trans_ns; /* time for DMA transmission in ns */
- __u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */
- __u8 expansion[76]; /* For future use */
-};
-
int main(int argc, char **argv)
{
struct map_benchmark map;
--
2.33.0
Depending on the options used, pmtu.sh may launch tcpdump and nettest
processes in the background. However it fails to clean them up after
the tests complete.
Patch 1 allows the cleanup() function to read the list of PIDs launched
by the tests.
Patch 2 fixes the way the nettest PIDs are retrieved.
v2:
* Use tcpdump's immediate mode to capture packets even in short lived
tests.
* Add patch 2 to fix the nettest_pids list.
Guillaume Nault (2):
selftests: pmtu.sh: Kill tcpdump processes launched by subshell.
selftests: pmtu.sh: Kill nettest processes launched in subshell.
tools/testing/selftests/net/pmtu.sh | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
--
2.21.3
This series has a couple of minor fixes and cleanups for sve-ptrace plus
the addition of a new test which validates that we can write using the
FPSIMD regset and then read matching data back using the SVE regset -
previously we only validated writing SVE and reading FPSIMD data.
Mark Brown (3):
kselftest/arm64: Fix comment for ptrace_sve_get_fpsimd_data()
kselftest/arm64: Remove assumption that tasks start FPSIMD only
kselftest/arm64: Validate setting via FPSIMD and read via SVE regsets
tools/testing/selftests/arm64/fp/sve-ptrace.c | 164 +++++++++++++++---
1 file changed, 139 insertions(+), 25 deletions(-)
base-commit: dfd42facf1e4ada021b939b4e19c935dcdd55566
--
2.30.2