lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 28 Jun 2023 21:59:22 +0800
From:   Zhangjin Wu <falcon@...ylab.org>
To:     falcon@...ylab.org, thomas@...ch.de
Cc:     arnd@...db.de, linux-kernel@...r.kernel.org,
        linux-kselftest@...r.kernel.org, w@....eu
Subject: [PATCH v1 05/17] selftests/nolibc: stat_timestamps: remove procfs dependency

Hi, Thomas

I'm preparing a revision for this series, in the past days, when I was
working on testing our new 'minimal' kernel config support for all of
the architectures, the time cost (and wait) is really appreciable and the
repeated develop and test is really a big pain, I can also image when you
was working on stack-protector and Willy was working on lots of old
features ;-)

As you explained before, I knew the idea of using '/proc/self' here is
important to not using a fixed-time file, besides our proposed method (make
sure it at least not fail, just skip for !procfs):

    - CASE_TEST(stat_timestamps);   EXPECT_SYSZR(1, test_stat_timestamps()); break;
    + CASE_TEST(stat_timestamps);   EXPECT_SYSZR(proc, test_stat_timestamps()); break;

To further avoid skip it for !procfs (I don't mean relaly disable it for the
default tinyconfig support, which need more discuss, at least provide the
possibility to pass without procfs), do you like this change? it doesn't depend
on 'proc' now.

    -	if (stat("/proc/self/", &st))
    +	if (stat("/proc/self/", &st) && stat("/init", &st) && stat("/", &st))

The "/init" is compiled for 'run' target every time, so, the time stamp should
be dynamic enough, for libc-test, the /proc/self should be always there (if
still not enough, we can reuse the init file list here), the "/" here is only
for the worst-case scene ;-)

Thanks,
Zhangjin

> Since it is not really necessary to use /proc/self here, instead of
> adding a condition check, we use the always existing '/' path instead of
> /proc/self, this eventually let it work without procfs.
> 
> Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
> ---
>  tools/testing/selftests/nolibc/nolibc-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index ebec948ec808..2ef44176f7a9 100644
> --- a/tools/testing/selftests/nolibc/nolibc-test.c
> +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> @@ -520,7 +520,7 @@ static int test_stat_timestamps(void)
>  	if (sizeof(st.st_atim.tv_sec) != sizeof(st.st_atime))
>  		return 1;
>  
> -	if (stat("/proc/self/", &st))
> +	if (stat("/", &st))
>  		return 1;
>  
>  	if (st.st_atim.tv_sec != st.st_atime || st.st_atim.tv_nsec > 1000000000)
> -- 
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ