Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1657757rwb; Fri, 19 Aug 2022 07:20:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR46YyA5RCDHJq62Zf/drXSeRABThV+R+0pLLXQVarEWzA5cI7BwGWax3ZKeVvyYoCrKlFd/ X-Received: by 2002:a17:907:3d8e:b0:73d:13d8:61fb with SMTP id he14-20020a1709073d8e00b0073d13d861fbmr1936273ejc.731.1660918840943; Fri, 19 Aug 2022 07:20:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1660918840; cv=pass; d=google.com; s=arc-20160816; b=X2/YUxIvoVoeNs5HoNn15s5dXdYoz/fQwws+CZ4YpzlDg6dkPqtu+vB2Byx+3o1Qnh MkewoFR4nE73lv+8TQk/O+wW1QUhO4S0W6HRUzawYLpWnYWPenO69kgJVpRlmXwk3roY U5MTL/jpf912dYIf4+BGoFkNLqXNqxqFsFIjRd5cNonket7B5MOpJJ4xoc/ENwMGugk/ M+wrGZbIHxkBkaNpWELnw8ZhJBgqw04igfnr/1cK5zKtoSzJ3y1h40ceRNPsieiWxlRY Z2cCCP4QsuA9t8o1BM8oY5htpSsuVu8pdXrgJG+WOH534seIqvC5wkSzOuRM4oDkPeFj bZmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature:dkim-signature; bh=AnAlXLJGK27AQ7HXn00KWuBU8ofEq1X0F/SX5BnryqU=; b=BNK/wF4mx1H+BSbHFUBRp/jPSxv6Y6C9OKrji2ENakWOlYTaACmNoYAxfmNT981EX9 4soOoGPlhf/E3GHvSlr6aGuAtj9kig4ldLBrcATOqUpveg4aFTCBtMgNplLO/yBxk+N5 LV9QEf3+PlhhlxJMy5nWQGe6KNLrfdcG5Ik8LFMg+dEHSDkeqSuqVc77dCCc75yPTj+I icWyxGHHPDur8WJtayhdQVNDt8057oxSTqFmq1w9bz0kmdPHkVk2Mue5vKUmrPLowjZv GQoJMBkbLMFiiccWoE9yfeIHo6rt8xzJA/rbS4qT195CQ6qYQ/1YANXkY3kNk/0V4YLY 6iIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=V372LZlu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="Nk/LedbD"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gl20-20020a170906e0d400b00726c7fc61dfsi2977269ejb.103.2022.08.19.07.20.13; Fri, 19 Aug 2022 07:20:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=V372LZlu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="Nk/LedbD"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349373AbiHSNoh (ORCPT + 99 others); Fri, 19 Aug 2022 09:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbiHSNoe (ORCPT ); Fri, 19 Aug 2022 09:44:34 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D03ECD501 for ; Fri, 19 Aug 2022 06:44:34 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27JDYWG9016223; Fri, 19 Aug 2022 13:44:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=AnAlXLJGK27AQ7HXn00KWuBU8ofEq1X0F/SX5BnryqU=; b=V372LZlu32g3cht6I3/MEHLTllhi+NTQdkb7Uw08TPWNgBfRMatlME+tfUD1SRmh3Why Yulg5KzPwUTsUZbiJSxJtXnqqYG7T4hiQxZwocXQpcLvwwKdWy0746lGE0qosBNBcndn gr2pheTtWywDvwOfXLA/1/Xq7wFuLZrHH/+47cJzu3e1eszwUwNkd5sxAx8lIUq+iPBh hqc1ttsBXBKb1bzzVlci2xd8b770r6leTK52XJplFIVZVKzk8vX9k/x4DBZm77CDvdXn OKSOcGpUaxmK6oUS5o1pp8KavvT081SgeTgynjMic8d3rsBf2xIRsrURMgY2INaHrVQk cA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3j2awm8489-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Aug 2022 13:44:15 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27JDMPKi005694; Fri, 19 Aug 2022 13:44:13 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hx2dbj0m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Aug 2022 13:44:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SIfckgK5ARETBqsMrk98Z//hklw4yOt7DbYI5ju2veXQyvcjvCuJInBfDjScdQd4Z6c772Cw6z//eAyM0bXlI0Y7n5Q/Clq2YRkqulCvDVjLluQ/QJtA3QcN0DCU/3gySiA2pRB/dDiclAX0XBgxcPxq2spsED6P9pManqj/V486MYBdnNXC6AwZok6QszeMsmkbOrGEJOD4NE73CC0PLQC8Ct7eE7kxOKUY4YCtTwPPfrCYGCYsTU9fayl62MOzDWxpePAaBR3ufmnF8H28JaPP6N1KBEhz0/ozJH+XetZj/a52mcJS0rYhb8UUteINO5u4dguXZtDM+wv5kMZHHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AnAlXLJGK27AQ7HXn00KWuBU8ofEq1X0F/SX5BnryqU=; b=SfjyF3egaWt0uPTSz4GKLdn/d1VXBcuJw6Fc2UdgkcW72SwU8Mp1dt9ByP91wKk/NAT8MGxmiLO5vgc009qthyDKAck94ZkJfwQG13yBwucy0bqfcuWWGUNQ/kivMaLONq2woc01b20SS0NRVbqDOBgG6HmkqpBxTf2eT8tp0Mt1Y4l+/mooqtL+1B4xHP9XCzOzCvJwNGr0bjTvxQGqrJjC9kIoxV0Ov+QqGGLTV/De1vsy0QmDaULoKxMmNgUQTd77PKedOcrMhGt9dADSGA/JStmkJ01XOrRpEsqzyknHveUI5e9JVjYDNDD8ZFZGGBKhHQZIiN+2opeCcauwHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AnAlXLJGK27AQ7HXn00KWuBU8ofEq1X0F/SX5BnryqU=; b=Nk/LedbDrdBoVrETBWmH3mW0h18Suy8oV66INQ1OkKtEWJOsMJxMVTmLVhh6uf36SL4MtC86a4SZ2hSCIy69/V+pS54BEbGlSfJZrhYYD9nwaWIGpRGDgbzUyLqaSypae8sLPrBIvODlo/2s6JDiXFYk0d0Ku4tnOAL5tN5Eb2k= Received: from BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) by BN6PR10MB1524.namprd10.prod.outlook.com (2603:10b6:404:44::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.22; Fri, 19 Aug 2022 13:44:07 +0000 Received: from BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::95ab:eb8e:a0a7:3f0d]) by BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::95ab:eb8e:a0a7:3f0d%5]) with mapi id 15.20.5546.016; Fri, 19 Aug 2022 13:44:07 +0000 Subject: Re: [PATCH v2] swiotlb: avoid potential left shift overflow To: Chao Gao , linux-kernel@vger.kernel.org, iommu@lists.linux.dev Cc: hch@infradead.org, m.szyprowski@samsung.com, robin.murphy@arm.com, jxgao@google.com, konrad.wilk@oracle.com References: <20220819084537.52374-1-chao.gao@intel.com> From: Dongli Zhang Message-ID: <38c58aa0-11c7-f553-95fd-292fd4944a75@oracle.com> Date: Fri, 19 Aug 2022 06:44:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 In-Reply-To: <20220819084537.52374-1-chao.gao@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DM6PR17CA0014.namprd17.prod.outlook.com (2603:10b6:5:1b3::27) To BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7c2a679-a038-4a49-73db-08da81e8e34d X-MS-TrafficTypeDiagnostic: BN6PR10MB1524:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y+XOgLkLNupC1EMjdA0gXvvMTd7+RIFStTG0Bwe013mqHMpYnxtRirutc/qxmzwALqny6OchyjibQQTJyzicIEfkDEqcMQlrUbYqHV2BYtO7oqXybx14GyyNozZGaLa6Wqnkr8NKshJvHsjV2leDVIT6j3xfSXG4K/JPxpTfLdjnG/p+DHWuuVJ2lUoa8isZis17jFXXf46S3+zlkYpvZJVfa/oX7pFIanW1LkZMu1lsQuNw/cGI7xcahnnt5gn2PLbv+aqXwIdyzWte88RJwN8yPN6i34IHaMXQQHcy7NHXE10zAmg2j5pCtsf25ThGFKUawPJDBwel9zhDB+eoWq61zSvKBZXRGCrXkv8FCoxEiDHOZLBa4prnuG7mvCPacz4NJ4+SvHNWcl+vhqoReG9OzVozsCk8AF7l+C8D9fiMQwssjDBUgktbniIIf2wEU9N36kRauMbw5Hlq43Y3NusLFs2S3qKktYTosxo2zJOQ6hoy9Cnp17FLBq+2nc1wFlISRrYo7zV/SsP5psom+nfNcPZ6d/bnh07tZbMVNhN9oYwzqez910xvqEKU3HvD5nM0WFymOBfKSn/A7e3wZ+77FUhJR+iY3YTbv+syYqD5nRI56gHFdqmDnLthrX7DeYidbYbD0K0oLhSTI06Jfv+Ixl9PODyUSMUomgAoanC9pFrEcjlYtYBXHyoA21zYJ2GMZy0lrFZiTKkjG2luDHEbzPs9lbuCVXWJ2Td4Gs4q5j4OdvZZieqzVn1L2KVF/RmnApgkXzGuimKMDCI1SvU+WLhfpB0t4DSUkNVUjrUIQ1zGygTsG0/iGkWL4eYABMnUAf6NLoNvTYxHlJHZ6w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB2663.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(346002)(39860400002)(136003)(366004)(396003)(186003)(31696002)(2616005)(107886003)(86362001)(5660300002)(38100700002)(83380400001)(66476007)(316002)(8676002)(66556008)(4326008)(66946007)(36756003)(31686004)(44832011)(41300700001)(6512007)(53546011)(478600001)(2906002)(6486002)(966005)(8936002)(6506007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WmRQMTZQMmp6VkRwbDJjUVplSDhMQ2hHaVN6b0hheTNwV0VBOFM5ZG84c253?= =?utf-8?B?TG9CNitxYk9wUUlld2VMVkdLRjUxaFczN1d6cEF5WkhiRGR1V2FDQ2d2OEVt?= =?utf-8?B?VGxoa2V6WEs2cWhLRmtuNVBOOVRyeGhRMTFBWjBvdUw0RC9ncVEzNzZ4MTRD?= =?utf-8?B?eGlEa1Jyb0tLTmVrTGpxcDl5WCtWazl1bVNPSlQ5eFNDR3BqRDNqK0hPM2Vy?= =?utf-8?B?Zm1PblZOWWRYdDRtbzdIZnRsSVRqcEF4bThBY01GbTViV1lPdj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nRzNOckdKRldiY0JkVmpyRi91cmY0Z3Fy?= =?utf-8?B?UVdxMzIrMHpFRTBKWnZmRGpVMENydG5mVmJxMG1KOC9iVlM2c2czMktJSTJM?= =?utf-8?B?OWJMVGUwdzl0OVhTZDVjbi9JRXJHZ3dYT3hFYUpXWU9DbFVDa0llZkh1VzRE?= =?utf-8?B?dDRtWi9va3c3QTFXTUw5L3k3NHlMUVNkV0hwSFlxTHdXWC9BRDBsSjFFS0E1?= =?utf-8?B?cTZYdjA4MkVZRlRibUh5Rlp0dm5aK09UR0VwV0JOR0Z4SkpEUjVwY1lHK2Vj?= =?utf-8?B?UStvdWtiZzlQdEhLNGVlaG9sbEhwQ3UrUCsvajZiMWRPYW15RDVKaGUrdktZ?= =?utf-8?B?bHF6TWZaOFZhL1dvMGJvSjEwa3lwWGROelN2b3dkbXVEb0prellPeVhCNW12?= =?utf-8?B?TW4zK1llOVJ3cmlHaTFMYStnK3pQVy83amt5dXlxL0NFTVdSRTNBNDRoeDN2?= =?utf-8?B?L2JtaHN1Y0htTFE5NmJBRnE1Vk1YUUFoMUVDKytoUW04dGZYeVRQM0M0K1Fp?= =?utf-8?B?blFCamJKOU1XcEZCRkhKZ0pDRTMwOWNsZzJxcEpQYjgyZy9PbGRRRU4zYlJK?= =?utf-8?B?aGlFWHhOODJCMk9lNDk5aVExQjV2ancwUmt6Z2taQXVQQitxeUtaeFpyMVM2?= =?utf-8?B?dXJuRm4vTk80WHluZVZ2eW1NNGMwWWZuM2FFK0VzN1lyVFkxTzlpTHpDTUls?= =?utf-8?Q?zuQQON2TIu2B0Qh3dnAhHVj1TQ6yabpQ=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7c2a679-a038-4a49-73db-08da81e8e34d X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2663.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2022 13:44:07.6152 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cDwG9k9X7eYtDV1M5lXk/8ynHO9m7wSEkRoQRNO0BnLl8W0YZDkq5ksMYTLu9P+kEqxzhxfgy5T2uhqQNewGrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1524 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-19_08,2022-08-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208190052 X-Proofpoint-ORIG-GUID: Ldi3q-85kUeqZ7Xc1TpiS8xXsWNlXHVd X-Proofpoint-GUID: Ldi3q-85kUeqZ7Xc1TpiS8xXsWNlXHVd X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I also encountered this when sending out another version of the 64-bit swiotlb. https://lore.kernel.org/all/20220609005553.30954-8-dongli.zhang@oracle.com/ Unfortunately, I could not find an environment (e.g., powerpc) to allocate more than 4G until swiotlb supports 64-bit. Although xen supports 64-bit, but the hypervisor side limits the max to < 4G. Dongli Zhang On 8/19/22 1:45 AM, Chao Gao wrote: > The second operand passed to slot_addr() is declared as int or unsigned int > in all call sites. The left-shift to get the offset of a slot can overflow > if swiotlb size is larger than 4G. > > Convert the macro to an inline function and declare the second argument as > phys_addr_t to avoid the potential overflow. > > Fixes: 26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single") > Signed-off-by: Chao Gao > --- > kernel/dma/swiotlb.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c > index c5a9190b218f..41ea9fb3efe1 100644 > --- a/kernel/dma/swiotlb.c > +++ b/kernel/dma/swiotlb.c > @@ -579,7 +579,10 @@ static void swiotlb_bounce(struct device *dev, phys_addr_t tlb_addr, size_t size > } > } > > -#define slot_addr(start, idx) ((start) + ((idx) << IO_TLB_SHIFT)) > +static inline phys_addr_t slot_addr(phys_addr_t start, phys_addr_t idx) > +{ > + return start + (idx << IO_TLB_SHIFT); > +} > > /* > * Carefully handle integer overflow which can occur when boundary_mask == ~0UL. > > base-commit: 5c850d31880e00f063fa2a3746ba212c4bcc510f >