From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by sourceware.org (Postfix) with ESMTPS id 5331E3851C3C for ; Wed, 1 Jul 2020 00:07:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5331E3851C3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49xM3R446bz1rsXP; Wed, 1 Jul 2020 02:06:59 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49xM3R3ffHz1r56h; Wed, 1 Jul 2020 02:06:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 4_P5UKLVnnSi; Wed, 1 Jul 2020 02:06:58 +0200 (CEST) X-Auth-Info: RKtnizPYCMt9MnE8zBDky0IMXU+fpmQaA4VhLreD1Cg= Received: from jawa (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 1 Jul 2020 02:06:58 +0200 (CEST) Date: Wed, 1 Jul 2020 02:06:57 +0200 From: Lukasz Majewski To: Florian Weimer Cc: libc-alpha@sourceware.org, Adhemerval Zanella Subject: Re: [PATCH v2] Linux: Fix UTC offset setting in settimeofday for __TIMESIZE != 64 Message-ID: <20200701020657.1df8f044@jawa> In-Reply-To: <87lfk4mlz6.fsf@oldenburg2.str.redhat.com> References: <87lfk4mlz6.fsf@oldenburg2.str.redhat.com> Organization: denx.de X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/rCm8hCclO96PH7U5U.ECBEQ"; protocol="application/pgp-signature" X-Spam-Status: No, score=-20.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2020 00:07:01 -0000 --Sig_/rCm8hCclO96PH7U5U.ECBEQ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 30 Jun 2020 20:45:17 +0200 Florian Weimer wrote: > The time argument is NULL in this case, and attempt to convert it > leads to a null pointer dereference. >=20 > This fixes commit d2e3b697da2433c08702f95c76458c51545c3df1 > ("y2038: linux: Provide __settimeofday64 implementation"). >=20 > --- > v2: Add just a null pointer check. Tested on x86_64-linux-gnu and > i686-linux-gnu. >=20 > sysdeps/unix/sysv/linux/settimeofday.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) >=20 > diff --git a/sysdeps/unix/sysv/linux/settimeofday.c > b/sysdeps/unix/sysv/linux/settimeofday.c index ea45f1d7cb..6f4bc7ef3c > 100644 --- a/sysdeps/unix/sysv/linux/settimeofday.c > +++ b/sysdeps/unix/sysv/linux/settimeofday.c > @@ -25,6 +25,7 @@ > int > __settimeofday64 (const struct __timeval64 *tv, const struct > timezone *tz) { > + /* Backwards compatibility for setting the UTC offset. */ > if (__glibc_unlikely (tz !=3D 0)) > { > if (tv !=3D 0) > @@ -45,9 +46,13 @@ libc_hidden_def (__settimeofday64) > int > __settimeofday (const struct timeval *tv, const struct timezone *tz) > { > - struct __timeval64 tv64 =3D valid_timeval_to_timeval64 (*tv); > - > - return __settimeofday64 (&tv64, tz); > + if (__glibc_unlikely (tv =3D=3D NULL)) > + return __settimeofday64 (NULL, tz); > + else > + { > + struct __timeval64 tv64 =3D valid_timeval_to_timeval64 (*tv); > + return __settimeofday64 (&tv64, tz); > + } > } > #endif > weak_alias (__settimeofday, settimeofday); >=20 Reviewed-by: Lukasz Majewski Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/rCm8hCclO96PH7U5U.ECBEQ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl7706EACgkQAR8vZIA0 zr2c5Af5Aefj0qFAPvP2HbE4YtPq+fZd3UB1VJE2eLt7EZP+s2u+Mzc8iObWaH8v vauRIkW3EQysdzk7XAH1I3DZHNC+GMqxq6QgwB9jungIqSvKt6SAPU/FCz2xi8RM V/NvrmvGzSvddusLqTjDoxu+W1EA21NswaNSXUCqblTaafn34prmdY/Zd+4RZiPj i3JJrMHXDJ0FZUTVGApnvoRCMONFcu5wr4vxDF3hGKtOi39NIeILe5AG0sWverWb YEXh91ZBl1NOQlPJl46ePJE9lloFjNF3JGJ7/7H5yVzHJw3p6AdGXis3F08yCwK5 8Cw50+Mdth4snLRr4P59xsKHtEtklA== =bwIl -----END PGP SIGNATURE----- --Sig_/rCm8hCclO96PH7U5U.ECBEQ--