From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Thomas Gleixner <tglx@linutronix.de>,
Andreas Schwab <schwab@linux-m68k.org>
Cc: Nathan Lynch <nathanl@linux.ibm.com>,
"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
LKML <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] lib/vdso: Make clock_getres() POSIX compliant again
Date: Mon, 21 Oct 2019 17:23:42 +0200 [thread overview]
Message-ID: <fb552fd1-99e4-0685-c41f-3e4e0efc46ec@c-s.fr> (raw)
In-Reply-To: <alpine.DEB.2.21.1910211202260.1904@nanos.tec.linutronix.de>
Le 21/10/2019 à 12:07, Thomas Gleixner a écrit :
> A recent commit removed the NULL pointer check from the clock_getres()
> implementation causing a test case to fault.
>
> POSIX requires an explicit NULL pointer check for clock_getres() aside of
> the validity check of the clock_id argument for obscure reasons.
>
> Add it back for both 32bit and 64bit.
>
> Note, this is only a partial revert of the offending commit which does not
> bring back the broken fallback invocation in the the 32bit compat
> implementations of clock_getres() and clock_gettime().
>
> Fixes: a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer checks")
> Reported-by: Andreas Schwab <schwab@linux-m68k.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: stable@vger.kernel.org
> ---
> lib/vdso/gettimeofday.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> --- a/lib/vdso/gettimeofday.c
> +++ b/lib/vdso/gettimeofday.c
> @@ -214,9 +214,10 @@ int __cvdso_clock_getres_common(clockid_
> return -1;
> }
>
> - res->tv_sec = 0;
> - res->tv_nsec = ns;
> -
> + if (likely(res)) {
> + res->tv_sec = 0;
> + res->tv_nsec = ns;
> + }
> return 0;
> }
>
> @@ -245,7 +246,7 @@ static __maybe_unused int
> ret = clock_getres_fallback(clock, &ts);
> #endif
>
> - if (likely(!ret)) {
> + if (likely(!ret && res)) {
> res->tv_sec = ts.tv_sec;
> res->tv_nsec = ts.tv_nsec;
> }
>
next prev parent reply other threads:[~2019-10-21 15:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0fc22a08-31d9-e4d1-557e-bf5b482a9a20__6444.28012180782$1571503753$gmane$org@c-s.fr>
2019-10-19 19:18 ` passing NULL to clock_getres (VDSO): terminated by unexpected signal 11 Andreas Schwab
2019-10-20 9:20 ` Christophe Leroy
2019-10-20 9:53 ` Andreas Schwab
2019-10-20 10:25 ` Christophe Leroy
2019-10-20 11:44 ` Thomas Gleixner
2019-10-20 12:07 ` Andreas Schwab
2019-10-20 15:45 ` Thomas Gleixner
2019-10-20 16:08 ` Andreas Schwab
2019-10-20 19:53 ` Thomas Gleixner
2019-10-20 21:17 ` Andreas Schwab
2019-10-21 10:07 ` [PATCH] lib/vdso: Make clock_getres() POSIX compliant again Thomas Gleixner
2019-10-21 15:23 ` Christophe Leroy [this message]
2019-10-21 9:03 ` passing NULL to clock_getres (VDSO): terminated by unexpected signal 11 David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb552fd1-99e4-0685-c41f-3e4e0efc46ec@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=luto@kernel.org \
--cc=nathanl@linux.ibm.com \
--cc=schwab@linux-m68k.org \
--cc=tglx@linutronix.de \
--cc=vincenzo.frascino@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).