Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1124938ybg; Wed, 23 Oct 2019 10:43:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoRby4WctMaJsZtTbiQTD+/ZzW2hd5qA3spqrtmRrHXvBFblc61Yr+55YAxWTvoZYyTGxx X-Received: by 2002:aa7:c484:: with SMTP id m4mr8781168edq.177.1571852582366; Wed, 23 Oct 2019 10:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571852582; cv=none; d=google.com; s=arc-20160816; b=u4P/derJIIT27yU1eSv1L6d7tY4jjUUMtFgV8zRgeF0aSzttAOCjWaNA2zDpT3rhP4 XXcwEj/AUvKXNV4Dd5ELFs4d6W6MG6FEqsBmrrYHO2FKIHpp9o/+tLK9MtD0MdRiIb16 TkdiVkVnotiL4flI/yuvPE+BZI4NmW+UPos4Rqmv29q+MZ1LTn3KJBBohKOlqiG8aaaK EJhmIKybnJWyvIEhqSHKsnlXsmBdYxyBC0Mf9/ILR8bm1Ex4uZv9ZERGsSRxq2bVY9xr irsIqtVKmRI2OfURPXl7qWttF5xNWyASplUUsSbW4jH6FARxrbxwFICHx4eCOocpFlXK 73Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=jYwUsLlAaAs/MyonAXQlgm1HwhQV82hYq4fsDOHJ28Q=; b=vIyVeL/ZnJkdI6rSSeGkOBe6jvSNTaqWBN5pfSj9cHJ4YTbBD0rTRguuUbTdjIIKw4 UQzOCA+1xSB3IrxFZeF+JcDJzSiRL36MyNaqjrjOoQtgkuTi+ohNXbxk56Vj63lp0R59 V/wkbSrojrbw6H+j45yynd/mH5MPVpC0S96CLpDhHYcC+y5J424y5HyusRVgsmiO3a9K b77ac031EBuWT5cU7m5ERumGrsSbaKH9kUlbd7NJFflKLDNwU7WIjgU+k2keaDmgiDEn zmG7zmOC5Pxi6463V9KvsJ9Gn2Fr44amxDXUVAdYS4FCye1acZuYWeepENZnz/QhTToJ SXOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p19si5366149ejj.85.2019.10.23.10.42.38; Wed, 23 Oct 2019 10:43:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391807AbfJWMvC (ORCPT + 99 others); Wed, 23 Oct 2019 08:51:02 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:49246 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391775AbfJWMvA (ORCPT ); Wed, 23 Oct 2019 08:51:00 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iNG6I-0001hf-3r; Wed, 23 Oct 2019 14:50:54 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id AF66D1C0089; Wed, 23 Oct 2019 14:50:53 +0200 (CEST) Date: Wed, 23 Oct 2019 12:50:53 -0000 From: "tip-bot2 for Thomas Gleixner" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] lib/vdso: Make clock_getres() POSIX compliant again Cc: Andreas Schwab , Thomas Gleixner , Christophe Leroy , stable@vger.kernel.org, Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <157183505345.29376.7588508845309452690.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/urgent branch of tip: Commit-ID: 1638b8f096ca165965189b9626564c933c79fe63 Gitweb: https://git.kernel.org/tip/1638b8f096ca165965189b9626564c933c79fe63 Author: Thomas Gleixner AuthorDate: Mon, 21 Oct 2019 12:07:15 +02:00 Committer: Thomas Gleixner CommitterDate: Wed, 23 Oct 2019 14:48:23 +02:00 lib/vdso: Make clock_getres() POSIX compliant again 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 Signed-off-by: Thomas Gleixner Tested-by: Christophe Leroy Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1910211202260.1904@nanos.tec.linutronix.de --- lib/vdso/gettimeofday.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index e630e7f..45f57fd 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -214,9 +214,10 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) 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 @@ __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res) 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; }