From patchwork Tue Nov 21 22:01:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 167979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp942266vqb; Tue, 21 Nov 2023 14:05:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/Z4ETdnhBSEl6dlYqaCwbvvEFCl22+meXcqJKQVlniq3g8B/gV3ZrMxDd9jtWUwqTIlVN X-Received: by 2002:a05:6830:1310:b0:6d3:16dc:8b50 with SMTP id p16-20020a056830131000b006d316dc8b50mr713136otq.8.1700604314801; Tue, 21 Nov 2023 14:05:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700604314; cv=none; d=google.com; s=arc-20160816; b=Xo8TTJhKG2UFXXsycs0gnSK+BgQxPMesu+TPYZXLUdYPX8BauhJnNBdXWpnlps/rgK cTAie33w1bTC2HYFZ4dEK93Qsngwd5+zcHOHlzQ1ygSI5XvZmBAvRGnhupvjt0C9HN6v cJ9lKavwdTP4vbZ1iZDgv7u7bujQuEPlqn+ykiB2LofqNb+d3l83esYoUzUWIhzIkFOJ g1UMEJgUvRM/3gkL+74uygnB2pSMuw7fNsXbDJ8GpCMSAT6g6P6/tWLrN+sTZU/tVL/l MF/iz032Bf+HAkMP8h57gMzpkfPydVyXwxqIKbK293TD/PFrAfPK4IGHuYhNT0CL1Ktl G80Q== 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=6pHSy6ITOBZodEIKnOLq18weO5ojGJDLtwC8jf5C8h0=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=nCC1fhv9RWjw+ZA8UhVyWpQmCmECkEczEZae5fZu99Ew6u7tAqOm21OZunn6q++Or3 V157j9HfxH0i9j7nJOPliJ0nnjr6kjmo2A3vJ8//UJ2UqTcJ6BLLe3SKRQQ134yFBQGg +3oP/H+iC8Yf0NzESZ4EMW99Lc9n9QS3/qSDyfyqQmquQfJNP15Yoj0+oGCQSqOC8sXx 4VLRMGQbiJKCI9LrdKmrcn1RuwJ9+KfcMBPpqiTLKIOqzrJF7qnpiRjXlilEmTm9orBe 4jVj/XtAAZzoBIUpIyPztpbQn8MYS8RiLdUH//UBKW5JKklvA5PfPPZraGHGP6OExP43 VLng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="USgb/cGu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b14-20020a63cf4e000000b005bdb6dbffe7si10539465pgj.273.2023.11.21.14.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 14:05:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="USgb/cGu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 B6BBC802AA2B; Tue, 21 Nov 2023 14:05:04 -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 S234878AbjKUWEj (ORCPT + 99 others); Tue, 21 Nov 2023 17:04:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbjKUWEL (ORCPT ); Tue, 21 Nov 2023 17:04:11 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC1411987; Tue, 21 Nov 2023 14:03: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 3ALJ7UrE028514; Tue, 21 Nov 2023 22:03:04 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=6pHSy6ITOBZodEIKnOLq18weO5ojGJDLtwC8jf5C8h0=; b=USgb/cGuAYXlSRHXjlniCTFqTRDpG/6LxyoXsnjT6kSKGAOqLJDfYVRTU6kirfaa3Xer BohHnPP4IpfAJ3i8PWweDsXA5HjX6CAhGfEqho07b2BCi6q/FyYx8WfxQrLSaa1OxQTc HZKPzkpzUbTWvFE6iuzOk5CngwwgtlfdVQlo9HnisAkxECkD/dHkVaqbzs9pGDqKNnSd yFxRInAUXNoHZraTEuDchS/IpRdPtvxVlmtolNa7HJZx/vdKmW6JVmZOXAPakDIK1zC8 hpyUYqMOWTqLy69G71O+Yl2lhoVvqNPtXJrvmGZqTcqv19vr6BknoDmQv2/xJrWfBN2u SA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uh11we7cn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 22:03:03 +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 3ALLeZah017347; Tue, 21 Nov 2023 22:03:03 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 3uh11we7cd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 22:03:03 +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 3ALLnVaJ010626; Tue, 21 Nov 2023 22:03:02 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uf93kujvn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 22:03:02 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ALM2xbE50331948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Nov 2023 22:02:59 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D40F20063; Tue, 21 Nov 2023 22:02:59 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96C3220067; Tue, 21 Nov 2023 22:02:57 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.179.23.98]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 21 Nov 2023 22:02:57 +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 v2 29/33] s390/traps: Unpoison the kernel_stack_overflow()'s pt_regs Date: Tue, 21 Nov 2023 23:01:23 +0100 Message-ID: <20231121220155.1217090-30-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121220155.1217090-1-iii@linux.ibm.com> References: <20231121220155.1217090-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: urf4wyq_YMj9bTfGVt1cQOZ1POJmOTf- X-Proofpoint-ORIG-GUID: 3zsdaRQNzKCdIMz7-it2_V5FFdGTniq- 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-21_12,2023-11-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 malwarescore=0 priorityscore=1501 phishscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311210172 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]); Tue, 21 Nov 2023 14:05:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783212870211831976 X-GMAIL-MSGID: 1783212870211831976 This is normally done by the generic entry code, but the kernel_stack_overflow() flow bypasses it. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/kernel/traps.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 1d2aa448d103..f299b1203a20 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,11 @@ static void monitor_event_exception(struct pt_regs *regs) void kernel_stack_overflow(struct pt_regs *regs) { + /* + * Normally regs are unpoisoned by the generic entry code, but + * kernel_stack_overflow() is a rare case that is called bypassing it. + */ + kmsan_unpoison_entry_regs(regs); bust_spinlocks(1); printk("Kernel stack overflow.\n"); show_regs(regs);