Commit Graph

3 Commits

Author SHA1 Message Date
Nico Pache 41f6bae567 lib: stackinit: update reference to kunit-tool
commit 4bba2a04ef98b92f21eddb492d7602d6ded026cd
Author: Tales Aparecida <tales.aparecida@gmail.com>
Date:   Sun Aug 21 23:26:46 2022 -0300

    lib: stackinit: update reference to kunit-tool

    Replace URL with an updated path to the full Documentation page

    Signed-off-by: Tales Aparecida <tales.aparecida@gmail.com>
    Reviewed-by: David Gow <davidgow@google.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

JIRA: https://issues.redhat.com/browse/RHEL-5618
Signed-off-by: Nico Pache <npache@redhat.com>
2023-11-02 15:26:53 -06:00
John W. Linville 209ccf6f16 kernel/range: Uplevel the cxl subsystem's range_contains() helper
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168268

In support of the CXL subsystem's use of 'struct range' to track decode
address ranges, add a common range_contains() implementation with
identical semantics as resource_contains();

The existing 'range_contains()' in lib/stackinit_kunit.c is namespaced
with a 'stackinit_' prefix.

Cc: Kees Cook <keescook@chromium.org>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Tested-by: Fan Ni <fan.ni@samsung.com>
Link: https://lore.kernel.org/r/167601998163.1924368.6067392174077323935.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
(cherry picked from commit 93c177fd6ff0655a5fa43ec945a57d7b0200ad80)
Signed-off-by: John W. Linville <linville@redhat.com>
2023-09-15 09:34:21 -04:00
Nico Pache 3f59061e96 lib: stackinit: Convert to KUnit
commit 02788ebcf521fe78c24eb221fd1ed7f86792c330
Author: Kees Cook <keescook@chromium.org>
Date:   Wed Feb 16 16:03:41 2022 -0800

    lib: stackinit: Convert to KUnit

    Convert stackinit unit tests to KUnit, for better integration
    into the kernel self test framework. Includes a rename of
    test_stackinit.c to stackinit_kunit.c, and CONFIG_TEST_STACKINIT to
    CONFIG_STACKINIT_KUNIT_TEST.

    Adjust expected test results based on which stack initialization method
    was chosen:

     $ CMD="./tools/testing/kunit/kunit.py run stackinit --raw_output \
            --arch=x86_64 --kconfig_add"

     $ $CMD | grep stackinit:
     # stackinit: pass:36 fail:0 skip:29 total:65

     $ $CMD CONFIG_GCC_PLUGIN_STRUCTLEAK_USER=y | grep stackinit:
     # stackinit: pass:37 fail:0 skip:28 total:65

     $ $CMD CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF=y | grep stackinit:
     # stackinit: pass:55 fail:0 skip:10 total:65

     $ $CMD CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y | grep stackinit:
     # stackinit: pass:62 fail:0 skip:3 total:65

     $ $CMD CONFIG_INIT_STACK_ALL_PATTERN=y --make_option LLVM=1 | grep stackinit:
     # stackinit: pass:60 fail:0 skip:5 total:65

     $ $CMD CONFIG_INIT_STACK_ALL_ZERO=y --make_option LLVM=1 | grep stackinit:
     # stackinit: pass:60 fail:0 skip:5 total:65

    Temporarily remove the userspace-build mode, which will be restored in a
    later patch.

    Expand the size of the pre-case switch variable so it doesn't get
    accidentally cleared.

    Cc: David Gow <davidgow@google.com>
    Cc: Daniel Latypov <dlatypov@google.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    ---
    v1: https://lore.kernel.org/lkml/20220224055145.1853657-1-keescook@chromium.org
    v2:
     - split "userspace KUnit stub" into separate header and patch (Daniel)
     - Improve commit log and comments (David)
     - Provide mapping of expected XFAIL tests to CONFIGs (David)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168378
Signed-off-by: Nico Pache <npache@redhat.com>
2023-04-17 11:47:34 -06:00