From patchwork Wed Nov 15 20:31:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13457304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A0A6C54FB9 for ; Wed, 15 Nov 2023 20:35:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DFF680043; Wed, 15 Nov 2023 15:35:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3439A8003F; Wed, 15 Nov 2023 15:35:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F76480043; Wed, 15 Nov 2023 15:35:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EB99E8003F for ; Wed, 15 Nov 2023 15:35:16 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id ABABEA0896 for ; Wed, 15 Nov 2023 20:35:16 +0000 (UTC) X-FDA: 81461343432.08.4FFD6B1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf10.hostedemail.com (Postfix) with ESMTP id 3BF0AC0006 for ; Wed, 15 Nov 2023 20:35:14 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="Cm7X8/vx"; spf=pass (imf10.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700080514; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Z9QhvajxwNq5SYGaSMflClifwELAA5o+VrikMt43NLQ=; b=0Xo3Q3Ojsmlc7GhwWyIDpUQ2TuLaCC8eAkTPCbQ+KsVcT1fvVgk3SB/y82RUJXAl1+ShnX oEff4tqAgHY/qoU24FngSSuUCIijM8I3QKpJqQX6hmjPEHQIXocaOKDw45WXcOdZRqAZoW 8Npi/yP0KjBvbzvr3tTFUGEgAT8DE3s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700080514; a=rsa-sha256; cv=none; b=jI7v5PUnblZ7Ai7rWFIfhvPY21DjirP5L7SFZwLjsB5uKAiY+r0zBm4cl1R+zt9iCDdkdf SPRNJ8Az6Uio5r9Todb4JqnyayNG1zWNe5nFvaP9qtHDnbfmJsODmSwu6ia4qdiFBehjxX zpcYYXplg4yNqND5EnBcmLtCpFQnQuc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="Cm7X8/vx"; spf=pass (imf10.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKGBg7020350; Wed, 15 Nov 2023 20:35:07 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=Z9QhvajxwNq5SYGaSMflClifwELAA5o+VrikMt43NLQ=; b=Cm7X8/vxvTtxaJWoFkF9jnWecr0V6l8l2xTJG6o7VdsEsU84lWrX/cWSA/PlQPp4PQ2D X9b77e9wnTajqjR6TYS7npJ3ADymLNwW2C5SmJjm8hYNyDRNHnSnxY0Be1vNtLUSQF06 h9whX9frOjQXZxlDkt+JDJDmcdVozDYOHEm6hPXgoS7l+Eh9Re02y6JbkHWk2YDUQOMS sutit7Hror9wtMS/nVkO5ajro1E7OX/hdZ1u4e5usYdND84i5ZH93tIfYqtqil6cDNhY z8QKRZ3pZ53n7yLXybIsWVSf5WdBtAzBeBTJlm5pVxPgxVzveUbvBi07sIJTdygcJatO 3A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud4ch9c3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:07 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKGQp8021574; Wed, 15 Nov 2023 20:35:06 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 3ud4ch9c2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:06 +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 3AFKJ079014625; Wed, 15 Nov 2023 20:35:05 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uaneksvyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:35:04 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AFKZ20918350786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:35:02 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDD232004D; Wed, 15 Nov 2023 20:35:01 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9051C20043; Wed, 15 Nov 2023 20:35:00 +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:35:00 +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 31/32] s390: Implement the architecture-specific kmsan functions Date: Wed, 15 Nov 2023 21:31:03 +0100 Message-ID: <20231115203401.2495875-32-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 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UhAhQFn0oBvTc1Pv6N3SdNg7x4kktrNk X-Proofpoint-ORIG-GUID: LEZ4uk_CRb6VScTTWyecjTAHWTBHOoS1 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 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 mlxlogscore=783 lowpriorityscore=0 impostorscore=0 priorityscore=1501 phishscore=0 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150163 X-Rspamd-Queue-Id: 3BF0AC0006 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: oycwmdgm9f64afgw5hewynas1whsq8sy X-HE-Tag: 1700080514-511279 X-HE-Meta: U2FsdGVkX18YRGefb6drTABrQK/oO3H08W1Z7bXuZ4IqiIrsK0QKEvW4aYxTtzbAr3R3YYSUfwZmIWET6ZVMy+KGTF4TbqVo+9jyDg58VXpnsSWV/8y+H07SHNGSUyMzt0Ia0UWixKO/BRcjWK9b1SxBVLNoGEINaQXk/lIrSvdxo+/mDIDc0CqbT0ke9psaHdu3zpgOd3ZDCtSDSdtqDYS7EwtMWrCdQC441eIzKuYR+NyFkMh1VCIQPbVtRaexZWhCL99RYDgh1zAVPm4quCt6FxoZKCugkSi0w9P7HvTmO0qDgELvDkCk8OEe7s0Ndi+iD5Sa2h+Di19Ynpq+/bilhq+7WNOoTOzMdqWt+HLyYTHe10lo6UhcERTn4kJM48DIOZGIe2nfCkJGKyIKRBY1HQg705eiJ1HlxIZC2n65GiM9LVBWkCYofaGWKmOCXpdcVBavxaBlnpRaEhuVN2h2dVRLxrBQbZEB4UyqaMr3pQMx4kvcbgsjTWAYHV947Dzhoz5XSlQ6qSlRO4LbPNtQrk9S7IL0gS1k2qUxVpQBKHZDQD1O7+2HTEIicyLjJuLjaSon4Falj2Oz9MAU0v3idwPlK8IejgK+WYe7OQbMbGSmhCOAOpGW7NG1/U7CSRCKm9SREeVrJykJN0jx1AxF03mnKlDtgJm2ZutIbJVQXhAyIb3M0GcaYNP+z+fGyyTWXYynnTwtckgkftekLD4FpM72SuEDqy9v0GSKjR/oP8voIxEsXpRWd9A89Ad+c80Eiw2I25hM6FCujBcjONAgDP99uZ0FBKQ2BVZfhy5PKz1AHJEPkavQ+21SKQ00Gq27iMt7TN7HKjM4l96ro/mqmMAfpFa/b6AbAuZPRQ6lkS0BmxRw2wsUY5ntk6iwL82dfSU208ehx84PtPptTNOXEViwFwDgzG3FNeq7m1DVjplDLR/a7KIoc7zBkvlxa/R1lLdRSyvZ2kgCTc+ Np/nD2i9 0DaZrNVJtVgtf+siHp7PyYDVtvGEGvdDg/tBVLs58ZkpsLP8HmmvGeOM3ZsS7cbSpT5yHaJb8Tg3t2HdfqVN2WETqVgEJAbUq5hIMQ4QSjisTBFZq0KGFwE8UUp77KNlguZ0+Hf1Y3FS1twq8fU4PnrdzfI/+AOF8Ydps5xMAV7vHflzyGSP8x2SH6To5SeF/q9HkXAp7Zyck7yqOaJghT8l1Bg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: arch_kmsan_get_meta_or_null() finds the lowcore shadow by querying the prefix and calling kmsan_get_metadata() again. kmsan_virt_addr_valid() delegates to virt_addr_valid(). Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/kmsan.h | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 arch/s390/include/asm/kmsan.h diff --git a/arch/s390/include/asm/kmsan.h b/arch/s390/include/asm/kmsan.h new file mode 100644 index 000000000000..afec71e9e9ac --- /dev/null +++ b/arch/s390/include/asm/kmsan.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_S390_KMSAN_H +#define _ASM_S390_KMSAN_H + +#include +#include +#include +#include +#include + +#ifndef MODULE + +static inline void *arch_kmsan_get_meta_or_null(void *addr, bool is_origin) +{ + if (addr >= (void *)&S390_lowcore && + addr < (void *)(&S390_lowcore + 1)) { + /* + * Different lowcores accessed via S390_lowcore are described + * by the same struct page. Resolve the prefix manually in + * order to get a distinct struct page. + */ + addr += (void *)lowcore_ptr[raw_smp_processor_id()] - + (void *)&S390_lowcore; + return kmsan_get_metadata(addr, is_origin); + } + return NULL; +} + +static inline bool kmsan_virt_addr_valid(void *addr) +{ + return virt_addr_valid(addr); +} + +#endif /* !MODULE */ + +#endif /* _ASM_S390_KMSAN_H */