Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5656228rdb; Wed, 13 Dec 2023 15:42:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgUlTQvtOxSON7EJfOt7anB2WFueZi/OHbZ4tjLtgg9Np+l9fJ+wyU69m6ep6W7uTufQYO X-Received: by 2002:a05:6a20:1604:b0:18f:97c:977d with SMTP id l4-20020a056a20160400b0018f097c977dmr11861411pzj.101.1702510948346; Wed, 13 Dec 2023 15:42:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702510948; cv=none; d=google.com; s=arc-20160816; b=p0tFuoOSkEkzuC/yKKQ6TZYt3k2ttt9qvfEa8LdXbUwS7GqVnVtpcp3p/mtTeNPsiR 1/aRaFK9uwhKQQQqsMQkfqgdxp8LAFHq9PrIGpkWBudqDjDWb+zsjPVApWVXkG5t4GQw I4HFlbhG7bAeHGK35+Hj5rDWO/giMaxxRqRE/epdBT8CafYZZPDb2zstf8bjwFf8KCAS 3lcQQLdKw1pR9UtAcggJUTGbo/d61J2C45IXvWmFCpj5UeZtzV4Ex5moB7iC8zNUfNrs OevscxbcETr/luX/QyB9N6Jm8cNmw3luyqPUWr8+bADcFNo0du3WUgJ1wVkOoE5YNgwd Vwzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0tC4Q68qibnNxZ7EGQhqKNfW/oX4pAJGU/AeYW+RHN4=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=fQ8wc0+v2dGqRAqykV9wBet9bdSQt7wTUJCRRbB65xqi7YkoyKX5iRHMxkekpYzfne clyNFsEEzieckeL9Eii8HE90UdfTDbpMIa6mYSnQzDfIKMuP0ABcPvkMdUecBOt7PUmP AAEqVFtJsOhqr0XRecihOSPcxqHqgXmVPk1WIEhK2nQFGtdgnMgRHES8PXn/T5x83+4j UdMDPCc8ROjCFU2XPSGQm62xa3nvp4DX7Tl05NEZUzzToKrZtuI8esv1Lxb9sYWV8HEr 6Ef9RVpHiUJD2T9OsvD/f/G8vqoXRMVQ7+B5i9qk9XLLrp8Z/5RMK/SvHy+Hn7hNrqY3 98kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Rss4RCOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y9-20020a63e249000000b005c1b2d93e52si10449178pgj.368.2023.12.13.15.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 15:42:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Rss4RCOr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9EA6482BB1B1; Wed, 13 Dec 2023 15:42:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442767AbjLMXmJ (ORCPT + 99 others); Wed, 13 Dec 2023 18:42:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235411AbjLMXmA (ORCPT ); Wed, 13 Dec 2023 18:42:00 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 594B6E3; Wed, 13 Dec 2023 15:40:40 -0800 (PST) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDKglgr015451; Wed, 13 Dec 2023 23:39:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=0tC4Q68qibnNxZ7EGQhqKNfW/oX4pAJGU/AeYW+RHN4=; b=Rss4RCOrgoAMSvzDDBKNQmOKsMQpX2JZRwsnRmSbpLlGDcGLiQeVxLfRsbiqgS9GwzYm XOiP840M3jtAvF4d08X8CfHGgWwVd002Z5mfNbmUbXgylUMlNGtf1cnGmkCrz96eHf1x YLtu1/qex5P6XL6kHHBZ8G4SCs9Qu5B6qniYV7axaRAq6Njpys/vPe4YQNw+buOoIdYy kjs5439plVXELppWOzBApGE3+QsJ0Uxv+eNquISmqyraK+aBZ446u9tpwM9z/9KaTFzc gX8Gmfvs3M4ETfqusc9ypmhRzst1jdpnLx43/sTDo1FptzCCQmYWFzfsqlFDnefbsP8P eQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uykvmuvrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:39:25 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3BDMfmvh022983; Wed, 13 Dec 2023 23:39:24 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uykvmuvg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:39:24 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDM0FVa012620; Wed, 13 Dec 2023 23:36:20 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uw3jp4n7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:36:20 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BDNaHKZ31916778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Dec 2023 23:36:17 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B934120043; Wed, 13 Dec 2023 23:36:17 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53B7F20040; Wed, 13 Dec 2023 23:36:16 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.70.156]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 13 Dec 2023 23:36:16 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v3 05/34] kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces Date: Thu, 14 Dec 2023 00:24:25 +0100 Message-ID: <20231213233605.661251-6-iii@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213233605.661251-1-iii@linux.ibm.com> References: <20231213233605.661251-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8zwUI59DJyquKUco1wEpNP13PakX9rLY X-Proofpoint-ORIG-GUID: EAgeeP8DOV5nEsx3Wa0hsknLXVRnE7My X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-13_14,2023-12-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=891 clxscore=1015 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312130167 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Dec 2023 15:42:25 -0800 (PST) Comparing pointers with TASK_SIZE does not make sense when kernel and userspace overlap. Skip the comparison when this is the case. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/instrumentation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index 470b0b4afcc4..8a1bbbc723ab 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -20,7 +20,8 @@ static inline bool is_bad_asm_addr(void *addr, uintptr_t size, bool is_store) { - if ((u64)addr < TASK_SIZE) + if (IS_ENABLED(CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE) && + (u64)addr < TASK_SIZE) return true; if (!kmsan_get_metadata(addr, KMSAN_META_SHADOW)) return true; -- 2.43.0