From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fish.tulip.relay.mailchannels.net (fish.tulip.relay.mailchannels.net [23.83.218.251]) by sourceware.org (Postfix) with ESMTPS id CD9023857347 for ; Wed, 4 May 2022 11:03:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CD9023857347 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3503812159B; Wed, 4 May 2022 11:02:59 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 80BB4121609; Wed, 4 May 2022 11:02:58 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1651662178; a=rsa-sha256; cv=none; b=qzFZuSInlJJHlOvtzwTvy05RMW72QabbPJqSSNSbOZQAYbsN6CRJufH1YRwKPrNzanGJt2 AXO2AQ3vG8y1lVbhZFGF2+VNIFaIdJ1Q15zKa9FhmPBAjDM7trPxduqE2LiS472SZMEcen SiKPgZ1NQEU0Bu7FMdIM2eyRB/eyNM6XTJnTFM64ivHPnqi41sGYyZequ2VcBpmTI2CgXp lj7VrEK8iJhCG4nbHreDBgLwh4yUd3GLnyMAeGxHHXkHuGKWADNyyQeU/HHRMbMDUNj/or w4pZhmdjF9Y8FSSNKP/X8VS6FMon4NWw2wR4b07aNw8Lp3AgTDWHwuY7ApOtvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1651662178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hIzNug3hDRq4BqpmjYDJC7Zy+jEEOJw61sNNw6+sfj4=; b=KI2LGzeS+cDHW935wG9vfrdr+xR/k/Gb8AWj9nyTPi7PxScTG09xW/0db2IufuWNh8NJkR XpcRjEnrUq4iVVhinEPQbrjn9AJi9bL6cZ7muK0JINDpryH3DaFNp9An4P+izWWqgGcjUc 3TLDxBFVhEV3+PqUpReDTm7p4skS5pTahhzOThafUE2nnVJllvWeHtc9FeOhN2KUV6lNkM T1iYbre5cnslZr7SqLWXqBTTNVrula6b0dvvFsMqec79/5asyTmGLsgbNF5PUJqWUiWHe2 J/QHIMVG7Rxa9P5vUgk+4Ro8Iw6urfqDTYCfPHyGUQWnAaLpvsx5Fn5BYoxfZg== ARC-Authentication-Results: i=1; rspamd-fdd564cbf-lb699; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Occur-Skirt: 24ccf484439e8605_1651662179023_137778035 X-MC-Loop-Signature: 1651662179022:4216078727 X-MC-Ingress-Time: 1651662179022 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.105.211.134 (trex/6.7.1); Wed, 04 May 2022 11:02:59 +0000 Received: from [192.168.1.174] (unknown [1.186.223.145]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4KtYp61r2Wz36; Wed, 4 May 2022 04:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1651662178; bh=hIzNug3hDRq4BqpmjYDJC7Zy+jEEOJw61sNNw6+sfj4=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=hdyVdfttPXjZS/VOXuoju6tdwPdXPMnnECD9KFt1WVvklC0tyP2nivK4RFbheTzzD 74bRLNKveiVdEwcCXKckER0V792uTxXW6cvWsJZapxDpYe1DajiUii2ncSNo+E0DkX HiVkLZRayCSQZHXAlpdy/iknAwngPHLUtw19Z/PQlUELSFm9pVR9AooQdEDk0dMqsk 7TeBq0p9FtPpnY1g/Zklrpp/xE6uI9dUwGVr4VBTtuTQPBmtRXWiAgzVvBJkbW3ixV 6gzZPHjHyzT1BT/aA1k33ROc0CDwaxggSW1vkRUSchknnaWuWQorauvMpJp6JuIGZW ZUn0/WdCE5qIA== Message-ID: <932bcc36-9832-4701-b468-c4071db7dd1a@gotplt.org> Date: Wed, 4 May 2022 16:32:49 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 4/4] clock_settime/clock_gettime: Use __nonnull to avoid null pointer Content-Language: en-US To: Xiaoming Ni , drepper@redhat.com, lukma@denx.de, adrian.ratiu@collabora.com, schwab@linux-m68k.org, fweimer@redhat.com, adhemerval.zanella@linaro.org Cc: libc-alpha@sourceware.org, wangle6@huawei.com References: <20220428122529.108208-1-nixiaoming@huawei.com> <20220428122529.108208-5-nixiaoming@huawei.com> From: Siddhesh Poyarekar In-Reply-To: <20220428122529.108208-5-nixiaoming@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3038.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 04 May 2022 11:03:14 -0000 On 28/04/2022 17:55, Xiaoming Ni via Libc-alpha wrote: > clock_settime() > clock_settime64() > clock_gettime() > clock_gettime64() > Add __nonnull((2)) to avoid null pointer access. > > Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 > Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 > Signed-off-by: Xiaoming Ni > --- > include/time.h | 4 ++-- > time/time.h | 9 ++++++--- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/include/time.h b/include/time.h > index 127347eb90..a64eff54f5 100644 > --- a/include/time.h > +++ b/include/time.h > @@ -166,7 +166,7 @@ libc_hidden_proto (__timegm64) > # define __clock_settime64 __clock_settime > #else > extern int __clock_settime64 (clockid_t clock_id, > - const struct __timespec64 *tp); > + const struct __timespec64 *tp) __nonnull((2)); > libc_hidden_proto (__clock_settime64) > #endif > > @@ -324,7 +324,7 @@ extern int __clock_nanosleep_time64 (clockid_t clock_id, > int flags, const struct __timespec64 *req, > struct __timespec64 *rem); > libc_hidden_proto (__clock_nanosleep_time64) > -extern int __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp); > +extern int __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) __nonnull((2)); > libc_hidden_proto (__clock_gettime64) > extern int __timespec_get64 (struct __timespec64 *ts, int base); > libc_hidden_proto (__timespec_get64) > diff --git a/time/time.h b/time/time.h > index 847ac3f8c0..26f276f147 100644 > --- a/time/time.h > +++ b/time/time.h > @@ -276,11 +276,12 @@ extern int nanosleep (const struct timespec *__requested_time, > extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; > > /* Get current value of clock CLOCK_ID and store it in TP. */ > -extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; > +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) > + __THROW __nonnull((2)); > > /* Set clock CLOCK_ID to value TP. */ > extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) > - __THROW; > + __THROW __nonnull((2)); > # else > # ifdef __REDIRECT > extern int __REDIRECT (nanosleep, (const struct timespec *__requested_time, > @@ -291,8 +292,10 @@ extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id, > __clock_getres64); > extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id, struct > timespec *__tp), __clock_gettime64); The semicolon at the end needs to go away. This was also caught by patchwork trybot: https://patchwork.sourceware.org/project/glibc/patch/20220428122529.108208-5-nixiaoming@huawei.com/ https://www.delorie.com/trybots/32bit/8846/make.tail.txt > + __nonnull((2)); > extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct > - timespec *__tp), __clock_settime64); > + timespec *__tp), __clock_settime64) > + __nonnull((2)); > # else > # define nanosleep __nanosleep64 > # define clock_getres __clock_getres64