From patchwork Fri Nov 10 15:37:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 118580 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp8080545qgn; Fri, 10 Nov 2017 07:39:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMZzNpQw8mV3/n4IjifADwHv8masLTWV9EUlrvkapW+5a/dsSeZ0Ycb7XwHjjykXDFPd54we X-Received: by 10.84.218.204 with SMTP id g12mr738441plm.213.1510328355920; Fri, 10 Nov 2017 07:39:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510328355; cv=none; d=google.com; s=arc-20160816; b=jSthk+2wdXxB+/fmDGRcQnWsWrmZNIohdfPClLvaMHlgurMoBNxOOcCb+uyNAQXUKu Aqcgl2cxZ5YhI/iSXjnRWlgl1Dy/d6YnlgJ74vkiL9ggaseStqHzdRXaHvav0l6dNdi1 AqPdq1rl5x46rwUcFTc6lJDe/Ksl/eut0TunPLnowM22+1zdl+V/8fiAJ1OjtSuxj3vA sGfLs76ZE2ckzO+cGssNsfOYMVgY6rCZajb/ETP81Vf1B6Nd+SFaq39mfAX8kCkwR09+ lvMO9biJDxEnLp9q1ky84GkNu54gvwO/UvoZw0oFPtXRn796cX6pZHas4AqrfdBDt6WK V+Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=8D5ikj0CAy307xT/SbvxfbVpVL6gEc3oq8i8WhCE9PU=; b=t3KAEZuNKka3a5x0N/ahBzRx6GHLYuqC1pfS/kjHxBXn9aLqU+gZ2ebb05gtDXsJ+i ZY9VLbpM8/I6yVtFoUxIk+8VBJ57KmKeX0BKrVCiO6xIogV5TiIvF3LGkPEa9jHd9dBq MG3qB9/lN4uKp1tUhJDCUdth+eQ+RePmXVZbz4ejWTJr5Qzs5k4Fjj8gLsJ8NbnVU7Nx n0TB5nIoJJ/PWCdAufdJ2yvTYwL1DoXtlwGVHIpWR2ifgei5vjgdghl3LP4b8W3Cok87 P29gZ3vCQwdCfqD/ScJ3472vQzaJg8Xg7dOZ8ZSf60d/lnOcyTZFvVdXw9KGRH2KFogq EtNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 z4si8938346pgs.301.2017.11.10.07.39.15; Fri, 10 Nov 2017 07:39:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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 linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753202AbdKJPjP (ORCPT + 1 other); Fri, 10 Nov 2017 10:39:15 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:57082 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752861AbdKJPjN (ORCPT ); Fri, 10 Nov 2017 10:39:13 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lkxnh-1ekrUn2zht-00apFp; Fri, 10 Nov 2017 16:37:32 +0100 From: Arnd Bergmann To: Anil Gurumurthy , Sudarsana Kalluru , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, hch@lst.de, hare@suse.com, jthumshirn@suse.de, Arnd Bergmann Subject: [PATCH 4/7] scsi: bfa: document overflow of io_profile_start_time Date: Fri, 10 Nov 2017 16:37:12 +0100 Message-Id: <20171110153715.1929456-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171110153715.1929456-1-arnd@arndb.de> References: <20171110153715.1929456-1-arnd@arndb.de> X-Provags-ID: V03:K0:vfy9Fw9pf0JcMyLRGU50xSUe0haSnQ1P4QDDnb2XFE0DEILHRXy PN2F+1dgzPu1PALv93JVBIMOKfWyJ/kY77Tl8r95Zd6Ea/Uaf5o1uda0g6bs5jl3r6XOP9F o1YR3m+DsdqHs9fHHLhs9BZT2Zvbw9Ng862+6v92QiHlt7UMjNcUTJhazfoow4xdwctjKut JQjQ4dbgt+BhPgluEP+RQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:5moukLrROkU=:FX1X6Jy0M0BMgSbiHetR4U 363oiR8QZCYfKpn1BGVk1keuKCsVIhu/8+B9f1bSUFvKIiQ/9J3CKAafdWRy3hrCzN8aFA7QR rOsfBOq1fTABcz1NS4SNv3dB5IvKWrMUj6E23fh1TAx1ZGP0JnKoV7KmeZf96iQjA/91YYMMo tX5rrJ8rYUJfmLjQ77jOj8Th4ryYnsu2bRXILI6DlI6I/Y3VJrZ49Zve2wJtyApznH7BUvGjB w7cnnsSiyG+PAseUHpADkolOPOu7IdKVz/+/WRhYM3mcckl3+VKWAUOmMFSjo1xpukWxYIpPt b2TGSas3LEPQGkrXlBZDESQBiCBPjRj3HdSJGcwzyRCScKlDwWZJElxGwQlg1jlbuZVEvpcqq zwr1du1mAqx2JugwF4eFqTKG/TAcPmnWcU1YBCtsHSNLa9lTRFo4gGVlAh5N0Se0RZ6pMCvl8 /xCW467zrrcMwPrlFAkU4ZP9HCOfttI6r0CxkV6L151LNd7EU75WNetP50bs1D3wTsms2gWFd Pygr014/EXszC1QcEJRuLK7eFv9IyxUIPPfzuC/ZeYGoN4dYgcL+wItpwIZwrx+9O36WDgSxo 3N2t4zDBH06HiUQMQn00hWCX4GLhZpNz+T15/lnlkBZpN52keWNw9HRHze+aZQhr0HFSoKoVj ifm6K9Rw7GQXl1gqiiOgwkEymd/ol3vO3t0JvHON6z2WNieeXcSwu42Cv5ftCEt/oGBs2ROfC 7Jw/l9LPVuZGyA2aL4+WwF1zcQb7M4w08vQUMA== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org io_profile_start_time() gets read using do_gettimeofday() and passed down as a 32-bit value through multiple functions. This will overflow in y2038 or y2106, depending on whether it gets interpreted as unsigned in the end. This changes do_gettimeofday() to ktime_get_real_seconds() and pushes the point at which it overflows to where we actually assign it to the bfa_fcpim_del_itn_stats_s structure, with an appropriate comment. Signed-off-by: Arnd Bergmann --- drivers/scsi/bfa/bfa_fcpim.c | 3 ++- drivers/scsi/bfa/bfa_fcpim.h | 4 ++-- drivers/scsi/bfa/bfad_bsg.c | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 5f53b3276234..2c85f5b1f9c1 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -468,7 +468,7 @@ bfa_ioim_profile_start(struct bfa_ioim_s *ioim) } bfa_status_t -bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time) +bfa_fcpim_profile_on(struct bfa_s *bfa, time64_t time) { struct bfa_itnim_s *itnim; struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa); @@ -1478,6 +1478,7 @@ bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, return BFA_STATUS_IOPROFILE_OFF; itnim->ioprofile.index = BFA_IOBUCKET_MAX; + /* unsigned 32-bit time_t overflow here in y2106 */ itnim->ioprofile.io_profile_start_time = bfa_io_profile_start_time(itnim->bfa); itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul; diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h index e93921dec347..ec8f863540ae 100644 --- a/drivers/scsi/bfa/bfa_fcpim.h +++ b/drivers/scsi/bfa/bfa_fcpim.h @@ -136,7 +136,7 @@ struct bfa_fcpim_s { struct bfa_fcpim_del_itn_stats_s del_itn_stats; bfa_boolean_t ioredirect; bfa_boolean_t io_profile; - u32 io_profile_start_time; + time64_t io_profile_start_time; bfa_fcpim_profile_t profile_comp; bfa_fcpim_profile_t profile_start; }; @@ -310,7 +310,7 @@ bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa, struct bfa_itnim_iostats_s *stats, u8 lp_tag); void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats, struct bfa_itnim_iostats_s *itnim_stats); -bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time); +bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, time64_t time); bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa); #define bfa_fcpim_ioredirect_enabled(__bfa) \ diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 72ca2a2e08e2..01fc51a70356 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -2094,13 +2094,11 @@ bfad_iocmd_fcpim_cfg_profile(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) { struct bfa_bsg_fcpim_profile_s *iocmd = (struct bfa_bsg_fcpim_profile_s *)cmd; - struct timeval tv; unsigned long flags; - do_gettimeofday(&tv); spin_lock_irqsave(&bfad->bfad_lock, flags); if (v_cmd == IOCMD_FCPIM_PROFILE_ON) - iocmd->status = bfa_fcpim_profile_on(&bfad->bfa, tv.tv_sec); + iocmd->status = bfa_fcpim_profile_on(&bfad->bfa, ktime_get_real_seconds()); else if (v_cmd == IOCMD_FCPIM_PROFILE_OFF) iocmd->status = bfa_fcpim_profile_off(&bfad->bfa); spin_unlock_irqrestore(&bfad->bfad_lock, flags); From patchwork Fri Nov 10 15:37:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 118576 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp8079524qgn; Fri, 10 Nov 2017 07:38:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMbNKSL2HK2lpzTfGECNAYZJdF1Y/ylMOZIobT+NxDsz4vVIUIcheLWhSqkgDPLbn0Ild5Jv X-Received: by 10.84.247.129 with SMTP id o1mr758924pll.6.1510328292722; Fri, 10 Nov 2017 07:38:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510328292; cv=none; d=google.com; s=arc-20160816; b=ccINRgL2EAZGN+pG3rx2UiaOVjUmhREfziSziE7ZDDy3BHPO2izLlk5CQhoiHalYSd +2oDPYJV/jQEuwz2TSFnYRQIP5DksDr3OrgQaCWfC6H5HW3JkAk3agufBni8junE5mzZ ywbuEVNwsZe1VvEfgqq4etWJZAg4lIqFN5GkUFGYGey3keYYnQspBr3rwIV/0UkyFcVx plRlRbYl8YjAXHZNClbg+ZGuA/u+0gZa/8neSt3FPDXQRaldsMjbnlavlR+qzVrMKQar jtYQJ6sLJ7C0ReaxIJe9eziXi6G6mVAOUO8lXFX8MavaLvo/LFPQiE1FW/CGjXW09imT 0pVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Re0qd7ZQDtieYFNJo7XvHTpSDLGdMSt6AJMZA8RhI98=; b=E0b4dkR9hfqF0YtQEKs6FpBSq1wvdnFJXuIqtrtwoxn7vrhl1lSg4yFgJ4dRIfgJI6 T1pA5vsMK1cUcCLU41zjzHOS17oYRIcst/Ij+h/iY0C+J2U/v77vt2J7dMnANZTcaiW3 vkjg+iTzkf9d/abI+OS031yvpPVDuW28pzN7WibYUR8ElB35y/JMWlIg4mJKR3pDes55 KHRtaiRBV1z7DXs9K3SAkxk4wd6V4b3nfM6hCs3M4Mhj1mC5ZLgoy3eqxeeeXMj8w8L0 rNoGIvOXg6i71nQGeXHcvYX1chmURUKVZtSr4AYc6uy96yqRilFN2u7mYZr49+WYS354 jG8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 a91si9181285pld.674.2017.11.10.07.38.12; Fri, 10 Nov 2017 07:38:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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 linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752821AbdKJPiL (ORCPT + 1 other); Fri, 10 Nov 2017 10:38:11 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:51544 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264AbdKJPhv (ORCPT ); Fri, 10 Nov 2017 10:37:51 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0M8QKY-1f8jlc09FC-00vwmM; Fri, 10 Nov 2017 16:37:34 +0100 From: Arnd Bergmann To: Anil Gurumurthy , Sudarsana Kalluru , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, hch@lst.de, hare@suse.com, jthumshirn@suse.de, Arnd Bergmann Subject: [PATCH 7/7] scsi: bfa: use 64-bit times in bfa_aen_entry_s ABI Date: Fri, 10 Nov 2017 16:37:15 +0100 Message-Id: <20171110153715.1929456-8-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171110153715.1929456-1-arnd@arndb.de> References: <20171110153715.1929456-1-arnd@arndb.de> X-Provags-ID: V03:K0:y+SzW9+7XYzR58gEMw3EDfLoXUuHu1v9blqTHr44JvbDrvyky4m tn6ZgUljHtAZnMgilMB+fzlyYERCEeCWS5/w1076QDWg+7ihatRXTIPMxniOs9yZC7LgJIv s/s9OUAKrCk6aglVC9RHYsRkcAwm3qTaeqrUoet84OnUEjG7UJ+ENELNR7xdRYjVjAumzdw FIaW3CAI09XzpiJifc/Hg== X-UI-Out-Filterresults: notjunk:1; V01:K0:43dHnS8Dfx8=:3r407n5V5vvHerm+iIF6Ne PV4ktmoFF4K/D5p+OIfkB/cn8pKK6ZlKrk1NcmOHorIvsVEQBBSwp+636q9WSC6V3Y09Zi8tM bOUPlW2mVJPq3I4SbJHmXFQyXpn2Nkf0LZCFV2o+MgpB7N3/KSjpTetY9zx4xP8Pnv0rzn6TS GeMy+EqaKZaEXQU0axCB2HgdtdSJJs2JS+4eexiPEdX4G8pRtkBRaPxnkjBnG8PQU0AEUw0p2 pDkv+FclWKAEP6P3ODYsXu4Cetd/ljUE7wWAAJk4Gw4jc5VGrxCJWcpy9zf1IpgsM9BSBO0Tp N5WHXVnJ37JRtdQ2yTnGllme5btTGe3sYgO5aFWZNEcvj0yzIM4p0nhtJP1fuzm3j7WlOks3C gci/2n4kQcEdDo2ENQEkkAhpEAtUAe9ibvWs90vlNbTE57ANOl795gX+kbRFeDEBti89yt1so N4buuzP6ga4zbAhkBioM55QEOlDW+0aG1CpnbuSO6KPflxFi6L2k389Q4ZbacPP+4v0iTZI7y CeRecQp0WBAIGbimgNmAksNm8Ec7azDSRPWqtKGoqTMmsDfgE+6K1tXvFczwI3IjGKa+Mmxb9 dEtInpLOsKUrmmNSDFhCkvwC1QxssaIR15Fb2ExRN1CJLrcDnhFtIWaTsPLOvnW/yo6eyCaI2 WHsjO3pdGL/7BubZURMu8eRtgv/DKpfOlSbstOJ3AQILqGXMhQjyPEMzrFNbUhpO+RPHdO8RM bwbg8g7pV04JxmJcpXBmjmvtHjnJQ3zqIfdWXw== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org bfa_aen_entry_s is passed through a netlink socket that can be read by either 32-bit or 64-bit processes, but the data format is different between the two on current implementations. Originally, this was using a 'struct timeval', which also suffers from getting redefined with a new libc implementation. With this patch, the layout gets fixed to having two 64-bit members for the time, making it the same on 32-bit kernels and 64-bit kernels running either compat or native user space including x32. Provided that the new header file gets used to recompile any 32-bit application binaries, this will fix running those on a 64-bit kernel (with or without this patch) e.g. in a container environment, and it will make binaries work that will be built against a future 32-bit glibc that uses a 64-bit time_t, and avoid the y2038 overflow there. However, this also breaks compatibility with any existing 32-bit binary running on a native 32-bit kernel, those must be recompiled against the new header, which in turn makes them incompatible with older kernels unless the same change gets applied there. Obviously this patch should only be applied when the benefits outweigh the possible breakage. I'm posting it under the assumption that there are no open-source tools using the netlink interface, and that users of the binaries provided by qlogic for SLES10/11 and RHEL5/6 are not actually being used on new future systems with 32-bit x86 kernels. Signed-off-by: Arnd Bergmann --- --- drivers/scsi/bfa/bfa_defs_svc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h index df1e874015c4..3d0c96a5c873 100644 --- a/drivers/scsi/bfa/bfa_defs_svc.h +++ b/drivers/scsi/bfa/bfa_defs_svc.h @@ -1455,8 +1455,8 @@ struct bfa_aen_entry_s { enum bfa_aen_category aen_category; u32 aen_type; union bfa_aen_data_u aen_data; - unsigned long aen_tv_sec; - unsigned long aen_tv_usec; + u64 aen_tv_sec; + u64 aen_tv_usec; u32 seq_num; u32 bfad_num; };