Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4415878rwd; Tue, 30 May 2023 05:17:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5bN33VUp4NIVCxtuM+FOhe5/uAy39rUBnv8ajq8PkJ1Tsnk5UdO8VWbkJ00X9R5a+TSWkQ X-Received: by 2002:a05:6a00:2e0c:b0:647:370c:2c2a with SMTP id fc12-20020a056a002e0c00b00647370c2c2amr2490403pfb.6.1685449075582; Tue, 30 May 2023 05:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685449075; cv=none; d=google.com; s=arc-20160816; b=cGMdfXwTvDlzCabZXQ+w+rqIZvRAp9iAMA78mBxfSo2LGU2Vm//+3tZ7+bL549UGeb mydZ9Bj/ddeiON+XgigK8kL7FIE7iAsnWnkwppno5qlQKfm6J1eBsw7aWTqHdNvSZcea SP+cRwUkSIHnNOk5u65c340D61+qZ7698QNU0RcJ8mJnluKVjT8wH+0PObzHXc0lYeTc pjfBGtt6taWU1brkQ7ZEdK7+Ejb1j6TAuiJeKOa017995S4kONmUZAARKGsFBXd+8s2D LUy7iScaaUm+zPPuF3C9tW717vSh5Bvd9FO+vnhJPurUS/OtDWtjbXV3ZHVWo7mHNjKH aYvw== 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:date; bh=d1jRig8N/rZKjXEQm1suVtF2lXHhM5VBpT85FpUcE/4=; b=jqPtB00NU2Af3j+1TI4fgCjvvslxjf44y32oNn3c+8j0tSQmvcBywLjZDHOgdnQcg3 syGSb60VM4KRzLow/4wZvANaAZhHluAHwjV5HlUhPdvc6av2eqs4vwLSdmJ4fM1GRRfU iUVqlIi3Yenfk2yFhkC46WbOtA8RouPZKB/BwKcsOOBiVKdmd5AixBjm2L47uqlsNZzd 87JRr8kUqMEIogv83+x+14IcyuLwSu6Q4H5Kcz1J9jHsW/LCUHUQ9v2WdvLBDABac9Zl 4m2RUB0CJfDK388DE9L9M6HLkAap/eZHVZMSkcL8nXY/KM3pI+hWS0E8wY5G1PLVLEG9 Unbw== ARC-Authentication-Results: i=1; mx.google.com; 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 e4-20020a656784000000b00518f82d7053si10770314pgr.493.2023.05.30.05.17.42; Tue, 30 May 2023 05:17:55 -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; 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 S229713AbjE3MHd (ORCPT + 99 others); Tue, 30 May 2023 08:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjE3MHb (ORCPT ); Tue, 30 May 2023 08:07:31 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1FB071BC; Tue, 30 May 2023 05:07:10 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 34UC50Vg015106; Tue, 30 May 2023 14:05:00 +0200 Date: Tue, 30 May 2023 14:05:00 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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: References: <96f1134d-ce6e-4d82-ae00-1cd4038809c4@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <96f1134d-ce6e-4d82-ae00-1cd4038809c4@t-8ch.de> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 :-/ > 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. Willy