Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5655037rdb; Wed, 13 Dec 2023 15:39:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZUBxsIwW1lUHuDxe/uohYyfvzXjb5rEUxGWo0kYdHm/aPqTFjVoSadCnQwVSkZTpRzJIk X-Received: by 2002:a05:6e02:214f:b0:35d:5995:7996 with SMTP id d15-20020a056e02214f00b0035d59957996mr13182777ilv.48.1702510770340; Wed, 13 Dec 2023 15:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702510770; cv=none; d=google.com; s=arc-20160816; b=oK0Qd4dHl0gbGiRfLK1P6FrKaf9vEutfwWZWyYJFSQ7i7k/Do4Lr9RLRBUdlmbyt18 7Qw4w/KSdQ+JINo5SAwdpLp9SF0EyCqc6lwt+zaempFZufj8kGo4mj9X91QlNAzfnWqK Fb2pkbmFTCeHiLfYAvJg9jsgMoiBvWbGlGLpqBy9K+nwhVi0pS7g69Xo9vgO/E9CLjci l7lGcaPZuiZHEyX6wuA4BPO6ILCAWRwkr5fUtcdeKHSrpt50esaA/z1mm35UYKGMpXRm A0e5dUy5fIiDvIO2KPz/oVhnOd/SUzpowvo1Sl9eTCLPwNxKwSoYcWvztGUUpNepw02Z aqXw== 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=9DhmnRDZHM0G/+zJ9vPg8UIv4Wxto8sqiK6z/T5p8yA=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=E7BTVSnF4G9D9QZ9r+qgUpvbSDD4Dh1EY/ws8Ia2NBrCSNLwcv3HWwk/o9De1SBpSb hR+i+FLvnJxF5NhDzs2kU2w3p0O/ub6DQgV84FbfaduYDtei3t/f+/hNNZy6Pw+FV4c9 AMJ8JScUy06X5tacugBVgoYOyZ7Q3ZLUkePXa0aEbLkBHv1XmqQjXguDZvx13NTHTfSq ntpApJL6ZWwDes8ZU3InezbcBtqN9VCSFfEfykgcsrxIhrCPlA+MVkWNSsqYzEmAqWKe CBt3AvL0sVVxqhMYzwe7RnVE057D55/p7RjBCSt8ioaXj4o8S/SSPk62g6NNLJB1P7hd 6/JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SoVtm+ks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 36-20020a631564000000b005af21fd2c6fsi10407002pgv.898.2023.12.13.15.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 15:39:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SoVtm+ks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 2D9CB802853B; Wed, 13 Dec 2023 15:39:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443010AbjLMXi1 (ORCPT + 99 others); Wed, 13 Dec 2023 18:38:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234188AbjLMXh2 (ORCPT ); Wed, 13 Dec 2023 18:37:28 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98EED53; Wed, 13 Dec 2023 15:37:19 -0800 (PST) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDNWgUP006776; Wed, 13 Dec 2023 23:37:05 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=9DhmnRDZHM0G/+zJ9vPg8UIv4Wxto8sqiK6z/T5p8yA=; b=SoVtm+ksejzpUcxhXHkKt2fIa+99Xpr6NJC/w+6Bo4U7Z/jw7xYpIdXMq/YOCdZO/HKc it9xI0sjDSYX/AJwLTY/T6ZWHTE4fhHU5oy3FH55pc9yODSXsD+o7lYUiu62jEYTwDKX sjRZ6LUbRTs6X/Iup//La9CZMaztwGDaUE0XvpoxU5nJ0SXts8I570XH6KHEMMv19Odm MRm2RPN80wbtMyM3qDssKwI9yCJ3SA1ez9i3aLSBvPcDzquqEcBXOHxMwua4+DUQgfzj KzZtaJajo8vw8e6Rs0blvT2BB+AXKBI/WL49QHZIR2Dt4RXqeNwsz3xpaki2irKHn0IU eQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uypce8257-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:37:05 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3BDNaaPL017559; Wed, 13 Dec 2023 23:37:04 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 3uypce824w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:37:04 +0000 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 3BDL5lwv008450; Wed, 13 Dec 2023 23:37:03 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uw2jtmvre-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 23:37:03 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BDNb1fD20644524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Dec 2023 23:37:01 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F0EE02004E; Wed, 13 Dec 2023 23:37:00 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D08420043; Wed, 13 Dec 2023 23:36:59 +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:59 +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 33/34] s390: Implement the architecture-specific kmsan functions Date: Thu, 14 Dec 2023 00:24:53 +0100 Message-ID: <20231213233605.661251-34-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: qiAanGtjw_k-Ynk9arA87Z9sLMA4H9mO X-Proofpoint-ORIG-GUID: NB6qBGtqheS0YkDLhpLmLgpssbWag-y_ 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 bulkscore=0 mlxlogscore=726 lowpriorityscore=0 adultscore=0 phishscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 impostorscore=0 malwarescore=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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 15:39:25 -0800 (PST) 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 | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 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..e572686d340c --- /dev/null +++ b/arch/s390/include/asm/kmsan.h @@ -0,0 +1,43 @@ +/* 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 bool is_lowcore_addr(void *addr) +{ + return addr >= (void *)&S390_lowcore && + addr < (void *)(&S390_lowcore + 1); +} + +static inline void *arch_kmsan_get_meta_or_null(void *addr, bool is_origin) +{ + if (is_lowcore_addr(addr)) { + /* + * 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; + if (WARN_ON_ONCE(is_lowcore_addr(addr))) + return NULL; + 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 */ -- 2.43.0