17 Oct, 2020

1 commit


10 Jun, 2020

1 commit

  • …/git/shuah/linux-kselftest

    Pull kselftest updates from Shuah Khan:
    "This consists of:

    - Several fixes from Masami Hiramatsu to improve coverage for lib and
    sysctl tests.

    - Clean up to vdso test and a new test for getcpu() from Mark Brown.

    - Add new gen_tar selftests Makefile target generate selftest package
    running "make gen_tar" in selftests directory from Veronika
    Kabatova.

    - Other miscellaneous fixes to timens, exec, tpm2 tests"

    * tag 'linux-kselftest-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    selftests/sysctl: Make sysctl test driver as a module
    selftests/sysctl: Fix to load test_sysctl module
    lib: Make test_sysctl initialized as module
    lib: Make prime number generator independently selectable
    selftests/ftrace: Return unsupported if no error_log file
    selftests/ftrace: Use printf for backslash included command
    selftests/timens: handle a case when alarm clocks are not supported
    Kernel selftests: Add check if TPM devices are supported
    selftests: vdso: Add a selftest for vDSO getcpu()
    selftests: vdso: Use a header file to prototype parse_vdso API
    selftests: vdso: Rename vdso_test to vdso_test_gettimeofday
    selftests/exec: Verify execve of non-regular files fail
    selftests: introduce gen_tar Makefile target

    Linus Torvalds
     

09 Jun, 2020

1 commit

  • Testing is done by a new parameter debug.test_sysctl.boot_int which
    defaults to 0 and it's expected that the tester passes a boot parameter
    that sets it to 1. The test checks if it's set to 1.

    To distinguish true failure from parameter not being set, the test
    checks /proc/cmdline for the expected parameter, and whether test_sysctl
    is built-in and not a module.

    [vbabka@suse.cz: skip the new test if boot_int sysctl is not present]
    Link: http://lkml.kernel.org/r/305af605-1e60-cf84-fada-6ce1ca37c102@suse.cz

    Signed-off-by: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Cc: Alexey Dobriyan
    Cc: Christian Brauner
    Cc: David Rientjes
    Cc: "Eric W . Biederman"
    Cc: Greg Kroah-Hartman
    Cc: "Guilherme G . Piccoli"
    Cc: Iurii Zaikin
    Cc: Ivan Teterevkov
    Cc: Kees Cook
    Cc: Luis Chamberlain
    Cc: Masami Hiramatsu
    Cc: Matthew Wilcox
    Cc: Michal Hocko
    Cc: Michal Hocko
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20200427180433.7029-6-vbabka@suse.cz
    Signed-off-by: Linus Torvalds

    Vlastimil Babka
     

03 Jun, 2020

1 commit

  • test_sysctl.c is expected to be used as a module, but since
    it does not use module_init(), it never be registered as
    a module and not appeared under /sys/module/.
    In the result, the selftests/sysctl/sysctl.sh always fails
    to find the test module and is skipped.

    This makes test_sysctl.c initialized as a module by module_init()
    and allow sysctl.sh to find the test module is loaded.

    Signed-off-by: Masami Hiramatsu
    Reviewed-by: Luis Chamberlain
    Signed-off-by: Shuah Khan

    Masami Hiramatsu
     

15 May, 2019

1 commit

  • The kernel has only two users of proc_do_large_bitmap(), the kernel CPU
    watchdog, and the ip_local_reserved_ports. Refer to watchdog_cpumask
    and ip_local_reserved_ports in Documentation for further details on
    these. When you input a large buffer into these, when it is larger than
    PAGE_SIZE- 1, the input data gets misparsed, and the user get
    incorrectly informed that the desired input value was set. This commit
    implements a test which mimics and exploits that use case, it uses a
    bitmap size, as in the watchdog case. The bitmap is used to test the
    bitmap proc handler, proc_do_large_bitmap().

    The next commit fixes this issue.

    [akpm@linux-foundation.org: move proc_do_large_bitmap() export to EOF]
    [mcgrof@kernel.org: use new target description for backward compatibility]
    [mcgrof@kernel.org: augment test number to 50, ran into issues with bash string comparisons when testing up to 50 cases.]
    [mcgrof@kernel.org: introduce and use verify_diff_proc_file() to use diff]
    [mcgrof@kernel.org: use mktemp for tmp file]
    [mcgrof@kernel.org: merge shell test and C code]
    [mcgrof@kernel.org: commit log love]
    [mcgrof@kernel.org: export proc_do_large_bitmap() to allow for the test
    [mcgrof@kernel.org: check for the return value when writing to the proc file]
    Link: http://lkml.kernel.org/r/20190320222831.8243-6-mcgrof@kernel.org
    Signed-off-by: Eric Sandeen
    Signed-off-by: Luis Chamberlain
    Acked-by: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     

13 Jul, 2017

4 commits

  • Add a few initial respective tests for an array:

    o Echoing values separated by spaces works
    o Echoing only first elements will set first elements
    o Confirm PAGE_SIZE limit still applies even if an array is used

    Link: http://lkml.kernel.org/r/20170630224431.17374-7-mcgrof@kernel.org
    Signed-off-by: Luis R. Rodriguez
    Cc: Kees Cook
    Cc: "Eric W. Biederman"
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis R. Rodriguez
     
  • Test against a simple proc_douintvec() case. While at it, add a test
    against UINT_MAX. Make sure UINT_MAX works, and UINT_MAX+1 will fail
    and that negative values are not accepted.

    Link: http://lkml.kernel.org/r/20170630224431.17374-6-mcgrof@kernel.org
    Signed-off-by: Luis R. Rodriguez
    Cc: Kees Cook
    Cc: "Eric W. Biederman"
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis R. Rodriguez
     
  • Test against a simple proc_dointvec() case. While at it, add a test
    against INT_MAX. Make sure INT_MAX works, and INT_MAX+1 will fail.
    Also test negative values work.

    Link: http://lkml.kernel.org/r/20170630224431.17374-5-mcgrof@kernel.org
    Signed-off-by: Luis R. Rodriguez
    Cc: Kees Cook
    Cc: "Eric W. Biederman"
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis R. Rodriguez
     
  • The existing tools/testing/selftests/sysctl/ tests include two test
    cases, but these use existing production kernel sysctl interfaces. We
    want to expand test coverage but we can't just be looking for random
    safe production values to poke at, that's just insane!

    Instead just dedicate a test driver for debugging purposes and port the
    existing scripts to use it. This will make it easier for further tests
    to be added.

    Subsequent patches will extend our test coverage for sysctl.

    The stress test driver uses a new license (GPL on Linux, copyleft-next
    outside of Linux). Linus was fine with this [0] and later due to Ted's
    and Alans's request ironed out an "or" language clause to use [1] which
    is already present upstream.

    [0] https://lkml.kernel.org/r/CA+55aFyhxcvD+q7tp+-yrSFDKfR0mOHgyEAe=f_94aKLsOu0Og@mail.gmail.com
    [1] https://lkml.kernel.org/r/1495234558.7848.122.camel@linux.intel.com

    Link: http://lkml.kernel.org/r/20170630224431.17374-2-mcgrof@kernel.org
    Signed-off-by: Luis R. Rodriguez
    Acked-by: Kees Cook
    Cc: "Eric W. Biederman"
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis R. Rodriguez