• Mickaël Salaün's avatar
    selftests/harness: Share _metadata between forked processes · 24cf65a6
    Mickaël Salaün authored
    Unconditionally share _metadata between all forked processes, which
    enables to actually catch errors which were previously ignored.
    
    This is required for a following commit replacing vfork() with clone3()
    and CLONE_VFORK (i.e. not sharing the full memory) .  It should also be
    useful to share _metadata to extend expectations to test process's
    forks.  For instance, this change identified a wrong expectation in
    pidfd_setns_test.
    
    Because this _metadata is used by the new XFAIL_ADD(), use a global
    pointer initialized in TEST_F().  This is OK because only XFAIL_ADD()
    use it, and XFAIL_ADD() already depends on TEST_F().
    
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Shuah Khan <skhan@linuxfoundation.org>
    Cc: Will Drewry <wad@chromium.org>
    Reviewed-by: default avatarKees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/20240511171445.904356-9-mic@digikod.netSigned-off-by: default avatarMickaël Salaün <mic@digikod.net>
    24cf65a6
kselftest_harness.h 34.1 KB