From patchwork Fri Nov 8 20:34:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178952 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3244175ilf; Fri, 8 Nov 2019 12:35:13 -0800 (PST) X-Google-Smtp-Source: APXvYqxXx8jW5ZfQRQjTBYS6FnvOvFlYQuf+YeAt2LWwmcZ5a2tvh0wXXVycwwAzWSWFaSJEPcnY X-Received: by 2002:a17:906:4e99:: with SMTP id v25mr10856242eju.106.1573245313013; Fri, 08 Nov 2019 12:35:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573245313; cv=none; d=google.com; s=arc-20160816; b=VhBFgyXncrSA4daWtmq7GuyojcWiBP0gNlvh8lN9G1T5VoMh4frb7kJ3gw+cqFEwXS SKE8hKxdeT4HmGLz7/6Y0pgOCQCo7baVzJuqS/oBpJC97HyPp3Uc6slsYXVIyuh/j0Z+ M4C2lka7CzJLrzbsRn9F3s635Nn777vXKppKqIC38npBBtNlp9btomIhvTy0MYMN4oR8 YG39nKmuXRM4D26xIonDvNElDqpdYuXT44vIE+iPiQhImWac4XqjcHoGbs6YAsgpeu4I Sm6LwOCtM1fVfUFAdO5OFqNQUfw5esyfrFQnbmEtyBJf0hl2cMHF+LvA93yoyryssNHu x6QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kw9kdMc8AybmlWpyS8fpLeKJ6ctgM1+Isx9piO6Aetw=; b=oRAicu1w+Fzr24jNp7GQ2mfIG6nNlaxdptibs/1CcUMMHKY0ixutyl/ps7pnWPh5Zf 5bq1JyLPhJVTFRd5/ZxNYhKXBC6nhsvOzzo5b3SEzWABpii/88GFhSFG41joazHWGPWV UPbWgRjpMZhqZSHMrwTjU/M3D0WXIKXfvx9DzUhYl1o8xRzuVjhrbjpbVrG0LR1RqORa mklTwpT9EYMYfpn05E+pKiCRqZmGDVVGSfXy/65GNy6nabSa0k59UYQcbxm5JXO/OvSG BberaU/JJ4Yxi9oe+4OlB49xZ7UPVy7vjDk/1Q9y4KLKYvOKTwZKbStkhRk9WzofKvRC 3cQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si6323573edb.164.2019.11.08.12.35.12; Fri, 08 Nov 2019 12:35:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731238AbfKHUfM (ORCPT + 14 others); Fri, 8 Nov 2019 15:35:12 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:52165 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbfKHUfL (ORCPT ); Fri, 8 Nov 2019 15:35:11 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MUXd0-1iKLFU3ITg-00QQen; Fri, 08 Nov 2019 21:35:00 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, John Stultz , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , stable@vger.kernel.org, Deepa Dinamani , linux-alpha@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH 1/8] y2038: timex: remove incorrect time_t truncation Date: Fri, 8 Nov 2019 21:34:24 +0100 Message-Id: <20191108203435.112759-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108203435.112759-1-arnd@arndb.de> References: <20191108203435.112759-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dsvYf++PaRS643RBIcfftXOiikOLND2cOaNKY9DSf4lXSBk9638 lhMQnUQ5oC+UdORdW39GRI2YOYmmzkdt2K8YdgnKGU+Q1xAfY/croquox+EBMHjxSXARGT9 0KoXD79AZobQRGcB4BAfLqfv+dMyxMf9KaFtVcRIAA16T+1NEtuZVuDeIlASU8CyEkGCHNx gAYJo1aZa8zydstxki2/w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:1nRjZ/tmDjg=:emR5zWF51M5/vEo+98Qgj5 lnbGKVBN8OwOj2FSuvwsPCgcN6LedIvlNOmNcBKcifHK40VgpKjAFw2tfBI9Pb9lOCisZHMlQ UgYJBlUEX2GrQSQBuRRgLPsrsEFg8nAt5dl0UdiO2vrCaYoHrs3ssjTNh77iLW3qkjUfcPA/r TLt2R1Ir5LhoMlH5kH9/p7N8FndtLd3Y3wyDbRThOuG7NzJp5DEiHgENEHoLEvpS4YW/kZSWM 2R0R1JiGtePuEDlkNZQnnRvAem3cCKuFMhbk5lEvSQDO5xWR+rV1nnyq1taJX9Thu5smjAbjP NiJLOb9M+SBxTVhQgzorOSfX7GDqlIZE6LLW2eRc/v7vNTLLWys2+qfw2zZLBLZtdQxMf9XRo UNKNJR3sXpJnqnQJywDVKLKrnS6/+gv2+VL/xoQNcBoGDnZbjm2EKnxJVuZJ1MqSb4h8bpdD4 jVoo0Q3Jia5qgDYIJx4cqCmXe8SvOyVWNlI5xNnZSMQDVJwk3C+G9xeu4wGC6Y70VEI+Jq0uG my9rYqeWWl/kYJKkQtupze2O70ykbmjRDmCCwcf0RJdp/bBkDWg96ROBzcZiPjuHi9yNkF8z8 664Js3Dn+0KQ22oAb7M58v9laXjw1l1T0VxaaMLE/b3P6tydF0ciIRrcrLuJwqrRv+w6h6gme GUnRujq4IU2xuU91uKfsvlGrbIcXJOOKhxgdkl4AZyUcb6TnYO9IIxlslvmpXVV+PSw6B2hXQ DcSLQDJmcx9Qy66IRjuTUQ3HlGodY38IH5p3onsw70wnIIEZ01F+I9xFf+q4tZhwQ78OesHYu m6wUEUrXwZ3xXgMfnYU8MPbmDMYVB5muevfSfy5ckxLrsP0w8XZ0rOPRQxffJLajGaSxb5YF6 by1mEgUmD5heT8jjdxbQ== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org A cast to 'time_t' was accidentally left in place during the conversion of __do_adjtimex() to 64-bit timestamps, so the resulting value is incorrectly truncated. Remove the cast so the 64-bit time gets propagated correctly. Cc: stable@vger.kernel.org Fixes: ead25417f82e ("timex: use __kernel_timex internally") Signed-off-by: Arnd Bergmann --- kernel/time/ntp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 Acked-by: Deepa Dinamani diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 65eb796610dc..069ca78fb0bf 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -771,7 +771,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts, /* fill PPS status fields */ pps_fill_timex(txc); - txc->time.tv_sec = (time_t)ts->tv_sec; + txc->time.tv_sec = ts->tv_sec; txc->time.tv_usec = ts->tv_nsec; if (!(time_status & STA_NANO)) txc->time.tv_usec = ts->tv_nsec / NSEC_PER_USEC; From patchwork Fri Nov 8 20:34:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178958 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3246005ilf; Fri, 8 Nov 2019 12:36:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxSsc7L1CIVNNkZ9vv2TZWuXxwS67GVO+IAKGTe1yhne3pFVs9HTxq0UADfcjZmts7xGY8v X-Received: by 2002:aa7:c756:: with SMTP id c22mr12417581eds.25.1573245417271; Fri, 08 Nov 2019 12:36:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573245417; cv=none; d=google.com; s=arc-20160816; b=Krb3p//5gXV6sF//x6p1UXfXoASEy2K7BWTgRfhdF1zcyCqhjjw1Tl91Y2OqI/9U4F bVASLiXeXA1oK8Cm/BNEe57HsYa1F93sfI6lyCeDBWunfVprf+hbc9S2ezoLEbO/tfR6 xMFb3KGNtVkPXUb7zlEwlXnjofpHRf0UlYGMbbgLvG8Mk+Tl/zIANDRAFz3ktDSekKLp jDY7FxrNfggp5uzNZ/6V7pYEBZhw++waZXqr9+cF390i9hbKaGOaaU5UsVoQY+IRDX4W ZNjk7cLhaTCQ0GLQnPlhN8baK8U8ToTLqFN0mbmCJ5ZvK3K1UuZdvdBRiBzozGxi7PX/ /NBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=P/3UP4dZnBceb+NXJGC1dhtLKolcNk24y2sM1lQ0uYk=; b=MrkcWjQwzxDPOIbYz5sVOTBR4lvDIBZPoABsyq2g1bQpi3KguKQ/F0VsYfl+X+r1de RJsmGWo2XaZeZQOs6MdMDUIFGxnbB3J3YikL7NOa6ZFpYnu8ZzhvlruLozpTufDPBDxm XrNP7ngCOgTkO4nRBnBnEGNHWeSXMcXwJUd4zdaZ+oMXUXe7PKonIV07ykzM0Zb0sPLT nk+5yYWk3BdcBc0UD8ej8CPZBoX6r04nXJ7s6Fa9yAfNV0VsL3scatCjtgm/w/ld0ke9 Z6fyEjjKzdZ995UohbE+WCo9zaW8AoBhrYZ5ASJToj+ufTgj5T/ABByXmKpMB1uzCszg 6zsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 93si5751743edo.408.2019.11.08.12.36.57; Fri, 08 Nov 2019 12:36:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730509AbfKHUg4 (ORCPT + 14 others); Fri, 8 Nov 2019 15:36:56 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:50269 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729683AbfKHUg4 (ORCPT ); Fri, 8 Nov 2019 15:36:56 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mi23L-1hxwm536Mz-00e7qK; Fri, 08 Nov 2019 21:36:36 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , stable@vger.kernel.org, Bamvor Jian Zhang , Sudip Mukherjee , "Gustavo A. R. Silva" , Thomas Gleixner Subject: [PATCH 6/8] lp: fix sparc64 LPSETTIMEOUT ioctl Date: Fri, 8 Nov 2019 21:34:29 +0100 Message-Id: <20191108203435.112759-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108203435.112759-1-arnd@arndb.de> References: <20191108203435.112759-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:AdGIzk8C/keCLr5gehPESKcLmoKBfAibkexFmJLNk/J2fjrWvfQ 8MAcq+hyhFCKe2NGkMCKC8E6hOh4EiIOzxoFMQpf3a/A02gkKmMm67Uoa2gD8xG2+2utJwY cYeiQr+CRTPH4nv3P5X2WlQL+CA52ot2f9Dezuje1gFc+nbrE7YWv6SVCXd9j58mgdTJ/N8 lsNRivF1GfWhv/gGAwK9w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:mRuBUasDfOU=:flVrvYp7E8yox4TyMBaI4z UYkgcoF1o+2SBVnju+MHHn+yfHpZAqQtuXlQTecwl9wHeKYJ5TKKRtsJp+MjU/UBX2Flde831 vQ2JCT18G9LprQqZvqVuf4UDC1voQ0EBV3a9CMXWylrhmSp9RSs22NgQ81ZP3En5UQHevX3mk LmMHcii40IfdAJYmPPAazrcqMu+GOhqXbxRvAYh0UHNbOnRr/zEoYrS0GICHJyCQY0ZpHYC50 rm3Uh1TN7AMYsv25mgUOHlLrPKvHTMb8TSbGpEUmp0Uz9loju/Brl6fG8quDJdD1XkmjrnC5X AZjfBYqEYRsezTHUDuV/xGgkauUXMNS2dh/lgVOnOeWi2A6BPFhKhZnIvbFIlP4rFkEN2MuCM sZINyLUT0UxJxOm4t+9chCQOxmB9bMYXbQNdzGSUQ5EVgxrX/dNuZpw7+OACH3P6K1VZNjMIM HA4Amu8XFQR/oU90pQiRRVgXIGt5tqM4AFVweZxqfIeRkHDXdyK3QiayQWG/sI/sfKTB12JuY LKVpokywzACi1TaoB//PcySul25uWn2O8/yv37Xm5tLRfiEU3xu8jUWNWW5MeFPrwdT/rDVsT e3BdROHlQi0tIIxlCkCRArDCICN+wi3VseR+UOMgHdhHilaRIzzHsJYju2NcpnYBkOyyya92t wgt9ECTg4ig1UujjAKyOIHbwkWtrk6/mLA+UqilOT6OIQYbiw5CF+VZdRBUth6InGsEZPEqtp jrbEV7NDpXtGm/2uEgZ3AmDrcNhNFCDb0ZGuoldCn9CkMD7AFX2HLt1ZCHDsq0mE0t41Yvkfr XbC093GVzuzGlrvVN1hd96kwe2m/Yu6WzqFkb7QBzmbK/8bDu4Ct3AJ3cwGn+Ye31SkWwYQte 0v+0lW0dTx0/GuOAc8Ow== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The layout of struct timeval is different on sparc64 from anything else, and the patch I did long ago failed to take this into account. Change it now to handle sparc64 user space correctly again. Quite likely nobody cares about parallel ports on sparc64, but there is no reason not to fix it. Cc: stable@vger.kernel.org Fixes: 9a450484089d ("lp: support 64-bit time_t user space") Signed-off-by: Arnd Bergmann --- drivers/char/lp.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.0 diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 7c9269e3477a..bd95aba1f9fe 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -713,6 +713,10 @@ static int lp_set_timeout64(unsigned int minor, void __user *arg) if (copy_from_user(karg, arg, sizeof(karg))) return -EFAULT; + /* sparc64 suseconds_t is 32-bit only */ + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) + karg[1] >>= 32; + return lp_set_timeout(minor, karg[0], karg[1]); } From patchwork Fri Nov 8 20:34:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178959 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3246541ilf; Fri, 8 Nov 2019 12:37:30 -0800 (PST) X-Google-Smtp-Source: APXvYqz2P258EkiZUPrkaRo+xBkABjA75AUZfrtG48jTMM3hE+zbU1Jy4B8gf3l8Z7v8y9Y1iJ7Y X-Received: by 2002:a50:8a88:: with SMTP id j8mr13036410edj.35.1573245450034; Fri, 08 Nov 2019 12:37:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573245450; cv=none; d=google.com; s=arc-20160816; b=0T08xyWQNpmfOnG5uem1mFWL68NYBUbJOxi9qrEEQpHuzaGj2so+6JmIaW38CHerAH kfxIM8lfeJ19qiEqWcAqTiUumCw11Nsbz3BIxQ1gu6iRQpQ0/sHUo3lcb2Zln+BpuUbI CBIH4MdPzMK6YRnJ6VxzFBnQisXBWDxk61b2csE/4lNC2zyD/jYfaKCDSHjn8C5y4846 6SJB8WgSk1CnBdajEpHex9Hro457vdPhqNMi4ijDIP1r1ZXE7G8s7X3RNPkQ8pDYORa4 uzhqLe1AkBE01fnwqJQgSz0GrqRhNZbTMWC0ZdOkRyKdV/Sok++8xgmeM+AtCgsLKi+L 3wUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TaIq8R7Bkuv+GQo/80AQt5TDsV5gTLgIBfEA/uJWyyY=; b=BiP4NOqtFK0SJDakkwnnP5ir7F4FVnA8YatrkMFXhtrmnelBSLpzBk4sgAd2hHJl/m 9L+fdsnkiMJcDxWK9NLKS7hQMFWhD7gmXN/IWnYugdYzOJ1GUsegoDwOorXrnaw/BcUH 9LmLZgjja8K2LzfrWPbOcLRRSC2RoCnEUe/1zzFK0bzpM4jI2KNFG8wtcBaY5ob/WZkW 8v31jkNjlsDNltAUn9GVpOxk+hn2AMk5uTAZTP+fZ1F7OSmtFH0+XIeZxk/zwbuoHfou 1eCyrfPEyavVZZC5j9Dw48TVy7o4nC+mwAF+kAZTbNNAX1Rp/IKjoS8RIwafSyMw27+U c3yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30si5383717edj.289.2019.11.08.12.37.29; Fri, 08 Nov 2019 12:37:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729683AbfKHUh3 (ORCPT + 14 others); Fri, 8 Nov 2019 15:37:29 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:43475 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729617AbfKHUh3 (ORCPT ); Fri, 8 Nov 2019 15:37:29 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MJW5G-1iDiWE2fua-00Jr4T; Fri, 08 Nov 2019 21:37:18 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Sudip Mukherjee , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , stable@vger.kernel.org, Bamvor Jian Zhang , "Michael S. Tsirkin" , Thomas Gleixner Subject: [PATCH 7/8] ppdev: fix PPGETTIME/PPSETTIME ioctls Date: Fri, 8 Nov 2019 21:34:30 +0100 Message-Id: <20191108203435.112759-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108203435.112759-1-arnd@arndb.de> References: <20191108203435.112759-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:qYLl7Lv1RPZHuaMmx5Y4HTBUG3IUIT6OHrwxfxk1rYIY9q0J5mB ID3W+2I3bIRJN9pb9/4We7gDyPXbqHtuj1j4jbHZqPHOQssbaXzIS5oG4kS2fmZvcPatud4 28UbJl9c5SgBe7fdAKp7oJ+CbG/oBp2vCDyjiOe+T82VoBh+JiGWqcuzcRbpDWbUGG9ilIT oXkl6SZaCeu/b9K9+rWgA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:27jegMmATLs=:NTdMdmiXmyy5b2BfGtixk+ QSkp4BY2cue8C4JNNeidfsutKRhw3wMg3l/slepabQusaphf9a2XzM/Xib4pCK19c/jh6uVYw qgoqRcope7ZcvaczaCTqwuVEOQ19cb1yCth63skQddVaME5+3q0OiGk14MCUEu+SyPOElob9b Qn/YeUBZAR3oXA2iHAYPA7mROXI3Bn7dgaIShyHnylMLGP2uqmZMOllngsqQHKIWE89EWnRug 18W44axbZpxj22LSrEmOeVvaa4iJIkOdHDnXjF6hx8fT24K5b1x9XnNBqnzPwuOG0bYWl8D3+ tDSlHep+MWILVxEz0z2VBYIFRb/gqAtqd0edvpKxcnv4Q6auK3yIGRJayQS962j4gNgOndn77 0fXWlAP0cS3hrK6+4LrfRAdwDWQEM2OYpI5pP7j/hi8Wm+jrmvLn9PYgU68KOKoPMCa1q2Yhj h9nfnueEp5sP8Y6GnRXHD51s4wdw6vjhs9M6W5j4NodYDU1pyZiWYbKIAlPNRF6eH7l5AQjsS ogCgJxDmRvlDQ1MdM2xC0EnxSzjPcLA7GGrAWgVfNevSn0DIwiUxCtGZIiFgo/HG/2reHnWw2 2cMlV1d4OLUq6tEx14Z8gWn5FdQBJpS3h1RQDXv5keY2Lbz/EBwscpvG+QqeHjF2SXoz/OBpH T4vEyyqnuyq1z4hRmUI0mYY+hNztZI18aZDDo+/iy9qlGDbIc0PCwp1/RHEdM5Xjfoy9+7Jmm MTgQ64hTlGXkXWvKrIp/7yenLu4c9AKDQqLC42HchjLAPJ6crLFiylBhIItSCnYqCWe8Tyle3 mNAzDqk5r3RJ1GgTpL4QW8DP8nhhYfuSFLqdmsNXGmvrPVtcClQZK5bb+XFwFrqMAehuhAUZN BhhYhfG6EkYlzncjY87g== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Going through the uses of timeval in the user space API, I noticed two bugs in ppdev that were introduced in the y2038 conversion: * The range check was accidentally moved from ppsettime to ppgettime * On sparc64, the microseconds are in the other half of the 64-bit word. Fix both, and mark the fix for stable backports. Cc: stable@vger.kernel.org Fixes: 3b9ab374a1e6 ("ppdev: convert to y2038 safe") Signed-off-by: Arnd Bergmann --- drivers/char/ppdev.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) -- 2.20.0 diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index c86f18aa8985..34bb88fe0b0a 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -619,20 +619,27 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (copy_from_user(time32, argp, sizeof(time32))) return -EFAULT; + if ((time32[0] < 0) || (time32[1] < 0)) + return -EINVAL; + return pp_set_timeout(pp->pdev, time32[0], time32[1]); case PPSETTIME64: if (copy_from_user(time64, argp, sizeof(time64))) return -EFAULT; + if ((time64[0] < 0) || (time64[1] < 0)) + return -EINVAL; + + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) + time64[1] >>= 32; + return pp_set_timeout(pp->pdev, time64[0], time64[1]); case PPGETTIME32: jiffies_to_timespec64(pp->pdev->timeout, &ts); time32[0] = ts.tv_sec; time32[1] = ts.tv_nsec / NSEC_PER_USEC; - if ((time32[0] < 0) || (time32[1] < 0)) - return -EINVAL; if (copy_to_user(argp, time32, sizeof(time32))) return -EFAULT; @@ -643,8 +650,9 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) jiffies_to_timespec64(pp->pdev->timeout, &ts); time64[0] = ts.tv_sec; time64[1] = ts.tv_nsec / NSEC_PER_USEC; - if ((time64[0] < 0) || (time64[1] < 0)) - return -EINVAL; + + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) + time64[1] <<= 32; if (copy_to_user(argp, time64, sizeof(time64))) return -EFAULT; From patchwork Fri Nov 8 20:34:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178960 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3247091ilf; Fri, 8 Nov 2019 12:38:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzdrxmvjG/9eWeY757eXYWrSDt8GSEJ5zkAFdJb6utS04M0vQy47XOVRKJThQALWJatNa1V X-Received: by 2002:a17:906:3919:: with SMTP id f25mr11064427eje.210.1573245480617; Fri, 08 Nov 2019 12:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573245480; cv=none; d=google.com; s=arc-20160816; b=pBZdUDv+CCR5Dzu0ead44OboiMKlm4A92yHBmkit1GXHV+b+cs2B2PII5keHNdDzYK cN5cABVgPbXtLK4XjvD/5s7LjfO7pjs5t3L1G1faSti4sEBhegRnT9sdtGV2AqwCNkNQ gFRid7lCVAPjcqp/JRpCoHf8ImzqMIcZmmxsoOz/WRV4CxNO86gFphYliUBx0sGKaVBP BnZom4GtI1iCRKyYJWKCcmHq83kFKXTC2yqZAu9OvJfvTIWxE0NCss3X+U1FIuF6JSzr aTyEzkHPJqeG1wH58NoKMsd7rKcJ0fJ0mrimj3C+gQVsDT7og8v3Df+hcSrHTuRzRtkT mZJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9vTRCY+V2oSE4ICSTrqyMW7MOIovBv5r+EIwT38a0eo=; b=Gmeny1hR7ijOKuKjIW/v5rUt3vYz0gfPtQmOj1sAzN6NZwudIm9K0yEKaO8vEnZxJM iLfeCtB4AOH7jTQ1n9NuqusMgRBskt4pekSFvIgr5szaXdZTB70yq9AwGIJRpVcNRGrP SeJI1XKDIRJosgfDqkjDSFZPURIoN2aq8UtDPnbDMrCt51X9o1hI6PSoVl5dntc1af4R YBoqpH3Mfkv7lsnWIly3ccYMoABQUtez3eChsvnIm8NdF5PWXog6gV2L/cGFlngzpMxE oE3FHxvtYoBtGFhuUyzY03pSOK4e4u7GJsh3gpMwvUwif7dmlwGHG0RZi7ZIc6W9uCB6 V6tQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si4442236ejt.419.2019.11.08.12.38.00; Fri, 08 Nov 2019 12:38:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729617AbfKHUh7 (ORCPT + 14 others); Fri, 8 Nov 2019 15:37:59 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:60679 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfKHUh7 (ORCPT ); Fri, 8 Nov 2019 15:37:59 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1M9Evp-1iWjmN29CR-006RBe; Fri, 08 Nov 2019 21:37:48 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , sparclinux@vger.kernel.org, "David S. Miller" , stable@vger.kernel.org, Deepa Dinamani , Thomas Gleixner , linux-input@vger.kernel.org Subject: [PATCH 8/8] Input: input_event: fix struct padding on sparc64 Date: Fri, 8 Nov 2019 21:34:31 +0100 Message-Id: <20191108203435.112759-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108203435.112759-1-arnd@arndb.de> References: <20191108203435.112759-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:u6kVp9UKD+j5V6nf6JiBnsKaa0LcdKVi2XG79PhwgluwxaPn537 JqX1+w4EzLmlGXpLjxX9AvVL+FsYlf7H6657Eapb17jd5kmqUqyaJHFBxnMPnUd4juxe6KT gRpRzLHS22sv0vGG9873r88aFqFY8GB1dGUaJUbh67CrdY3MMA9TlE3CGVC1wvOspK+YRBE tWERzIcvD8mD0C9zkhlRQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:QoQHUljkwik=:jlY4L3FT8f0wD8u1XiFw7Z h3+AyZXRuq5c8ebfbAH/dp8y2Q5jMb+GbbhsPaEA2a7MPF1PF/N8JuK+q2AFFRuQJcHecE6M2 wyIrgZ4fyGSpTREXcdY8PDWuk/NtBKzZuKkXyHreMWKYQub8/FI5mePtE7aORk/e14hj/mB2O ERwQFQyraRgE7aYwcH5d4B5CZX+k89/xrvFv2kNZc5Z5PmRNkIN/dfMDxpD9aNji++3uKGg5K AgkohYYZmv9XNXkwL4dC3iSCaEca5btoxk2/9tcBUUVMJRhDwgL0bAJpyaGLxrp9+H3ktoABj aUtYxzpSgzDnIhxNLyYgM00SIurLlTKQ2fzkQaOvqxXIi4CAcyLH1rfiJPGo+GCK3zdNV0Qbk 1tWSII8WsC8sUNoRFhra6Om83Cthg66/7Lsnsvg7fKe3SlHkJpiJBzCxl3eSI/6XAkKG9OWWc owcuBuy3UuodiSTwazfxz3NQMGzvnKY+wGFVxuEYPPkJ6JHrVYCd+5k4SnScsgSHJmg3p/yzv mApihJBs6/Xj8PCPN688hICGCI4M/ldYU4qdniL17PGVFqVE6QB7E1cu1mOVvvgYUsudeZtcg b9b0JX0eKZAb1NfjT445ZS3XzyifaRdVy4gi/coV2v9AHQP8DkYepKymu7sYuKjOSP7D/Z9/v f5+XK1Qa4rLaE+NmzvrJxEItcA6IKiB814x53Xq2UjTXCL767wY+LuxXdNdewEwAcjaf+9AqF 4iTvqs2QG0ugID76PJtSFqafr2c+sFqAflhL5Rc1RDkBWSQEUKPY3LJtUvVXP/CWSb0K3R14B Z3HQVxs+9OTO5jfMMLic3qWm8pn596v8xSot4nX0YnaO5nZSRxY4d0rIjcHMmLjGXxEqFG4m9 uUXYlF7efhWsZ7UEubSA== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Going through all uses of timeval, I noticed that we screwed up input_event in the previous attempts to fix it: The time fields now match between kernel and user space, but all following fields are in the wrong place. Add the required padding that is implied by the glibc timeval definition to fix the layout, and add explicit initialization to avoid leaking kernel stack data. Cc: sparclinux@vger.kernel.org Cc: "David S. Miller" Cc: stable@vger.kernel.org Fixes: 141e5dcaa735 ("Input: input_event - fix the CONFIG_SPARC64 mixup") Fixes: 2e746942ebac ("Input: input_event - provide override for sparc64") Signed-off-by: Arnd Bergmann --- drivers/input/evdev.c | 3 +++ drivers/input/misc/uinput.c | 3 +++ include/uapi/linux/input.h | 1 + 3 files changed, 7 insertions(+) -- 2.20.0 diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index d7dd6fcf2db0..24a90793caf0 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -228,6 +228,9 @@ static void __pass_event(struct evdev_client *client, event->input_event_sec; client->buffer[client->tail].input_event_usec = event->input_event_usec; +#ifdef CONFIG_SPARC64 + client->buffer[client->tail].__pad = 0; +#endif client->buffer[client->tail].type = EV_SYN; client->buffer[client->tail].code = SYN_DROPPED; client->buffer[client->tail].value = 0; diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 84051f20b18a..1d8c09e9fd47 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -80,6 +80,9 @@ static int uinput_dev_event(struct input_dev *dev, ktime_get_ts64(&ts); udev->buff[udev->head].input_event_sec = ts.tv_sec; udev->buff[udev->head].input_event_usec = ts.tv_nsec / NSEC_PER_USEC; +#ifdef CONFIG_SPARC64 + udev->buff[udev->head].__pad = 0; +#endif udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; wake_up_interruptible(&udev->waitq); diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index f056b2a00d5c..9a61c28ed3ae 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -34,6 +34,7 @@ struct input_event { __kernel_ulong_t __sec; #if defined(__sparc__) && defined(__arch64__) unsigned int __usec; + unsigned int __pad; #else __kernel_ulong_t __usec; #endif