linux-kselftest-4.3-rc2-fixes
This update contains 7 fixes for problems ranging from build failurs to incorrect error reporting. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJV/Bw7AAoJEAsCRMQNDUMc7SgP+QGiRiBblkyUSe1t+LVufO8H Ntz9bbWL3RQ/JGuOy299C7la3+SIqb+CUt7GpVUd2GMx42M188MO2+ur+dKWF0Ew MMPGV4FG0dhJ1l3qycCAZ9d6ImDWBkeAP6HHQQctWVUmKA/lsRx93FnT67Ml7lB7 Wa0gL0Pn+5fpoEFC03yKYEKNTLyTTRCl0OpeTOTUSnPRl7ujSz7zHCnH4thZ6lxN +hVLdzsDol/qpEGMg/5eMG/CcJpmMTeLm5xpNrFKCQvfCDbZ4g3O6pfkaP9KTed3 8QsHHN9o6fJfSTkdufEg/zFbiEHz9K04fAzb/jhO7xHuaC5d74SGAXazGhJUlj6M rhTWhIzQTIxz1uE2NkojIK5pHCW4ASTBXU2K2gqLQqFvIKmJB12aixkHJmnAT4fj SXg+GZVQH9Zzzmn0QTWqLdIB2w7CY7IjCK+XcTE6p5M4Mh0v81vPxdUQI0T2JFqm /qBkniY/+JhdPNt/ebKH8467Nqm/vARtLpGytQUpfjO47vUA3BiJTxC2nFmHLgZN +FhvUVtoSUL+15sgGzM2hsmGYUgXjXQlosnOTz/e5e8gKhhR/XiGDAVO48FsGiT8 +5RB+6dXjNM8l73oxTROGIPVzNFgJ6yuKgHlfwd0EH1UZH7gtdchoyvjOo6Vdixy Ck7VqOcypAJQlg1vHbUe =6YAN -----END PGP SIGNATURE----- Merge tag 'linux-kselftest-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull kselftest fixes from Shuah Khan: "This update contains 7 fixes for problems ranging from build failurs to incorrect error reporting" * tag 'linux-kselftest-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: exec: revert to default emit rule selftests: change install command to rsync selftests: mqueue: simplify the Makefile selftests: mqueue: allow extra cflags selftests: rename jump label to static_keys selftests/seccomp: add support for s390 seltests/zram: fix syntax error
This commit is contained in:
commit
30ec568248
|
@ -16,12 +16,12 @@ TARGETS += powerpc
|
|||
TARGETS += ptrace
|
||||
TARGETS += seccomp
|
||||
TARGETS += size
|
||||
TARGETS += static_keys
|
||||
TARGETS += sysctl
|
||||
ifneq (1, $(quicktest))
|
||||
TARGETS += timers
|
||||
endif
|
||||
TARGETS += user
|
||||
TARGETS += jumplabel
|
||||
TARGETS += vm
|
||||
TARGETS += x86
|
||||
TARGETS += zram
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CFLAGS = -Wall
|
||||
BINARIES = execveat
|
||||
DEPS = execveat.symlink execveat.denatured script
|
||||
DEPS = execveat.symlink execveat.denatured script subdir
|
||||
all: $(BINARIES) $(DEPS)
|
||||
|
||||
subdir:
|
||||
|
@ -22,7 +22,5 @@ TEST_FILES := $(DEPS)
|
|||
|
||||
include ../lib.mk
|
||||
|
||||
override EMIT_TESTS := echo "mkdir -p subdir; (./execveat && echo \"selftests: execveat [PASS]\") || echo \"selftests: execveat [FAIL]\""
|
||||
|
||||
clean:
|
||||
rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved xxxxx*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
all:
|
||||
|
||||
TEST_PROGS := ftracetest
|
||||
TEST_DIRS := test.d/
|
||||
TEST_DIRS := test.d
|
||||
|
||||
include ../lib.mk
|
||||
|
||||
|
|
|
@ -13,12 +13,9 @@ run_tests: all
|
|||
|
||||
define INSTALL_RULE
|
||||
@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
|
||||
mkdir -p $(INSTALL_PATH); \
|
||||
for TEST_DIR in $(TEST_DIRS); do \
|
||||
cp -r $$TEST_DIR $(INSTALL_PATH); \
|
||||
done; \
|
||||
echo "install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)"; \
|
||||
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES); \
|
||||
mkdir -p ${INSTALL_PATH}; \
|
||||
echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \
|
||||
rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \
|
||||
fi
|
||||
endef
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
CFLAGS = -O2
|
||||
CFLAGS += -O2
|
||||
LDLIBS = -lrt -lpthread -lpopt
|
||||
TEST_PROGS := mq_open_tests mq_perf_tests
|
||||
|
||||
all:
|
||||
$(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt
|
||||
$(CC) $(CFLAGS) -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
|
||||
all: $(TEST_PROGS)
|
||||
|
||||
include ../lib.mk
|
||||
|
||||
|
@ -11,8 +11,6 @@ override define RUN_TESTS
|
|||
@./mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
|
||||
endef
|
||||
|
||||
TEST_PROGS := mq_open_tests mq_perf_tests
|
||||
|
||||
override define EMIT_TESTS
|
||||
echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests [FAIL]\""
|
||||
echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
|
||||
|
|
|
@ -1210,6 +1210,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
|
|||
# define ARCH_REGS struct pt_regs
|
||||
# define SYSCALL_NUM gpr[0]
|
||||
# define SYSCALL_RET gpr[3]
|
||||
#elif defined(__s390__)
|
||||
# define ARCH_REGS s390_regs
|
||||
# define SYSCALL_NUM gprs[2]
|
||||
# define SYSCALL_RET gprs[2]
|
||||
#else
|
||||
# error "Do not know how to find your architecture's registers and syscalls"
|
||||
#endif
|
||||
|
@ -1243,7 +1247,8 @@ void change_syscall(struct __test_metadata *_metadata,
|
|||
ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov);
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__)
|
||||
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || \
|
||||
defined(__powerpc__) || defined(__s390__)
|
||||
{
|
||||
regs.SYSCALL_NUM = syscall;
|
||||
}
|
||||
|
@ -1281,17 +1286,21 @@ void tracer_syscall(struct __test_metadata *_metadata, pid_t tracee,
|
|||
ret = ptrace(PTRACE_GETEVENTMSG, tracee, NULL, &msg);
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
/* Validate and take action on expected syscalls. */
|
||||
switch (msg) {
|
||||
case 0x1002:
|
||||
/* change getpid to getppid. */
|
||||
EXPECT_EQ(__NR_getpid, get_syscall(_metadata, tracee));
|
||||
change_syscall(_metadata, tracee, __NR_getppid);
|
||||
break;
|
||||
case 0x1003:
|
||||
/* skip gettid. */
|
||||
EXPECT_EQ(__NR_gettid, get_syscall(_metadata, tracee));
|
||||
change_syscall(_metadata, tracee, -1);
|
||||
break;
|
||||
case 0x1004:
|
||||
/* do nothing (allow getppid) */
|
||||
EXPECT_EQ(__NR_getppid, get_syscall(_metadata, tracee));
|
||||
break;
|
||||
default:
|
||||
EXPECT_EQ(0, msg) {
|
||||
|
@ -1409,6 +1418,8 @@ TEST_F(TRACE_syscall, syscall_dropped)
|
|||
# define __NR_seccomp 277
|
||||
# elif defined(__powerpc__)
|
||||
# define __NR_seccomp 358
|
||||
# elif defined(__s390__)
|
||||
# define __NR_seccomp 348
|
||||
# else
|
||||
# warning "seccomp syscall number unknown for this architecture"
|
||||
# define __NR_seccomp 0xffff
|
||||
|
@ -1453,6 +1464,9 @@ TEST(seccomp_syscall)
|
|||
|
||||
/* Reject insane operation. */
|
||||
ret = seccomp(-1, 0, &prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
EXPECT_EQ(EINVAL, errno) {
|
||||
TH_LOG("Did not reject crazy op value!");
|
||||
}
|
||||
|
@ -1501,6 +1515,9 @@ TEST(seccomp_syscall_mode_lock)
|
|||
}
|
||||
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
EXPECT_EQ(0, ret) {
|
||||
TH_LOG("Could not install filter!");
|
||||
}
|
||||
|
@ -1535,6 +1552,9 @@ TEST(TSYNC_first)
|
|||
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, SECCOMP_FLAG_FILTER_TSYNC,
|
||||
&prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
EXPECT_EQ(0, ret) {
|
||||
TH_LOG("Could not install initial filter with TSYNC!");
|
||||
}
|
||||
|
@ -1694,6 +1714,9 @@ TEST_F(TSYNC, siblings_fail_prctl)
|
|||
|
||||
/* Check prctl failure detection by requesting sib 0 diverge. */
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
ASSERT_EQ(0, ret) {
|
||||
TH_LOG("setting filter failed");
|
||||
}
|
||||
|
@ -1731,6 +1754,9 @@ TEST_F(TSYNC, two_siblings_with_ancestor)
|
|||
}
|
||||
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &self->root_prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
ASSERT_EQ(0, ret) {
|
||||
TH_LOG("Kernel does not support SECCOMP_SET_MODE_FILTER!");
|
||||
}
|
||||
|
@ -1805,6 +1831,9 @@ TEST_F(TSYNC, two_siblings_with_no_filter)
|
|||
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, SECCOMP_FLAG_FILTER_TSYNC,
|
||||
&self->apply_prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
ASSERT_EQ(0, ret) {
|
||||
TH_LOG("Could install filter on all threads!");
|
||||
}
|
||||
|
@ -1833,6 +1862,9 @@ TEST_F(TSYNC, two_siblings_with_one_divergence)
|
|||
}
|
||||
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &self->root_prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
ASSERT_EQ(0, ret) {
|
||||
TH_LOG("Kernel does not support SECCOMP_SET_MODE_FILTER!");
|
||||
}
|
||||
|
@ -1890,6 +1922,9 @@ TEST_F(TSYNC, two_siblings_not_under_filter)
|
|||
}
|
||||
|
||||
ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &self->root_prog);
|
||||
ASSERT_NE(ENOSYS, errno) {
|
||||
TH_LOG("Kernel does not support seccomp syscall!");
|
||||
}
|
||||
ASSERT_EQ(0, ret) {
|
||||
TH_LOG("Kernel does not support SECCOMP_SET_MODE_FILTER!");
|
||||
}
|
||||
|
|
|
@ -370,11 +370,8 @@
|
|||
__typeof__(_expected) __exp = (_expected); \
|
||||
__typeof__(_seen) __seen = (_seen); \
|
||||
if (!(__exp _t __seen)) { \
|
||||
unsigned long long __exp_print = 0; \
|
||||
unsigned long long __seen_print = 0; \
|
||||
/* Avoid casting complaints the scariest way we can. */ \
|
||||
memcpy(&__exp_print, &__exp, sizeof(__exp)); \
|
||||
memcpy(&__seen_print, &__seen, sizeof(__seen)); \
|
||||
unsigned long long __exp_print = (unsigned long long)__exp; \
|
||||
unsigned long long __seen_print = (unsigned long long)__seen; \
|
||||
__TH_LOG("Expected %s (%llu) %s %s (%llu)", \
|
||||
#_expected, __exp_print, #_t, \
|
||||
#_seen, __seen_print); \
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
#!/bin/bash
|
||||
TCID="zram.sh"
|
||||
|
||||
check_prereqs()
|
||||
{
|
||||
local msg="skip all tests:"
|
||||
|
||||
if [ $UID != 0 ]; then
|
||||
echo $msg must be run as root >&2
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
. ./zram_lib.sh
|
||||
|
||||
run_zram () {
|
||||
echo "--------------------"
|
||||
|
|
|
@ -23,8 +23,9 @@ trap INT
|
|||
check_prereqs()
|
||||
{
|
||||
local msg="skip all tests:"
|
||||
local uid=$(id -u)
|
||||
|
||||
if [ $UID != 0 ]; then
|
||||
if [ $uid -ne 0 ]; then
|
||||
echo $msg must be run as root >&2
|
||||
exit 0
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue