From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by sourceware.org (Postfix) with ESMTPS id EC8D43858C2C for ; Tue, 21 Dec 2021 12:52:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC8D43858C2C Received: by mail-qv1-xf2d.google.com with SMTP id kk22so12335104qvb.0 for ; Tue, 21 Dec 2021 04:52:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pX1ytVg1DFWtZ7xGwjVzisPPPme3jhgemzW69ApRg7g=; b=j4jiBqMAdN6K1k+YiaP1NpJKafJdWScszVQVrb9fmnoTJ0IGD53sjjc8mBMtNpVSMR v+ah8wYNBoKIDljXo/aOga3RTflWEVyXuSKTMSCkDZC8s+C1iJmcEjlA843FTJpsHHXy p1CLnTovm54QdphM6lppDu88eLVHYiLRavfbKKOePFiuM1sBtoVMaSF2q6OLXFiRpb70 UwfPUcGWMAzbEvI4d06n5risUpOdHeNRB578b9JfCVF9CiZCmBqZcSayMd6hp6Rx0DoM mUXByHki8VBu+NDMyJ9mxueWhYXyAZx/VUBBGQxs3qxHONUDifuYv6NgYMceYGmG3ttg rnaw== X-Gm-Message-State: AOAM531bWQP2lplW9iCUxkR2Pi449ODW5IrMeHamv3MQD+D/Bip78Bz4 JmtR+Wbp8ZPAoed1gQ1dHavb2jklfe5tdA== X-Google-Smtp-Source: ABdhPJzdWo4ydnRb82zfVZTtkb2w6mgmDA5F11z3xYlE0vVMzfFL6P1vlGoQcw3cK0nkB+iBFdHbOQ== X-Received: by 2002:a05:6214:1c4b:: with SMTP id if11mr2022430qvb.9.1640091171370; Tue, 21 Dec 2021 04:52:51 -0800 (PST) Received: from birita.. ([2804:431:c7cb:3b1e:8bd2:32a9:e2a3:1842]) by smtp.gmail.com with ESMTPSA id k19sm14155958qko.73.2021.12.21.04.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 04:52:51 -0800 (PST) From: Adhemerval Zanella To: libc-stable@sourceware.org Cc: maminjie Subject: [COMMITTED 2.34] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32 Date: Tue, 21 Dec 2021 09:52:38 -0300 Message-Id: <20211221125238.3993765-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2021 12:52:53 -0000 From: maminjie When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID, on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully ( because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S does not support these two IDs, the 32-bit time_t syscall will be used), but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used, resulting in two system calls. Fix commit 72e84d1db22203e01a43268de71ea8669eca2863. Signed-off-by: maminjie Reviewed-by: Adhemerval Zanella (cherry picked from commit e0fc721ce600038dd390e77cfe52440707ef574d) --- sysdeps/unix/sysv/linux/clock_gettime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c index 91df6b3d96..9c7d907325 100644 --- a/sysdeps/unix/sysv/linux/clock_gettime.c +++ b/sysdeps/unix/sysv/linux/clock_gettime.c @@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) { struct timespec tp32; r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32); - if (r == 0 && tp32.tv_sec > 0) + if (r == 0 && tp32.tv_sec >= 0) { *tp = valid_timespec_to_timespec64 (tp32); return 0; -- 2.32.0