Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14251716pxu; Mon, 4 Jan 2021 17:54:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/RC1AHdTNAuqCwnY413vSusDjst8DSG/ZxXf7HjLEq8VqBtyGvDv8Auv3qK69lMiSw9/2 X-Received: by 2002:a17:906:f894:: with SMTP id lg20mr68244480ejb.348.1609811694772; Mon, 04 Jan 2021 17:54:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609811694; cv=none; d=google.com; s=arc-20160816; b=aOA6aqyFTT7/f+c9QrA8lRMFkDoBJ0dUyPHgfqX+n7gS+2FRjE9/3tHDDLj+VlDSyJ GnKfHoB3sAX0PJ2HushXg59oOk4wr6jDX7I/qesj+J42fh8xQ8byRl4wqA90H88geeUP jsxKHxZ/h6ApasBRbFvQrb5vc6MIsIUWd+Zm5VbaIduOywWZXLRt5SGKHFWZvDAvC8Pe sWmwN8rQnP9ZLQKdnwkJVzp4AX0HrPhAj6w5TzGj2/v8jsYNnoQAS5URpRmDNiV3CF+b ZxVgnbRipRvenTYqw4U5eIk2FhQnwTltZU6R34oWh5weU+wPyhHuvGerEYzRd9RyYIm+ bKPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oFbLdoDKlV2DoBSMEKkI9BqNF/yDCzO5kaHKHUnEGzQ=; b=B/lF0Y75VK/NwO15R5ghNqWT+Gg3W01kOytnQUD+AwD40nJvOnM9yj/8Aru3varltM TFT2GMB/c4Bt7ayF9FAmt+BwTr/4qftTVAlHk2tYwOJMWuW3HBIIPfpvUIj9GLYzgzQp PXT80+O6aHS9MICVp5I1tmZ2akTWGoQXxQ4YpvED9ofLbvlDDZgzAZHwkVxoojZ+eTym bxwtZcuIHjFIEkJFSGpX0DuhQBmqmqrMk76CgjQSpph/xcOFYllbm+OIrnnK84P6ckGA Gnuo99UeUB17+sXSD4DFjwuKRuvDgH7q+ZJAQcTmTRp/OAMDpvxOfVKlfRXRhmkPY4XF oLdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxace-com.20150623.gappssmtp.com header.s=20150623 header.b=KE58ixwp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si33878825edq.205.2021.01.04.17.54.31; Mon, 04 Jan 2021 17:54:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxace-com.20150623.gappssmtp.com header.s=20150623 header.b=KE58ixwp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727209AbhAEBx2 (ORCPT + 99 others); Mon, 4 Jan 2021 20:53:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbhAEBx2 (ORCPT ); Mon, 4 Jan 2021 20:53:28 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88A90C061574 for ; Mon, 4 Jan 2021 17:52:47 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id j13so757880pjz.3 for ; Mon, 04 Jan 2021 17:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxace-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oFbLdoDKlV2DoBSMEKkI9BqNF/yDCzO5kaHKHUnEGzQ=; b=KE58ixwpUuhPmxfROBNwYruo1WekGVPqRDE1bGjz+LBJ5qswwR/TCNHivExdjPPowB z9AnzMBay4wVn2njzyCHUPGLcBGOl89iqClBW8XKxTn7imG+1/G1yBjQGDFhw/d7oBnC DlOCsXypkjP6IJ3Dxoxiq53ZPzRSWE1ok90auzesi0M7YuzhNH92pkzVSaiYeOTKSFpp prEDWH8IAq7HAbUBYTIg5AyrU6AXK+3liLiT5WO5RTU4jyv4qZc0ggI43GF9SFdXYNpn jY6skiUKyanoKLSutKvokdcO1h0RlHSb/FEwSUIgBShQHhyXebQptZ/uVFfJZpJEDzGE fk0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oFbLdoDKlV2DoBSMEKkI9BqNF/yDCzO5kaHKHUnEGzQ=; b=JCdjF/vxLk55EVg2j7Omn3WR08ayLnSOrjVWFkg39e8bLRhX2m6VwgWj684N8JXkB5 HB//nu5nmFwhtsY2k0z2xZMv/y0tb31LuNm8OmEh1+PuJaaXzyOmv5LwR+hMmogFN2HK kh9AAKs02uFBMP2mhvwZWhl1m/2LGp5Xm3LTzmXNMLVoMoQHdOpsjaeev1FnjEZaaE19 7N2UpGLLepG8yfDsIv/HHpFAxrGh32PaPRvAwbEsO/DeioPX4lKcKUVIsS34R3KFiy4M gW+GsPweGfHg7oyyTERUGAgdUwmhaiwjk/ie51Xak8qmvgewMQsaIOWuBEc7TcXIiXAg az2g== X-Gm-Message-State: AOAM531t584FVGVDSZN3yorI2jUdlix20/k1JYb7Mdy/jxRzxiqs1nF+ szw6QlAZPtkdfvtZxL0dlQKHEQ== X-Received: by 2002:a17:90b:4a81:: with SMTP id lp1mr1735742pjb.55.1609811567117; Mon, 04 Jan 2021 17:52:47 -0800 (PST) Received: from home.linuxace.com (cpe-23-243-7-246.socal.res.rr.com. [23.243.7.246]) by smtp.gmail.com with ESMTPSA id w6sm41423240pfq.208.2021.01.04.17.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 17:52:46 -0800 (PST) Date: Mon, 4 Jan 2021 17:52:43 -0800 From: Phil Oester To: Arnd Bergmann Cc: "James E.J. Bottomley" , "Martin K. Petersen" , Arnd Bergmann , Kashyap Desai , Sumit Saxena , Shivasharan S , Anand Lodnoor , Vaibhav Gupta , Jason Yan , Damien Le Moal , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi: megaraid_sas: Fix MEGASAS_IOC_FIRMWARE regression Message-ID: <20210105015243.GA80882@home.linuxace.com> References: <20210104234137.438275-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210104234137.438275-1-arnd@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05, 2021 at 12:41:04AM +0100, Arnd Bergmann wrote: > Phil Oester reported that a fix for a possible buffer overrun that I > sent caused a regression that manifests in this output: > > Event Message: A PCI parity error was detected on a component at bus 0 device 5 function 0. > Severity: Critical > Message ID: PCI1308 > > The original code tried to handle the sense data pointer differently > when using 32-bit 64-bit DMA addressing, which would lead to a 32-bit > dma_addr_t value of 0x11223344 to get stored > > 32-bit kernel: 44 33 22 11 ?? ?? ?? ?? > 64-bit LE kernel: 44 33 22 11 00 00 00 00 > 64-bit BE kernel: 00 00 00 00 44 33 22 11 > > or a 64-bit dma_addr_t value of 0x1122334455667788 to get stored as > > 32-bit kernel: 88 77 66 55 ?? ?? ?? ?? > 64-bit kernel: 88 77 66 55 44 33 22 11 > > In my patch, I tried to ensure that the same value is used on both > 32-bit and 64-bit kernels, and picked what seemed to be the most sensible > combination, storing 32-bit addresses in the first four bytes (as 32-bit > kernels already did), and 64-bit addresses in eight consecutive bytes > (as 64-bit kernels already did), but evidently this was incorrect. > > Always storing the dma_addr_t pointer as 64-bit little-endian, > i.e. initializing the second four bytes to zero in case of 32-bit > addressing, apparently solved the problem for Phil, and is consistent > with what all 64-bit little-endian machines did before. > > I also checked in the history that in previous versions of the code, > the pointer was always in the first four bytes without padding, and that > previous attempts to fix 64-bit user space, big-endian architectures > and 64-bit DMA were clearly flawed and seem to have introduced made > this worse. > > Reported-by: Phil Oester > Fixes: 381d34e376e3 ("scsi: megaraid_sas: Check user-provided offsets") > Fixes: 107a60dd71b5 ("scsi: megaraid_sas: Add support for 64bit consistent DMA") > Fixes: 94cd65ddf4d7 ("[SCSI] megaraid_sas: addded support for big endian architecture") > Fixes: 7b2519afa1ab ("[SCSI] megaraid_sas: fix 64 bit sense pointer truncation") > Signed-off-by: Arnd Bergmann This solves the issue on our Dell servers, thanks Arnd. Phil