Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2855969rdb; Wed, 15 Nov 2023 12:34:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY0/jV5oA8UFo4oExhrJ67X7YMVhU3X5OGD3ymzlziXIXuGUrScwGGi5VIvqWXhtVMpbEG X-Received: by 2002:a17:903:503:b0:1cc:492c:2918 with SMTP id jn3-20020a170903050300b001cc492c2918mr6239981plb.69.1700080494856; Wed, 15 Nov 2023 12:34:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700080494; cv=none; d=google.com; s=arc-20160816; b=ji+NdAkVDnkZ8FFkrVztLXMkiUahJcdzjI5wrs9N8S4kT4Xc5T3yb3XN+Zwsg6eRvY yulBJOcn024YaXqz4c+UR7VQ3Bdk0MGkxhbbh+mDe7csKa7S9BYElUMVUFET9+MvDYCB 7mT56x71Kr1O/p35SZbjWYdWWG0UTDYcHfhEVTe+bOzKQ8KAXh4jkO8mLRvngm8N899r kAb0kvGIepWgx3DFDyJMdx9GfO9+YuWV7qT3khgpEvcqEbRa0Jy9a2cb8yIhxY5oRUrz +L4uvY9jaHwu5FTgLrT3HO4dVKSJfa40ENl+7n5Lil9X7biPivhyELfkoe1UB05Qi/1q Ow4A== 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=VZEQ7DLTQn6OqQgSLo67A6SEZnv9L1qroObhIZ1xXOM=; fh=Mk/+hh3KXEiY642GJit3QcoQ60j/OUZTCvigu+jTRuo=; b=Vx8tUoU0WrRVTvrFj7n3conNxsCmLlGM1XB2ZSnsjuwou/baCB8VassDV0GgFg/gA4 JXGlGs7pxphpoQ7Un8uOw3Vvzqn+hdkfEyxrwHBC5LjQM59c4r4b2rsbVOUZR2kF96Sl rWmGrxRQuq6VQi4d+pIhV1YXSwurA3zUwBHy1wzkuBRjZYvbn2xsqm82iiGnGa83w5xm EAzGhH8iCUcXkFb02+Nn/KFhpVKBIrHZVEVdps8n13ZpzEj8ybw3Pgr/Un8RzOi0jYM0 Nfbd2d8RufPtfFA1hOu+FKHudn7Kvbst6FIFh2vqt3hEcxmczgiK5MtkTTOu+X4Y16Nb 5jgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=dg4iR7AS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x13-20020a170902ea8d00b001cc6e3b86c0si10119508plb.305.2023.11.15.12.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:34:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=dg4iR7AS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 349C980408E0; Wed, 15 Nov 2023 12:34:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235716AbjKOUev (ORCPT + 99 others); Wed, 15 Nov 2023 15:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344465AbjKOUen (ORCPT ); Wed, 15 Nov 2023 15:34:43 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D50CB192; Wed, 15 Nov 2023 12:34:39 -0800 (PST) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKRRsu004222; Wed, 15 Nov 2023 20:34:22 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=VZEQ7DLTQn6OqQgSLo67A6SEZnv9L1qroObhIZ1xXOM=; b=dg4iR7ASsjMcFxTDwjvCYLnHoVuy1Qfbro7WxLkmXAFPDzrHl4ABKsqJoFUHCQN13fNa 4crhrvYNsY5a5gNUgvU3Q80SlojQtneGOttjR9TnyVOn3GW0/RjYP4rSANttgOSDhJN5 zPM9wHYUrV9roCYmfAa2gHVV+qtuC/UpngdSdmvvL7tYZ42/WH605LRUeEWyTewBxdUh 5OZtujcbrRbCp1vp0JJKB86UoMmJPdc03HVO3vQOoIHf+HULGzOSuv7XlykNVMSmEltT 4hlHpsaQAbXZOA0NP+ZGG6Aajc4AetjSLwVSxETpQUHNtWWMOaPbQQf0yozllcU4mkys rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud51q05rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:22 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKTACg008842; Wed, 15 Nov 2023 20:34:21 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud51q05r1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:21 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKIuv7014594; Wed, 15 Nov 2023 20:34:20 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:20 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AFKYHqG45417192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:17 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09B5420043; Wed, 15 Nov 2023 20:34:17 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B202D20040; Wed, 15 Nov 2023 20:34:15 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.9.51]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 20:34:15 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , 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 05/32] kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces Date: Wed, 15 Nov 2023 21:30:37 +0100 Message-ID: <20231115203401.2495875-6-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115203401.2495875-1-iii@linux.ibm.com> References: <20231115203401.2495875-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NSV7ecFnmhdnhXadJujf6HXFiI7hMP7v X-Proofpoint-GUID: A_uHNzfE3lkD9p6tFW_ky0Alz8aTnTpa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_20,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=922 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 12:34:53 -0800 (PST) Comparing pointers with TASK_SIZE does not make sense when kernel and userspace overlap. Skip the comparison when this is the case. 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.41.0