07 Feb, 2019

1 commit

  • commit ed5f13261cb65b02c611ae9971677f33581d4286 upstream.

    Passing EPERM during syscall skipping was confusing since the test wasn't
    actually exercising the errno evaluation -- it was just passing a literal
    "1" (EPERM). Instead, expand the tests to check both direct value returns
    (positive, 45000 in this case), and errno values (negative, -ESRCH in this
    case) to check both fake success and fake failure during syscall skipping.

    Reported-by: Colin Ian King
    Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Kees Cook
     

31 Jan, 2019

2 commits

  • This reverts commit e65cd9a20343ea90f576c24c38ee85ab6e7d5fec.

    Tommi T. Rrantala notes:

    PTRACE_SECCOMP_GET_METADATA was only added in 4.16
    (26500475ac1b499d8636ff281311d633909f5d20)

    And it's also breaking seccomp_bpf.c compilation for me:

    seccomp_bpf.c: In function ‘get_metadata’:
    seccomp_bpf.c:2878:26: error: storage size of ‘md’ isn’t known
    struct seccomp_metadata md;

    Signed-off-by: Sasha Levin

    Sasha Levin
     
  • commit e1812933b17be7814f51b6c310c5d1ced7a9a5f5 upstream.

    There was a bug where the per-mm pkey state was not being preserved across
    fork() in the child. fork() is performed in the pkey selftests, but all of
    the pkey activity is performed in the parent. The child does not perform
    any actions sensitive to pkey state.

    To make the test more sensitive to these kinds of bugs, add a fork() where
    the parent exits, and execution continues in the child.

    To achieve this let the key exhaustion test not terminate at the first
    allocation failure and fork after 2*NR_PKEYS loops and continue in the
    child.

    Signed-off-by: Dave Hansen
    Signed-off-by: Thomas Gleixner
    Cc: bp@alien8.de
    Cc: hpa@zytor.com
    Cc: peterz@infradead.org
    Cc: mpe@ellerman.id.au
    Cc: will.deacon@arm.com
    Cc: luto@kernel.org
    Cc: jroedel@suse.de
    Cc: stable@vger.kernel.org
    Cc: Borislav Petkov
    Cc: "H. Peter Anvin"
    Cc: Peter Zijlstra
    Cc: Michael Ellerman
    Cc: Will Deacon
    Cc: Andy Lutomirski
    Cc: Joerg Roedel
    Link: https://lkml.kernel.org/r/20190102215657.585704B7@viggo.jf.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Dave Hansen
     

26 Jan, 2019

1 commit

  • [ Upstream commit b708a3cc9600390ccaa2b68a88087dd265154b2b ]

    I've stumbled over the current macro-expand behaviour of the test
    harness:

    $ gcc -Wall -xc - <:4:global.macro:Expected 0 (0) != (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) (0)
    global.macro: Test terminated by assertion
    [ FAIL ] global.macro
    [==========] 0 / 1 tests passed.
    [ FAILED ]

    With this change the output of the same test looks much more
    comprehensible:

    [==========] Running 1 tests from 1 test cases.
    [ RUN ] global.macro
    :4:global.macro:Expected 0 (0) != WIFSIGNALED(status) (0)
    global.macro: Test terminated by assertion
    [ FAIL ] global.macro
    [==========] 0 / 1 tests passed.
    [ FAILED ]

    The issue is very similar to the bug fixed in glibc assert(3)
    three years ago:
    https://sourceware.org/bugzilla/show_bug.cgi?id=18604

    Cc: Shuah Khan
    Cc: Kees Cook
    Cc: Andy Lutomirski
    Cc: Will Drewry
    Cc: linux-kselftest@vger.kernel.org
    Signed-off-by: Dmitry V. Levin
    Acked-by: Kees Cook
    Signed-off-by: Shuah Khan
    Signed-off-by: Sasha Levin

    Dmitry V. Levin
     

13 Jan, 2019

1 commit

  • commit 808153e1187fa77ac7d7dad261ff476888dcf398 upstream.

    devm_memremap_pages() is a facility that can create struct page entries
    for any arbitrary range and give drivers the ability to subvert core
    aspects of page management.

    Specifically the facility is tightly integrated with the kernel's memory
    hotplug functionality. It injects an altmap argument deep into the
    architecture specific vmemmap implementation to allow allocating from
    specific reserved pages, and it has Linux specific assumptions about page
    structure reference counting relative to get_user_pages() and
    get_user_pages_fast(). It was an oversight and a mistake that this was
    not marked EXPORT_SYMBOL_GPL from the outset.

    Again, devm_memremap_pagex() exposes and relies upon core kernel internal
    assumptions and will continue to evolve along with 'struct page', memory
    hotplug, and support for new memory types / topologies. Only an in-kernel
    GPL-only driver is expected to keep up with this ongoing evolution. This
    interface, and functionality derived from this interface, is not suitable
    for kernel-external drivers.

    Link: http://lkml.kernel.org/r/154275557457.76910.16923571232582744134.stgit@dwillia2-desk3.amr.corp.intel.com
    Signed-off-by: Dan Williams
    Reviewed-by: Christoph Hellwig
    Acked-by: Michal Hocko
    Cc: "Jérôme Glisse"
    Cc: Balbir Singh
    Cc: Logan Gunthorpe
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

21 Dec, 2018

1 commit

  • [ Upstream commit c01ac66b38660f2b507ccd0b75d28e3002d56fbb ]

    The message got changed a lot time ago.

    This was responsible for 36 test case failures on sparc64.

    Fixes: f1174f77b50c ("bpf/verifier: rework value tracking")
    Signed-off-by: David S. Miller
    Signed-off-by: Alexei Starovoitov
    Signed-off-by: Sasha Levin

    David Miller
     

17 Dec, 2018

1 commit

  • [ Upstream commit 25d8bcedbf4329895dbaf9dd67baa6f18dad918c ]

    Start flood ping for each cpu while loading/flushing rulesets to make
    sure we do not access already-free'd rules from nf_tables evaluation loop.

    Also add this to TARGETS so 'make run_tests' in selftest dir runs it
    automatically.

    This would have caught the bug fixed in previous change
    ("netfilter: nf_tables: do not skip inactive chains during generation update")
    sooner.

    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin

    Florian Westphal
     

21 Nov, 2018

1 commit

  • [ Upstream commit 693b31b2fc1636f0aa7af53136d3b49f6ad9ff39 ]

    Test tm-tmspr might exit before all threads stop executing, because it just
    waits for the very last thread to join before proceeding/exiting.

    This patch makes sure that all threads that were created will join before
    proceeding/exiting.

    This patch also guarantees that the amount of threads being created is equal
    to thread_num.

    Signed-off-by: Breno Leitao
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitao
     

14 Nov, 2018

3 commits

  • commit 48dc0ef19044bfb69193302fbe3a834e3331b7ae upstream.

    Test ptrace-tm-spd-gpr fails on current kernel (4.19) due to a segmentation
    fault that happens on the child process prior to setting cptr[2] = 1. This
    causes the parent process to wait forever at 'while (!pptr[2])' and the test to
    be killed by the test harness framework by timeout, thus, failing.

    The segmentation fault happens because of a inline assembly being
    generated as:

    0x10000355c lfs f0, 0(0)

    This is reading memory position 0x0 and causing the segmentation fault.

    This code is being generated by ASM_LOAD_FPR_SINGLE_PRECISION(flt_4), where
    flt_4 is passed to the inline assembly block as:

    [flt_4] "r" (&d)

    Since the inline assembly 'r' constraint means any GPR, gpr0 is being
    chosen, thus causing this issue when issuing a Load Floating-Point Single
    instruction.

    This patch simply changes the constraint to 'b', which specify that this
    register will be used as base, and r0 is not allowed to be used, avoiding
    this issue.

    Other than that, removing flt_2 register from the input operands, since it
    is not used by the inline assembly code at all.

    Cc: stable@vger.kernel.org
    Signed-off-by: Breno Leitao
    Acked-by: Segher Boessenkool
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitao
     
  • [ Upstream commit ba0e41ca81b935b958006c7120466e2217357827 ]

    Add a testcase to check the syntax and field types for
    synthetic_events interface.

    Link: http://lkml.kernel.org/r/153986838264.18251.16627517536956299922.stgit@devbox

    Acked-by: Shuah Khan
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masami Hiramatsu
     
  • [ Upstream commit 262f9d811c7608f1e74258ceecfe1fa213bdf912 ]

    If the current process has unlimited RLIMIT_MEMLOCK,
    we should should leave it as is.

    Fixes: 941ff6f11c02 ("bpf: fix rlimit in reuseport net selftest")
    Signed-off-by: John Sperbeck
    Signed-off-by: Eric Dumazet
    Acked-by: Daniel Borkmann
    Signed-off-by: Daniel Borkmann
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     

04 Nov, 2018

3 commits

  • [ Upstream commit 3c718e677c2b35b449992adc36ecce883c467e98 ]

    the script rtnetlink.sh requires a bash-only features (sleep with sub-second
    precision). This may cause random test failure if the default shell is not
    bash.
    Address the above explicitly requiring bash as the script interpreter.

    Fixes: 33b01b7b4f19 ("selftests: add rtnetlink test script")
    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Paolo Abeni
     
  • [ Upstream commit 9c2ddfe55c42bf4b9bc336a0650ab78f9222a159 ]

    This test the ptrace hw breakpoints via PTRACE_SET_DEBUGREG and
    PPC_PTRACE_SETHWDEBUG. This test was use to find the bugs fixed by
    these recent commits:

    4f7c06e26e powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG
    cd6ef7eebf powerpc/ptrace: Fix enforcement of DAWR constraints

    Signed-off-by: Michael Neuling
    [mpe: Add SPDX tag, clang format it]
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin

    Michael Neuling
     
  • [ Upstream commit fb2a1748355161e050e9f49f1ea9a0ae707a148b ]

    Validate command parsing in acpi_nfit_ctl for the clear error command.
    This tests for a crash condition introduced by commit 4b27db7e26cd
    "acpi, nfit: add support for the _LSI, _LSR, and _LSW label methods".

    Cc: Vishal Verma
    Signed-off-by: Dan Williams
    Signed-off-by: Sasha Levin

    Dan Williams
     

18 Oct, 2018

2 commits

  • [ Upstream commit 4d85af102a66ee6aeefa596f273169e77fb2b48e ]

    add CONFIG_MEMORY_HOTREMOVE=y in config
    without this config, /sys/devices/system/memory/memory*/removable
    always return 0, I endup getting an early skip during test

    Signed-off-by: Lei Yang
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lei Yang
     
  • [ Upstream commit 53cf59d6c0ad3edc4f4449098706a8f8986258b6 ]

    add config file

    Signed-off-by: Lei Yang
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lei Yang
     

13 Oct, 2018

2 commits

  • commit 02e425668f5c9deb42787d10001a3b605993ad15 upstream.

    When I added the missing memory outputs, I failed to update the
    index of the first argument (ebx) on 32-bit builds, which broke the
    fallbacks. Somehow I must have screwed up my testing or gotten
    lucky.

    Add another test to cover gettimeofday() as well.

    Signed-off-by: Andy Lutomirski
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Fixes: 715bd9d12f84 ("x86/vdso: Fix asm constraints on vDSO syscall fallbacks")
    Link: http://lkml.kernel.org/r/21bd45ab04b6d838278fa5bebfa9163eceffa13c.1538608971.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     
  • commit 7c03e7035ac1cf2a6165754e4f3a49c2f1977838 upstream.

    Now that the vDSO implementation of clock_gettime() is getting
    reworked, add a selftest for it. This tests that its output is
    consistent with the syscall version.

    This is marked for stable to serve as a test for commit

    715bd9d12f84 ("x86/vdso: Fix asm constraints on vDSO syscall fallbacks")

    Signed-off-by: Andy Lutomirski
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/082399674de2619b2befd8c0dde49b260605b126.1538422295.git.luto@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

26 Sep, 2018

1 commit

  • [ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]

    In the past we've warned when ADJ_OFFSET was in progress, usually
    caused by ntpd or some other time adjusting daemon running in non
    steady sate, which can cause the skew calculations to be
    incorrect.

    Thus, this patch checks to see if the clock was being adjusted
    when we fail so that we don't cause false negatives.

    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Miroslav Lichvar
    Cc: Richard Cochran
    Cc: Prarit Bhargava
    Cc: Stephen Boyd
    Cc: Shuah Khan
    Cc: linux-kselftest@vger.kernel.org
    Suggested-by: Miroslav Lichvar
    Signed-off-by: John Stultz
    Signed-off-by: Greg Kroah-Hartman

    John Stultz
     

20 Sep, 2018

2 commits

  • [ Upstream commit 45df5d3dc0c7289c1e67afe6d2ba806ad5174314 ]

    The mock / test version of pmem_direct_access() needs to check the
    validity of pointers kaddr and pfn for NULL assignment. If anyone
    equals to NULL, it doesn't need to calculate the value.

    If pointer equals to NULL, that is to say callers may have no need for
    kaddr or pfn, so this patch is prepared for allowing them to pass in
    NULL instead of having to pass in a local pointer or variable that
    they then just throw away.

    Suggested-by: Dan Williams
    Signed-off-by: Huaisheng Ye
    Reviewed-by: Ross Zwisler
    Signed-off-by: Dave Jiang
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Huaisheng Ye
     
  • [ Upstream commit 0069fb854364da79fd99236ea620affc8e1152d5 ]

    Commit fbeb1603bf4e ("bpf: verifier: MOV64 don't mark dst reg unbounded")
    revealed a typo in commit fb30d4b71214 ("bpf: Add tests for map-in-map"):
    BPF_MOV64_REG(BPF_REG_0, 0) was used instead of
    BPF_MOV64_IMM(BPF_REG_0, 0).

    I've noticed the problem by running bpf kselftests.

    Fixes: fb30d4b71214 ("bpf: Add tests for map-in-map")
    Signed-off-by: Roman Gushchin
    Cc: Martin KaFai Lau
    Cc: Arthur Fabre
    Cc: Daniel Borkmann
    Cc: Alexei Starovoitov
    Acked-by: Martin KaFai Lau
    Signed-off-by: Daniel Borkmann
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Roman Gushchin
     

15 Sep, 2018

1 commit

  • [ Upstream commit 7c27a26e1ed5a7dd709aa19685d2c98f64e1cf0c ]

    There are some powerpc selftests, as tm/tm-unavailable, that run for a long
    period (>120 seconds), and if it is interrupted, as pressing CRTL-C
    (SIGINT), the foreground process (harness) dies but the child process and
    threads continue to execute (with PPID = 1 now) in background.

    In this case, you'd think the whole test exited, but there are remaining
    threads and processes being executed in background. Sometimes these
    zombies processes are doing annoying things, as consuming the whole CPU or
    dumping things to STDOUT.

    This patch fixes this problem by attaching an empty signal handler to
    SIGINT in the harness process. This handler will interrupt (EINTR) the
    parent process waitpid() call, letting the code to follow through the
    normal flow, which will kill all the processes in the child process group.

    This patch also fixes a typo.

    Signed-off-by: Breno Leitao
    Signed-off-by: Gustavo Romero
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitao
     

05 Sep, 2018

1 commit

  • [ Upstream commit 82f4f3e69c5c29bce940dd87a2c0f16c51d48d17 ]

    Add a testcase for checking snapshot and tracing_on
    relationship. This ensures that the snapshotting doesn't
    affect current tracing on/off settings.

    Link: http://lkml.kernel.org/r/153149932412.11274.15289227592627901488.stgit@devbox

    Cc: Tom Zanussi
    Cc: Hiraku Toyooka
    Signed-off-by: Masami Hiramatsu
    Cc: Ingo Molnar
    Cc: Shuah Khan
    Cc: linux-kselftest@vger.kernel.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masami Hiramatsu
     

24 Aug, 2018

10 commits

  • [ Upstream commit e8a445dea219c32727016af14f847d2e8f7ebec8 ]

    We have short names for the requested and resulting register values.
    Use them instead of spelling out the whole register entry for each
    case.

    Signed-off-by: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/bb3bc1f923a2f6fe7912d22a1068fe29d6033d38.1530076529.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     
  • [ Upstream commit ec348020566009d3da9b99f07c05814d13969c78 ]

    When I wrote the sigreturn test, I didn't realize that AMD's busted
    IRET behavior was different from Intel's busted IRET behavior:

    On AMD CPUs, the CPU leaks the high 32 bits of the kernel stack pointer
    to certain userspace contexts. Gee, thanks. There's very little
    the kernel can do about it. Modify the test so it passes.

    Signed-off-by: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/86e7fd3564497f657de30a36da4505799eebef01.1530076529.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     
  • [ Upstream commit 81e167c2a216e7b54e6add9d2badcda267fe33b1 ]

    The test_kmod.sh script require root privilege for the successful
    execution of the test.

    This patch is to notify the user about the privilege the script
    demands for the successful execution of the test.

    Signed-off-by: Jeffrin Jose T (Rajagiri SET)
    Signed-off-by: Daniel Borkmann
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jeffrin Jose T
     
  • [ Upstream commit d6a3e55131fcb1e5ca1753f4b6f297a177b2fc91 ]

    Unless the software synchronization objects (CONFIG_SW_SYNC) is enabled,
    the sync test will be skipped:

    TAP version 13
    1..0 # Skipped: Sync framework not supported by kernel

    Add a config fragment file to be able to run "make kselftest-merge" to
    enable relevant configuration required in order to run the sync test.

    Signed-off-by: Fathi Boudra
    Link: https://lkml.org/lkml/2017/5/5/14
    Signed-off-by: Anders Roxell
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Fathi Boudra
     
  • [ Upstream commit a4d7537789724985cafbc9260a31ca4f2b7cf123 ]

    When vm test is skipped because of unmet dependencies and/or unsupported
    configuration, it exits with error which is treated as a fail by the
    Kselftest framework. This leads to false negative result even when the
    test could not be run.

    Change it to return kselftest skip code when a test gets skipped to
    clearly report that the test could not be run.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Acked-by: Mike Rapoport
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit 685814466bf8398192cf855415a0bb2cefc1930e ]

    When zram test is skipped because of unmet dependencies and/or
    unsupported configuration, it exits with error which is treated as
    a fail by the Kselftest framework. This leads to false negative result
    even when the test could not be run.

    Change it to return kselftest skip code when a test gets skipped to
    clearly report that the test could not be run.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit d7d5311d4aa9611fe1a5a851e6f75733237a668a ]

    When user test is skipped because of unmet dependencies and/or
    unsupported configuration, it exits with error which is treated as
    a fail by the Kselftest framework. This leads to false negative result
    even when the test could not be run.

    Change it to return kselftest skip code when a test gets skipped to
    clearly report that the test could not be run. Add an explicit check
    for module presence and return skip code if module isn't present.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit c7db6ffb831fd36a03485a0d88b1e505378975ad ]

    When sysctl test is skipped because of unmet dependencies and/or
    unsupported configuration, it exits with error which is treated as
    a fail by the Kselftest framework. This leads to false negative result
    even when the test could not be run.

    Change it to return kselftest skip code when a test gets skipped to
    clearly report that the test could not be run.

    Changed return code to kselftest skip code in skip error legs that check
    requirements and module probe test error leg.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Reviewed-by: Kees Cook
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit 8781578087b8fb8829558bac96c3c24e5ba26f82 ]

    When static_keys test is skipped because of unmet dependencies and/or
    unsupported configuration, it exits with error which is treated as a fail
    by the Kselftest framework. This leads to false negative result even when
    the test could not be run.

    Change it to return kselftest skip code when a test gets skipped to clearly
    report that the test could not be run.

    Added an explicit searches for test_static_key_base and test_static_keys
    modules and return skip code if they aren't found to differentiate between
    the failure to load the module condition and module not found condition.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit 856e7c4b619af622d56b3b454f7bec32a170ac99 ]

    When pstore_post_reboot test gets skipped because of unmet dependencies
    and/or unsupported configuration, it returns 0 which is treated as a pass
    by the Kselftest framework. This leads to false positive result even when
    the test could not be run.

    Change it to return kselftest skip code when a test gets skipped to clearly
    report that the test could not be run.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Reviewed-by: Kees Cook
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     

03 Aug, 2018

3 commits

  • [ Upstream commit 5c30a038fb8ec8cdff011e6b5d5d51eb415381d4 ]

    When intel_pstate test is skipped because of unmet dependencies and/or
    unsupported configuration, it returns 0 which is treated as a pass
    by the Kselftest framework. This leads to false positive result even
    when the test could not be run.

    Change it to return kselftest skip code when a test gets skipped to
    clearly report that the test could not be run.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit b27f0259e8cea74c627327c063742a83613dd460 ]

    When memfd test is skipped because of unmet dependencies and/or unsupported
    configuration, it returns non-zero value which is treated as a fail by the
    Kselftest framework. This leads to false negative result even when the test
    could not be run.

    Change it to return kselftest skip code when a test gets skipped to clearly
    report that the test could not be run.

    Added an explicit check for root user at the start of memfd hugetlbfs test
    and return skip code if a non-root user attempts to run it.

    In addition, return skip code when not enough huge pages are available to
    run the test.

    Kselftest framework SKIP code is 4 and the framework prints appropriate
    messages to indicate that the test is skipped.

    Signed-off-by: Shuah Khan (Samsung OSG)
    Reviewed-by: Mike Kravetz
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Shuah Khan (Samsung OSG)
     
  • [ Upstream commit e9d33f149f52981fd856a0b16aa8ebda89b02e34 ]

    A few changes improve the overall usability of the test:
    * fix a hard-coded maximum frequency (3300),
    * don't adjust the CPU frequency if only evaluating results,
    * fix a comparison for multiple frequencies.

    A symptom of that last issue looked like this:
    ./run.sh: line 107: [: too many arguments
    ./run.sh: line 110: 3099
    3099
    3100-3100: syntax error in expression (error token is \"3099
    3100-3100\")

    Because a check will count how many differente frequencies
    there are among the CPUs of the system, and after they are
    tallied another read is performed, which might produce
    different results.

    Signed-off-by: Daniel Díaz
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Daniel Díaz
     

03 Jul, 2018

1 commit

  • commit 756b56a9e832e063edc83be7c3889e98c536dd2b upstream.

    The trigger code is picky in how it can be disabled as there may be
    dependencies between different events and synthetic events. Change the order
    on how triggers are reset.

    1) Reset triggers of all synthetic events first
    2) Remove triggers with actions attached to them
    3) Remove all other triggers

    If this order isn't followed, then some triggers will not be reset, and an
    error may happen because a trigger is busy.

    Cc: stable@vger.kernel.org
    Fixes: cfa0963dc474f ("kselftests/ftrace : Add event trigger testcases")
    Reviewed-by: Namhyung Kim
    Acked-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     

21 Jun, 2018

3 commits

  • [ Upstream commit 3488a600d90bcaf061b104dbcfbdc8d99b398312 ]

    Protection key 0 is the default key for all memory and will
    not normally come back from pkey_alloc(). But, you might
    still want pass it to mprotect_pkey().

    This check ensures that you can use pkey 0.

    Signed-off-by: Dave Hansen
    Cc: Andrew Morton
    Cc: Dave Hansen
    Cc: Linus Torvalds
    Cc: Michael Ellermen
    Cc: Peter Zijlstra
    Cc: Ram Pai
    Cc: Shuah Khan
    Cc: Thomas Gleixner
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20180509171356.9E40B254@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dave Hansen
     
  • [ Upstream commit acb25d761d6f2f64e785ccefc71e54f244f1eda4 ]

    This makes it possible to to tell what 'prot' a given allocation
    is supposed to have. That way, if we want to change just the
    pkey, we know what 'prot' to pass to mprotect_pkey().

    Also, keep a record of the most recent allocation so the tests
    can easily find it.

    Signed-off-by: Dave Hansen
    Cc: Andrew Morton
    Cc: Dave Hansen
    Cc: Linus Torvalds
    Cc: Michael Ellermen
    Cc: Peter Zijlstra
    Cc: Ram Pai
    Cc: Shuah Khan
    Cc: Thomas Gleixner
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20180509171354.AA23E228@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dave Hansen
     
  • [ Upstream commit 3d64f4ed15c3c53dba4c514bf59c334464dee373 ]

    We dump out the entire area of the siginfo where the si_pkey_ptr is
    supposed to be. But, we do some math on the poitner, which is a u32.
    We intended to do byte math, not u32 math on the pointer.

    Cast it over to a u8* so it works.

    Also, move this block of code to below th si_code check. It doesn't
    hurt anything, but the si_pkey field is gibberish for other signal
    types.

    Signed-off-by: Dave Hansen
    Cc: Andrew Morton
    Cc: Dave Hansen
    Cc: Linus Torvalds
    Cc: Michael Ellermen
    Cc: Peter Zijlstra
    Cc: Ram Pai
    Cc: Shuah Khan
    Cc: Thomas Gleixner
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20180509171352.9BE09819@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dave Hansen