From patchwork Mon Jul 20 22:32:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 1332660 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=i2JE9THn; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OXplKw8U; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B9c334y6Kz9sRR for ; Tue, 21 Jul 2020 08:34:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BSF2R4oeF6E5LAF8WZBda1DQQSWwNqmPb34R/2DmJ1I=; b=i2JE9THnIpfDja1/tC3vKnv3+S URYp73ACn8PDSpt03AtqnD05jDBKW5pYSnVvNOhpG5flKzfchbk2VwexTUm/xrkj7xvRmSQYM8t6m 42ELRCh6I+AxrGwbQfYhqY/E8HQM2Vnd917U6WW1tsmIif+wfxTmUGHLK3YScPNjyZM8FF8kpc/Ns ugQpE784FW5EBbFCDf2ayYS4sWngLAlLTu8cSctCydaxGAJQLlAxrx50EnfQxNHzuIte9aSNeOrYi t8d5zg+QkIeTRrqwLahv5qeY0mA0aM/HcR9lHD+/GesYS5lffsC0MLqpPzs7ruEnjCaYU6A7MLYNB Iscdcmdw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxeLF-000478-PU; Mon, 20 Jul 2020 22:33:01 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxeLD-00046A-Qb for openwrt-devel@lists.openwrt.org; Mon, 20 Jul 2020 22:33:00 +0000 Received: by mail-pf1-x444.google.com with SMTP id s26so9770996pfm.4 for ; Mon, 20 Jul 2020 15:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KHoV7Z2zE1kEdMyxNJzwVGPfGaqWvvPT2h7n2fdK5UE=; b=OXplKw8Uo2oaGwwbc3O6jpmgT6iKcmhCsMXk4euYwOGHjG4dvck3WNY6Nj2Bnlwx/t 3jt4VEMqiHfnBEQaPMTTPfFai5TTodkSzSnYoQkQn4cbVMq2/RH4DsUYPyzQdOQ6Btqc vEck6G5+uu+4Bj5+0JGeps0cWhTsmG1+I8cRspeFhErYdVJ6KRyFmgIguGf6PU9re1qv PR9xqSVYkzaQlwCuh/ldp+uOzJo1BwVvK2UpomyqqjsfRssLGFHVGD7hucahjXHmiOM+ 5vSApTRxMVy1cWkirzCra39DI5ZogaomIcfYZ0PyZLLtH6XZl400v/nBw3V6Bj9qG4YE PQ3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KHoV7Z2zE1kEdMyxNJzwVGPfGaqWvvPT2h7n2fdK5UE=; b=LBM9s5X8XKj8VI/VN7IQjlnNgj1oswWuazi5pNjZbKt9nHLA7SJKFfIxGwbye3uLwl sTZuJlv7oJzxjECCm443Hcc9qrZYqT3Ny27nMI+jpfOJZhfpfZOOQibLRWJHu3maL9/W dc4mHsVEmsQ2p8khfwcldyv1GNNiA6Mp0WVM1AUg8+33vzLNhRcdhE41IkcvXe3cnDG5 s0oEGIVTAOVyVFLvyju3X37hAdFMnezJyP/NsAccLosw7fF7rH60W6K60Q/glXJZ8zsl 9ND8sFDDq31tnTuvgz+WQEHOYlV/96zuT5L6wsHDyTFh3OwJ4rUgCc0rdj0/HvgYJc27 LWIA== X-Gm-Message-State: AOAM531TuhiFIWnzKWltav81i3/y2kmIb4Byk4828xpL/CKFky02iTu2 GhYTTCWrm35szPBOKEBRgOwBONz6 X-Google-Smtp-Source: ABdhPJxzClMIRRHPdrazs0I8ZQczD6uOtS56U6tgvy2aafgs5MaxEiQFarjHCGFQ9KwuYaVTvuWkQg== X-Received: by 2002:aa7:968d:: with SMTP id f13mr323868pfk.279.1595284376266; Mon, 20 Jul 2020 15:32:56 -0700 (PDT) Received: from mangix-trapnet.lan ([2001:470:1f05:79e::a89]) by smtp.gmail.com with ESMTPSA id e20sm17540902pfl.212.2020.07.20.15.32.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 15:32:55 -0700 (PDT) From: Rosen Penev To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/2] busybox: backport extra time patches Date: Mon, 20 Jul 2020 15:32:53 -0700 Message-Id: <20200720223253.80526-2-rosenp@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200720223253.80526-1-rosenp@gmail.com> References: <20200720223253.80526-1-rosenp@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200720_183259_917058_C1A852FA X-CRM114-Status: GOOD ( 15.31 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rosenp[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org They fix compilation with musl 1.2.0, which uses 64-bit time_t. Signed-off-by: Rosen Penev --- .../utils/busybox/patches/002-time64.patch | 46 ++++++++++++++++++ .../utils/busybox/patches/003-gettime.patch | 48 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 package/utils/busybox/patches/002-time64.patch create mode 100644 package/utils/busybox/patches/003-gettime.patch diff --git a/package/utils/busybox/patches/002-time64.patch b/package/utils/busybox/patches/002-time64.patch new file mode 100644 index 0000000000..7f8c6bfe5d --- /dev/null +++ b/package/utils/busybox/patches/002-time64.patch @@ -0,0 +1,46 @@ +From 902d3992922fc8db8495d5fb30a4581711b60c62 Mon Sep 17 00:00:00 2001 +From: Alistair Francis +Date: Wed, 18 Sep 2019 09:28:50 -0700 +Subject: time: Use 64 prefix syscall if we have to + +Some 32-bit architectures no longer have the 32-bit time_t syscalls. +Instead they have suffixed syscalls that returns a 64-bit time_t. If +the architecture doesn't have the non-suffixed syscall and is using a +64-bit time_t let's use the suffixed syscall instead. + +This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel +headers. + +If an architecture only supports the suffixed syscalls, but is still +using a 32-bit time_t report a compilation error. This avoids us have to +deal with converting between 64-bit and 32-bit values. There are +currently no architectures where this is the case. + +Signed-off-by: Alistair Francis +Signed-off-by: Denys Vlasenko +--- + libbb/time.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +(limited to 'libbb/time.c') + +diff --git a/libbb/time.c b/libbb/time.c +index cab0ad602..b6fcae28b 100644 +--- a/libbb/time.c ++++ b/libbb/time.c +@@ -257,7 +257,14 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) + * typically requiring -lrt. We just skip all this mess */ + static void get_mono(struct timespec *ts) + { ++#if defined(__NR_clock_gettime) + if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts)) ++#elif __TIMESIZE == 64 ++ if (syscall(__NR_clock_gettime64, CLOCK_MONOTONIC, ts)) ++#else ++# error "We currently don't support architectures without " \ ++ "the __NR_clock_gettime syscall and 32-bit time_t" ++#endif + bb_error_msg_and_die("clock_gettime(MONOTONIC) failed"); + } + unsigned long long FAST_FUNC monotonic_ns(void) + diff --git a/package/utils/busybox/patches/003-gettime.patch b/package/utils/busybox/patches/003-gettime.patch new file mode 100644 index 0000000000..8ad4804179 --- /dev/null +++ b/package/utils/busybox/patches/003-gettime.patch @@ -0,0 +1,48 @@ +From be5a505d771a77c640acc35ceaa470c80e62f954 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Thu, 24 Oct 2019 16:26:55 +0200 +Subject: Remove syscall wrappers around clock_gettime, closes 12091 + +12091 "Direct use of __NR_clock_gettime is not time64-safe". + +function old new delta +runsv_main 1698 1712 +14 +startservice 378 383 +5 +get_mono 31 25 -6 +date_main 932 926 -6 +gettimeofday_ns 17 - -17 +------------------------------------------------------------------------------ +(add/remove: 0/1 grow/shrink: 2/2 up/down: 19/-29) Total: -10 bytes + +Signed-off-by: Denys Vlasenko +--- + libbb/time.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +(limited to 'libbb/time.c') + +diff --git a/libbb/time.c b/libbb/time.c +index b6fcae28b..e66a9cba8 100644 +--- a/libbb/time.c ++++ b/libbb/time.c +@@ -253,18 +253,9 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) + #define CLOCK_MONOTONIC 1 + #endif + +-/* libc has incredibly messy way of doing this, +- * typically requiring -lrt. We just skip all this mess */ + static void get_mono(struct timespec *ts) + { +-#if defined(__NR_clock_gettime) +- if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts)) +-#elif __TIMESIZE == 64 +- if (syscall(__NR_clock_gettime64, CLOCK_MONOTONIC, ts)) +-#else +-# error "We currently don't support architectures without " \ +- "the __NR_clock_gettime syscall and 32-bit time_t" +-#endif ++ if (clock_gettime(CLOCK_MONOTONIC, ts)) + bb_error_msg_and_die("clock_gettime(MONOTONIC) failed"); + } + unsigned long long FAST_FUNC monotonic_ns(void) +