From patchwork Fri Aug 7 04:44:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masafumi UTSUGI X-Patchwork-Id: 1342101 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=none (p=none dis=none) header.from=allied-telesis.co.jp 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 4BNCX10CWyz9sTN for ; Fri, 7 Aug 2020 14:47:27 +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:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=2oo9z/+k/kR+V6yFkLe/jLNjSf4XIA3LuKosJ7htsV8=; b=kdhHbQdvOp85CkcOOUClAw0UBY uo6YVz+SokKnNG4sjwIxW48ER/2VmnO1gJO79+FrKWoUgrGyOVRpwFMx0Tm6zyXDc1AlLIEkJ1mvD vJ2CnqJXcSe7CwK/c7/0hmHuuVyqiEVb+NLGbbONqaW6nAHUt8enCYEAAWPZaVmOHHgBxnWS7xivM 2akQbOwtKELtAF5sOORf8uptO2jnoDQYtYGZZbxW3yD7bL1yn1RflFdBktmBxbMt4cPUJYW3mY9Zc iGq3ZsLyopTpyRBJLOfSOp1aFRdSyJRBsP4sl1sVWwiW6zxlEZX73hFIPxrimMG+GeEZMG+NrkYcy uXiuiHCA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3uFe-0001nA-Gm; Fri, 07 Aug 2020 04:45:06 +0000 Received: from mail1.bemta24.messagelabs.com ([67.219.250.112]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3uFa-0001ll-GD for openwrt-devel@lists.openwrt.org; Fri, 07 Aug 2020 04:45:05 +0000 Received: from [100.112.132.67] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-1.bemta.az-b.us-west-2.aws.symcld.net id B4/F5-29381-54CDC2F5; Fri, 07 Aug 2020 04:44:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsUyLfyHiK7rHZ1 4gzMTtSwuHX/O7MDosfnsD+YAxijWzLyk/IoE1owlH7pYChZJVKzc5dHAeE+4i5GLQ0hgDqNE a9M2NgjnP6PEsbs/gBxODjYBJYm+u1PZQWwRAWWJXetnMYHYzAJGEhdOHgKzhQXsJbZs/Q9Uz 8HBIqAq0btWACTMK+AjcWPvGxYQW0JATuLmuU5mkBIhAU2JiT+qIcLBEm9PbWKewMi9gJFhFa N5UlFmekZJbmJmjq6hgYGuoaGRrqGxqa6pqV5ilW6SXmmxbnlqcYmukV5iebFecWVuck6KXl5 qySZGoOdTCtrNdzC+eP1B7xCjJAeTkiiv5TSdeCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvN03 gXKCRanpqRVpmTnAIIRJS3DwKInw5t4GSvMWFyTmFmemQ6ROMSpKifOq3wJKCIAkMkrz4Npgg X+JUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjDveZApPJl5JXDTXwEtZgJa/HOJJsjikkSElF QD03VtmUMq8Y/kRbRbSm2yIoweGPn9WFEf1LLE87fPAv5kDvmM74UeBV3HdLcHnN3TMsFOqK1 5wjyTxKUGy3U3m7wovrhRu2bvE5s/d648S7rtl+Xo1LHDWXl2+ffZS5xr3ki3GV64qn/g4x7H DE/Ok4/fNkge1nYtCX9xRrp918LA1+3Nr7tEvuqIM+9xPFSwbHXO5T/MhfuXqoov2PKFoUA+N +rq/bysT5cKPfxnuj6RDCvcrfc0SOpY/UVlkfhFxrszOJ5cuhx+j/lbYIBA4EXL/fVH5fvYf3 wSPcjjHPOjnnnxXgWl/YVK2ruWlWacWWrQWdL27XDztGqR6wF362plztT/F5rQZ2QmKH1QiaU 4I9FQi7moOBEASdmP0/cCAAA= X-Env-Sender: mutsugi@allied-telesis.co.jp X-Msg-Ref: server-7.tower-353.messagelabs.com!1596775492!32981!1 X-Originating-IP: [150.87.248.20] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.50.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4996 invoked from network); 7 Aug 2020 04:44:53 -0000 Received: from abricot-inet.allied-telesis.co.jp (HELO TKY-DS01.at.lc) (150.87.248.20) by server-7.tower-353.messagelabs.com with SMTP; 7 Aug 2020 04:44:53 -0000 Received: from swim-manx.rd.allied-telesis.co.jp ([150.87.21.50]) by TKY-DS01.at.lc with Microsoft SMTPSVC(8.0.9200.16384); Fri, 7 Aug 2020 13:44:52 +0900 Received: from mutsugi-qsdk-dev.rd.allied-telesis.co.jp by swim-manx.rd.allied-telesis.co.jp (AlliedTelesis SMTPRS 1.3 pl 1 ++E6B86F8C687C6288D9B5559052954DC9) with ESMTP id ; Fri, 7 Aug 2020 13:44:50 +0900 From: mutsugi@allied-telesis.co.jp To: openwrt-devel@lists.openwrt.org Subject: [PATCH] busybox: use settimeofday() instead of syscall Date: Fri, 7 Aug 2020 13:44:38 +0900 Message-Id: <1596775478-12127-1-git-send-email-mutsugi@allied-telesis.co.jp> X-Mailer: git-send-email 2.7.4 X-OriginalArrivalTime: 07 Aug 2020 04:44:52.0279 (UTC) FILETIME=[7D470C70:01D66C75] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200807_004502_705616_16E1E40C X-CRM114-Status: GOOD ( 11.82 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [67.219.250.112 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [67.219.250.112 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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: , Cc: Masafumi UTSUGI MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Masafumi UTSUGI SYS_settimeofday syscall is not time64 safe. Using settimeofday() instead of syscall() is recommended or some C libraries such as musl might cause compile error. Signed-off-by: Masafumi UTSUGI --- Makefile | 2 +- patches/250-date-k-flag.patch | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 01441d1..baf375e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.31.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/patches/250-date-k-flag.patch b/patches/250-date-k-flag.patch index 5aadbb2..ef0545c 100644 --- a/patches/250-date-k-flag.patch +++ b/patches/250-date-k-flag.patch @@ -8,19 +8,15 @@ //usage: "\n" //usage: "\nRecognized TIME formats:" //usage: "\n hh:mm[:ss]" -@@ -139,9 +140,8 @@ - - #include "libbb.h" - #include "common_bufsiz.h" --#if ENABLE_FEATURE_DATE_NANO --# include --#endif +@@ -142,6 +143,7 @@ + #if ENABLE_FEATURE_DATE_NANO + # include + #endif +#include -+#include enum { OPT_RFC2822 = (1 << 0), /* R */ -@@ -149,8 +149,9 @@ enum { +@@ -149,8 +151,9 @@ enum { OPT_UTC = (1 << 2), /* u */ OPT_DATE = (1 << 3), /* d */ OPT_REFERENCE = (1 << 4), /* r */ @@ -32,7 +28,7 @@ }; #if ENABLE_LONG_OPTS -@@ -162,6 +163,7 @@ static const char date_longopts[] ALIGN1 +@@ -162,6 +165,7 @@ static const char date_longopts[] ALIGN1 = /* "universal\0" No_argument "u" */ "date\0" Required_argument "d" "reference\0" Required_argument "r" @@ -40,7 +36,7 @@ ; #endif -@@ -181,6 +183,8 @@ static void maybe_set_utc(int opt) +@@ -181,6 +185,8 @@ static void maybe_set_utc(int opt) int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int date_main(int argc UNUSED_PARAM, char **argv) { @@ -49,7 +45,7 @@ struct timespec ts; struct tm tm_time; char buf_fmt_dt2str[64]; -@@ -193,7 +197,7 @@ int date_main(int argc UNUSED_PARAM, cha +@@ -193,7 +199,7 @@ int date_main(int argc UNUSED_PARAM, char **argv) char *isofmt_arg = NULL; opt = getopt32long(argv, "^" @@ -58,7 +54,7 @@ IF_FEATURE_DATE_ISOFMT("I::D:") "\0" "d--s:s--d" -@@ -256,6 +260,31 @@ int date_main(int argc UNUSED_PARAM, cha +@@ -256,6 +262,31 @@ int date_main(int argc UNUSED_PARAM, char **argv) if (*argv) bb_show_usage(); @@ -69,7 +65,7 @@ + + /* workaround warp_clock() on first invocation */ + memset(&tz, 0, sizeof(tz)); -+ syscall(SYS_settimeofday, NULL, &tz); ++ settimeofday(NULL, &tz); + + memset(&tz, 0, sizeof(tz)); +#ifdef __USE_MISC @@ -78,7 +74,7 @@ + tz.tz_minuteswest = -(tm_time.__tm_gmtoff / 60); +#endif + -+ if (syscall(SYS_settimeofday, NULL, &tz)) ++ if (settimeofday(NULL, &tz)) + { + bb_perror_msg("can't set kernel time zone"); + return EXIT_FAILURE;