+ tools-testing-selftests-sysctl-validate-sysctl_writes_strict.patch added to -mm tree
Subsystems (2)
Subject: + tools-testing-selftests-sysctl-validate-sysctl_writes_strict.patch added to -mm tree
To: [email protected],[email protected]
From: [email protected]
Date: Mon, 05 May 2014 15:00:29 -0700
The patch titled
Subject: tools/testing/selftests/sysctl: validate sysctl_writes_strict
has been added to the -mm tree. Its filename is
tools-testing-selftests-sysctl-validate-sysctl_writes_strict.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/tools-testing-selftests-sysctl-validate-sysctl_writes_strict.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/tools-testing-selftests-sysctl-validate-sysctl_writes_strict.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Kees Cook <[email protected]>
Subject: tools/testing/selftests/sysctl: validate sysctl_writes_strict
This adds several behavioral tests to sysctl string and number writing to detect unexpected cases that behaved differently when the sysctl kernel.sysctl_writes_strict != 1.
[ original ]
root@localhost:~# make test_num == Testing sysctl behavior against /proc/sys/kernel/domainname == Writing test file ... ok Checking sysctl is not set to test value ... ok Writing sysctl from shell ... ok Resetting sysctl to original value ... ok Writing entire sysctl in single write ... ok Writing middle of sysctl after synchronized seek ... FAIL Writing beyond end of sysctl ... FAIL Writing sysctl with multiple long writes ... FAIL Writing entire sysctl in short writes ... FAIL Writing middle of sysctl after unsynchronized seek ... ok Checking sysctl maxlen is at least 65 ... ok Checking sysctl keeps original string on overflow append ... FAIL Checking sysctl stays NULL terminated on write ... ok Checking sysctl stays NULL terminated on overwrite ... ok make: *** [test_num] Error 1 root@localhost:~# make test_string == Testing sysctl behavior against /proc/sys/vm/swappiness == Writing test file ... ok Checking sysctl is not set to test value ... ok Writing sysctl from shell ... ok Resetting sysctl to original value ... ok Writing entire sysctl in single write ... ok Writing middle of sysctl after synchronized seek ... FAIL Writing beyond end of sysctl ... FAIL Writing sysctl with multiple long writes ... ok make: *** [test_string] Error 1
[ with CONFIG_PROC_SYSCTL_STRICT_WRITES ]
root@localhost:~# make run_tests == Testing sysctl behavior against /proc/sys/kernel/domainname == Writing test file ... ok Checking sysctl is not set to test value ... ok Writing sysctl from shell ... ok Resetting sysctl to original value ... ok Writing entire sysctl in single write ... ok Writing middle of sysctl after synchronized seek ... ok Writing beyond end of sysctl ... ok Writing sysctl with multiple long writes ... ok Writing entire sysctl in short writes ... ok Writing middle of sysctl after unsynchronized seek ... ok Checking sysctl maxlen is at least 65 ... ok Checking sysctl keeps original string on overflow append ... ok Checking sysctl stays NULL terminated on write ... ok Checking sysctl stays NULL terminated on overwrite ... ok == Testing sysctl behavior against /proc/sys/vm/swappiness == Writing test file ... ok Checking sysctl is not set to test value ... ok Writing sysctl from shell ... ok Resetting sysctl to original value ... ok Writing entire sysctl in single write ... ok Writing middle of sysctl after synchronized seek ... ok Writing beyond end of sysctl ... ok Writing sysctl with multiple long writes ... ok
---
tools/testing/selftests/Makefile | 1 tools/testing/selftests/sysctl/Makefile | 19 ++ tools/testing/selftests/sysctl/common_tests | 109 ++++++++++++++ tools/testing/selftests/sysctl/run_numerictests | 10 + tools/testing/selftests/sysctl/run_stringtests | 77 +++++++++ 5 files changed, 216 insertions(+)
tools/testing/selftests/Makefile renamed from tools/testing/selftests/Makefile~tools-testing-selftests-sysctl-validate-sysctl_writes_strict +1 -0
@@ -10,6 +10,7 @@ TARGETS += timers TARGETS += vm TARGETS += powerpc TARGETS += user +TARGETS += sysctl all: for TARGET in $(TARGETS); do \
tools/testing/selftests/sysctl/Makefile new file +19 -0
@@ -0,0 +1,19 @@ +# Makefile for sysctl selftests. +# Expects kernel.sysctl_writes_strict=1. + +# No binaries, but make sure arg-less "make" doesn't trigger "run_tests". +all: + +# Allow specific tests to be selected. +test_num: + @/bin/sh ./run_numerictests + +test_string: + @/bin/sh ./run_stringtests + +run_tests: all test_num test_string + +# Nothing to clean up. +clean: + +.PHONY: all run_tests clean test_num test_string
tools/testing/selftests/sysctl/common_tests new file +109 -0
109 lines not on this page · raw message
tools/testing/selftests/sysctl/run_numerictests new file +10 -0
@@ -0,0 +1,10 @@ +#!/bin/sh + +SYSCTL="/proc/sys" +TARGET="${SYSCTL}/vm/swappiness" +ORIG=$(cat "${TARGET}") +TEST_STR=$(( $ORIG + 1 )) + +. ./common_tests + +exit $rc
tools/testing/selftests/sysctl/run_stringtests new file +77 -0
77 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
lib-vsprintf-add-%pt-format-specifier.patch binfmt_elfc-use-get_random_int-to-fix-entropy-depleting.patch ptrace-fix-fork-event-messages-across-pid-namespaces.patch sysctl-clean-up-char-buffer-arguments.patch sysctl-refactor-sysctl-string-writing-logic.patch sysctl-allow-for-strict-write-position-handling.patch sysctl-allow-for-strict-write-position-handling-fix.patch tools-testing-selftests-sysctl-validate-sysctl_writes_strict.patch tools-testing-selftests-sysctl-validate-sysctl_writes_strict-fix.patch linux-next.patch