Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4460544rwd; Tue, 30 May 2023 05:53:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UUlxQPKbLBoRcqMMr+j3e2JV5JmbiOJCnmDozR+GTVSLi0IP+5kzAoSmHJB2iWqK673iM X-Received: by 2002:a17:90a:c695:b0:256:c44d:e115 with SMTP id n21-20020a17090ac69500b00256c44de115mr1688153pjt.12.1685451237235; Tue, 30 May 2023 05:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685451237; cv=none; d=google.com; s=arc-20160816; b=T6j0hDbA5sllDrUyDElffbebpC6vXRyS09vAahGFbnRQP1oHlQPge7YMnCH2ldxp2a s7Oyc4Ji1MSCD9+pP5Jiuul5wjdkcESFR8Gs4K9g3h0PkFFXo64/z5bTjFzGfHORoPFI NANcYtUrrs+62K/ql4CjnINLsNx/Mj3HIXl2bdHb2baEkzUY0yFcF/9Zl3/xHDndM13u qH7t+d5IHFgywwIckTpO3SCrniAvtsyaS8fBr5pImfAYTYYU7M3HwKvfOwOwTZi6Cyzh rBHjnYK7mKmBvEv81SQ1XoLcOIIWnHX15WQWGvKrLpdLC8QUeKT369bLC60bBkjvWZCQ kkVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=6bi2nwtdrhGf/0p47pDAU8Q5lWN+IBCQs3nc0JV4GAY=; b=KaKIIu3g6TnzqDZ2uiEgku9JbLeaLdFeIKJS7Jk58Oo+RlZTjgBIBSy3qTbZECpBgz cTROenT4J8ebvUEDPjLeGAw2ONDfKS5Kvfb/2Gt6PQ9yXmC8pFETpD/Gb9kobAaQKR2C fl+613Qqg5InUR96fm4iRQcTzNFjE8j1lL57kBPt3QjVWiSnDpWvrwcO0XAafZOwQL2d AoFrD3vW0MQVcdgLSsy5gGcfl9MRTCk3dRp2M04TQdccCtdmBz5ZUFDW/tbp51PG/cb4 YLjocRoJtEUlF/YUgcKnrkUIjgVMO0phMSw2tpyIaw0WQmjQX5zaIVnoYAu82dOfaXuy bEWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=aaUm6cUu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id em5-20020a17090b014500b002470f78a168si3620123pjb.104.2023.05.30.05.53.45; Tue, 30 May 2023 05:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=aaUm6cUu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232255AbjE3Mhg (ORCPT + 99 others); Tue, 30 May 2023 08:37:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232069AbjE3MhH (ORCPT ); Tue, 30 May 2023 08:37:07 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FDA3E62; Tue, 30 May 2023 05:36:14 -0700 (PDT) Date: Tue, 30 May 2023 14:35:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1685450155; bh=b3RCf6QIsO9f8zMyCggnyJj6PukOHn5wfBsC9TyQ1dE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aaUm6cUuHuaFhYQTwVcQ8AU/Wy8mBIiJ/R3mHoNxiPxQz1KzFcDN1HXTfFZMb/siM W1SeYr2d2cqcmrKpifP1LvSyQYqpsBn/xM+fCTxjMDhGX2sH3Zk+q4IC8VDq6AfPD9 BcTjuZ7qSBbMWtGpL7dezm09CozCCIVVxioGDLA8= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Zhangjin Wu , arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH 1/2] selftests/nolibc: add new gettimeofday test cases Message-ID: <280867a8-7601-4a96-9b85-87668e1f1282@t-8ch.de> References: <96f1134d-ce6e-4d82-ae00-1cd4038809c4@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_HELO_TEMPERROR,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-05-30 14:05:00+0200, Willy Tarreau wrote: > On Tue, May 30, 2023 at 12:59:31PM +0200, Thomas Weißschuh wrote: > > On 2023-05-30 14:37:49+0800, Zhangjin Wu wrote: > > > These 3 test cases are added to cover the normal using scenes of > > > gettimeofday(). > > > > > > They have been used to trigger and fix up such issue: > > > > > > nolibc-test.c:(.text.gettimeofday+0x54): undefined reference to `__aeabi_ldivmod' > > > > > > This issue happens while there is no "unsigned int" conversion in the > > > new clock_gettime / clock_gettime64 syscall path of gettimeofday(): > > > > > > tv->tv_usec = ts.tv_nsec / 1000; > > > > > > Signed-off-by: Zhangjin Wu > > > --- > > > tools/testing/selftests/nolibc/nolibc-test.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > > index 8ba8c2fc71a0..20d184da9a2b 100644 > > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > > @@ -533,6 +533,8 @@ static int test_stat_timestamps(void) > > > */ > > > int run_syscall(int min, int max) > > > { > > > + struct timeval tv; > > > + struct timezone tz; > > > struct stat stat_buf; > > > int euid0; > > > int proc; > > > @@ -588,6 +590,9 @@ int run_syscall(int min, int max) > > > CASE_TEST(getdents64_root); EXPECT_SYSNE(1, test_getdents64("/"), -1); break; > > > CASE_TEST(getdents64_null); EXPECT_SYSER(1, test_getdents64("/dev/null"), -1, ENOTDIR); break; > > > CASE_TEST(gettimeofday_null); EXPECT_SYSZR(1, gettimeofday(NULL, NULL)); break; > > > + CASE_TEST(gettimeofday_tv); EXPECT_SYSZR(1, gettimeofday(&tv, NULL)); break; > > > + CASE_TEST(gettimeofday_tz); EXPECT_SYSZR(1, gettimeofday(NULL, &tz)); break; > > > > Calling gettimeofday(NULL, ...) will actually segfault on glibc. > > It works when calling through the VDSO, but not the logic in glibc > > itself, which is guess is allowed by POSIX. > > Then that's shocking, because the man page says: > > If either tv or tz is NULL, the corresponding structure is not set or > returned. (However, compilation warnings will result if tv is NULL.) > > I'd expect glibc to at least support what'd documented in the man > page :-/ That is gettimeofday(2), which comes from the Linux man-pages project. gettimeofday(3p) which specifies the posix function does not have that wording. It also specifies that there is no way to indicate errors... Seems to be a weird situation. > > I propose to avoid doing it :-) > > If you're certain that's the case, then I agree. > > > Either we gate the existing test in #ifdef NOLIBC or we remove it. > > Better not keep tests specific to nolibc if they aim at verifying some > compatibliity. Thomas