Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp235649lqs; Thu, 13 Jun 2024 08:42:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVexMZC3A8lGnI0EYiF/4BJdnXf8HcgX9T+rt+yEoPap4JN6Q8uW+o+BStYx8Roj2oaw4JbncPr9Ror8s5J4Goz5Cof2Ek9+JmAEFP0lA== X-Google-Smtp-Source: AGHT+IE0ch8z++nNGv9pyvOQBj/rPAOhKTW0FBdkvzjJbPp6yPTAFpYf+8j2AzLFCbutmNxrVFGI X-Received: by 2002:a0d:c206:0:b0:61b:28a:e567 with SMTP id 00721157ae682-62fbb8ee7b4mr48815887b3.5.1718293326832; Thu, 13 Jun 2024 08:42:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718293326; cv=pass; d=google.com; s=arc-20160816; b=Fik2KOYGMIAoRNfCAstMIIwmmsKHPLefiFEyy5t6VE6ppIRtbW7AVBSn4pFYxTlJJE I3+jSQCDW17Xel6DPY158ASWnEmBij5IeZQzbbZYs61a1bu1oxDgfMhLAYzgIPwZIcAY eLaNHNeZb+HoEJzFybYmog+ohRuEgK/QJl9B8cTibSv8U8YtPlqamX+hJFXKCePI2XLb xaooU83iQf+BWnavJ04RgLWNnJieg90bq1XHiiXwLV/ai+eArX+MIwkzs8/xgKtWRHFj nI2VUJpdRXD4GqtifO2wTfIyANlSEDudENUuxuZpR6AA+vk2MqMVopJjhSV3AkMtyErp lCKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=B2wiMcD3tdJRzJi1KnXmn1aGmTaVwcFVLNTdCb0XDUM=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=xCytk6Qn324JOUW/aJ24ZA+t/KgDpvUczuuG7rcb2KUdka7PkLcfmZeNL73aaoB7Vp FDYuNn5UkssJU42Vw3vT3Ky3Mmf7bJjJyAzl47cUV8i+LgcJmHXh4jkH8gwLnelYcuvl 3yWNhQqOC1IB8Pla/ECUR4zom6nQrQRi8wRlb+ZrYsxqZODUeU4q+F/0sVWIx+MsOSLw e9wVMtHy1IXk1Gqvm3ehbZqbkSXsI5baIOiyKDmw9NsRoOi7sI/tVHRqREhjFIM0yu1k +QxNT6q3hKVPtusx0gI0/scnylLtNt6EDL1CVwvQnBL+6euE5DlWUVNzTJ+0hVjt9Npn XsKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kMlxxcaM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-213568-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213568-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5a15260si17614806d6.41.2024.06.13.08.42.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 08:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213568-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kMlxxcaM; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-213568-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213568-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 89E701C241FC for ; Thu, 13 Jun 2024 15:42:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29D8914B979; Thu, 13 Jun 2024 15:40:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="kMlxxcaM" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAE361494B5; Thu, 13 Jun 2024 15:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718293213; cv=none; b=h8VgsIACedffFDQKOizyESBitKmh9WnZszIbcZN3R4uYpyHbIUEPL8Pu9C2nFgFs2X+IQnvEccQXIWgMZqKfVbuU8d2LZGVIxHC/bRlAjzZOAzj0sSneuvbqg03zaHIX2xFLsFqF9ehRTooQsZtGgveviW4KtdRgTHnqCM+mRlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718293213; c=relaxed/simple; bh=bnT2QIsysA2SxzDjj+x+XXiVNRwGqhae3E4dloFaMys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fWokaOmdamANFMgrQdVAlZVxmo+YxiCRrETfk8Tg5lPN3QOEFP1IYx9rke8GEEM7Kesb6F9JuDxiCkx7JeNOOF0xubBuyGt1C7S1hrVhVtZMCxXTo0goZfDiwlzsmNvsOui6sAFhQ9R/Pj4iB8McUVeFOawsGIoQfsck3HjqZb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=kMlxxcaM; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DDtsjK023397; Thu, 13 Jun 2024 15:39:43 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=B2wiMcD3tdJRz Ji1KnXmn1aGmTaVwcFVLNTdCb0XDUM=; b=kMlxxcaM5/99U97ayrQ5qdYsRdBDs C9654W3oZu1sTy+nyen8jds0RdfasEoQ5kqbPwHmbwUqhbmMwyQKSTRfV50sThIO vMUEJUuxodkDHF2zd3pAVG0ddk6XInjuHFHzSgaxPfT46EFZf5igXWYuiDBW+YeR JOBXpkOS+e6Barxo6f6Go7LYfnJtJYATnsoWEsRxHgxxwLLQGqEu19CD5v85cB76 kcYeEBWwwCGcZhpCtLxfvFDcRiIjVOOWaAueSH8Hfg6ZEPVIysGQ2yR8W8fxWYcq eM9pIyEVYgseFTTNZ56maIdGfwa19GxWeUWejcwXsMJKcS0+TLcvm904g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1pa8dkg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:43 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFdgJl030060; Thu, 13 Jun 2024 15:39:42 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yr1pa8dkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:42 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DEfGBf028808; Thu, 13 Jun 2024 15:39:41 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn1mus9eq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:41 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdZOh39977468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:37 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A028B20043; Thu, 13 Jun 2024 15:39:35 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D09A2006A; Thu, 13 Jun 2024 15:39:35 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:35 +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 v4 05/35] kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces Date: Thu, 13 Jun 2024 17:34:07 +0200 Message-ID: <20240613153924.961511-6-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: m2P6CrVSnW19obyLML4nznDroFQOGAq6 X-Proofpoint-ORIG-GUID: xWANpGfDMqIjimQF0yIYY49eefKu2RCe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 priorityscore=1501 adultscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=951 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 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.45.1