Message ID | 20231115203401.2495875-1-iii@linux.ibm.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2796298vqg; Wed, 15 Nov 2023 12:34:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjnT84JaxbLY3aoRSmUHbKc3x8Dzg3ijs2wGO03DYvq0/G8loqdNxODFuWFmqrZ4pOaxLx X-Received: by 2002:a17:902:d501:b0:1ce:15cb:62e7 with SMTP id b1-20020a170902d50100b001ce15cb62e7mr8387806plg.19.1700080492469; Wed, 15 Nov 2023 12:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700080492; cv=none; d=google.com; s=arc-20160816; b=Qm2ZTMLFn5ec8d/S/2JOf2X1dKzn/n6urJpye6XNK5O+PV7JS3GSpc3l+yGP+Vk2do WcTM4m7fUJKB91Yp3c//m2xXul05iJPMt7FAazlIZ4nAX5pdmeh+jAt42CwmrAWKrFil xbK7tVWKZhLnQLOknnnMnLKwRIygutWFJBo9+PDR9frfkEY16qNhvLugVo9vsPaZ17er /lOdnLcswh8wBc4ONnKeivJIBHZ/6/llpIk6Uq/msmF0v5TTClz6/h9hx41U9KI11Npi Wlp+GNY9x6D2rwN+g/QVY+VVZRtFI5NO+kzF7rvNWRP8PC+HOYRlK9rEYFYEL42fo6b8 66yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=ZvlPFgCBT1EmH5DZbvTajf8H3CytU5Hp1eV8d/t1KuQ=; fh=Mk/+hh3KXEiY642GJit3QcoQ60j/OUZTCvigu+jTRuo=; b=O0vjkN7lhMkd48UkN+UKXQWqF1Nrd8YqkHQyVOVWomfrK45ed/zZD6yAkl+x8FaE1o b6IYWQJifFdn4ySsJ87+dMDsRZi002iRAN5A0zWDpcpIAnnAjPdq2OBvf1XcoSzCo3+7 ETNGbN9HxyfeTG3Qt+pO0V7+cDz43CDQn13u31IjSCxzuF9grtNtm8ADYZ3PPpQnZk1J iA02yuddKFI/+L0wVvAzUNNrbdcy34b0SJlQ18UGq5NU4GIzfCwC+8RPHl0hrIVXq9jB mPvmE5mr2SFa33XiZp15Qkad2svFdu6oyFQG6juC+gfOB+qgrZpWP96jmZgS+XZxQSrd AQ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=lVtuxA53; 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n5-20020a170902e54500b001c370dc4445si11279443plf.210.2023.11.15.12.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:34:52 -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=lVtuxA53; 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 4456980408E0; Wed, 15 Nov 2023 12:34:51 -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 S1344466AbjKOUen (ORCPT <rfc822;lhua1029@gmail.com> + 29 others); Wed, 15 Nov 2023 15:34:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344443AbjKOUek (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Nov 2023 15:34:40 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA3F911D; Wed, 15 Nov 2023 12:34:34 -0800 (PST) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKWucR031174; Wed, 15 Nov 2023 20:34:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=ZvlPFgCBT1EmH5DZbvTajf8H3CytU5Hp1eV8d/t1KuQ=; b=lVtuxA53NpIasyLyVxsb8g2sO7n8jgKLZr6WnZGjEh2kEwrnxiopq3HP8FWgG/eQr9Xr VtL3WdYhimBH1fouhUkdcRUzN33PjcEORadF8YUTrABEMSxyViiwsRsDkAJsXvhhQ+XP AAuztH9oUnPhD+B38hj/6Jwi2GfSUNsu/rs8rorkASI1NPrszjVN0Zy76poT0sD3oAsA tfDurEFrPEVlDMukq5rTIihutLZBqdHJtzkTqdMmkA8orFXaIIF9SGWftXNY62W18CRw gRht2dTN9GPQ0WvFXWJMk+ei5CPWLLNTytlpBbnw+YdeEFYe5iyGfV7sxGEeULGOvfbJ ew== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud543g10h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:12 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AFKYBS4003580; Wed, 15 Nov 2023 20:34:11 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ud543g0yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:11 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFKIvA1015481; Wed, 15 Nov 2023 20:34:10 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uamxnj0hb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 20:34:10 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AFKY7n744434146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 20:34:07 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE54B20043; Wed, 15 Nov 2023 20:34:06 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 835E020040; Wed, 15 Nov 2023 20:34:05 +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:05 +0000 (GMT) From: Ilya Leoshkevich <iii@linux.ibm.com> To: Alexander Gordeev <agordeev@linux.ibm.com>, Alexander Potapenko <glider@google.com>, Andrew Morton <akpm@linux-foundation.org>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Marco Elver <elver@google.com>, Masami Hiramatsu <mhiramat@kernel.org>, Pekka Enberg <penberg@kernel.org>, Steven Rostedt <rostedt@goodmis.org>, Vasily Gorbik <gor@linux.ibm.com>, Vlastimil Babka <vbabka@suse.cz> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>, Dmitry Vyukov <dvyukov@google.com>, 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 <mark.rutland@arm.com>, Roman Gushchin <roman.gushchin@linux.dev>, Sven Schnelle <svens@linux.ibm.com>, Ilya Leoshkevich <iii@linux.ibm.com> Subject: [PATCH 00/32] kmsan: Enable on s390 Date: Wed, 15 Nov 2023 21:30:32 +0100 Message-ID: <20231115203401.2495875-1-iii@linux.ibm.com> X-Mailer: git-send-email 2.41.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: s_HIgjGFEkw2r82SbnJKsme_JpUxwIpl X-Proofpoint-GUID: O24-gF0cUI_VPwI0_OAIJDvWxXDnx7n2 Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 suspectscore=0 clxscore=1011 mlxlogscore=999 bulkscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 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: <linux-kernel.vger.kernel.org> 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:51 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782663602242732017 X-GMAIL-MSGID: 1782663602242732017 |
Series |
kmsan: Enable on s390
|
|
Message
Ilya Leoshkevich
Nov. 15, 2023, 8:30 p.m. UTC
Hi, This series provides the minimal support for Kernel Memory Sanitizer on s390. Kernel Memory Sanitizer is clang-only instrumentation for finding accesses to uninitialized memory. The clang support for s390 has already been merged [1]. With this series, I can successfully boot s390 defconfig and debug_defconfig with kmsan.panic=1. The tool found one real s390-specific bug (fixed in master). Best regards, Ilya [1] https://reviews.llvm.org/D148596 Ilya Leoshkevich (32): ftrace: Unpoison ftrace_regs in ftrace_ops_list_func() kmsan: Make the tests compatible with kmsan.panic=1 kmsan: Disable KMSAN when DEFERRED_STRUCT_PAGE_INIT is enabled kmsan: Increase the maximum store size to 4096 kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces kmsan: Fix kmsan_copy_to_user() on arches with overlapping address spaces kmsan: Remove a useless assignment from kmsan_vmap_pages_range_noflush() kmsan: Remove an x86-specific #include from kmsan.h kmsan: Introduce kmsan_memmove_metadata() kmsan: Expose kmsan_get_metadata() kmsan: Export panic_on_kmsan kmsan: Allow disabling KMSAN checks for the current task kmsan: Support SLAB_POISON kmsan: Use ALIGN_DOWN() in kmsan_get_metadata() mm: slub: Let KMSAN access metadata mm: kfence: Disable KMSAN when checking the canary lib/string: Add KMSAN support to strlcpy() and strlcat() lib/zlib: Unpoison DFLTCC output buffers kmsan: Accept ranges starting with 0 on s390 s390: Turn off KMSAN for boot, vdso and purgatory s390: Use a larger stack for KMSAN s390/boot: Add the KMSAN runtime stub s390/checksum: Add a KMSAN check s390/cpacf: Unpoison the results of cpacf_trng() s390/ftrace: Unpoison ftrace_regs in kprobe_ftrace_handler() s390/mm: Define KMSAN metadata for vmalloc and modules s390/string: Add KMSAN support s390/traps: Unpoison the kernel_stack_overflow()'s pt_regs s390/uaccess: Add KMSAN support to put_user() and get_user() s390/unwind: Disable KMSAN checks s390: Implement the architecture-specific kmsan functions kmsan: Enable on s390 Documentation/dev-tools/kmsan.rst | 4 +- arch/s390/Kconfig | 1 + arch/s390/Makefile | 2 +- arch/s390/boot/Makefile | 2 + arch/s390/boot/kmsan.c | 6 ++ arch/s390/boot/startup.c | 8 ++ arch/s390/boot/string.c | 15 ++++ arch/s390/include/asm/checksum.h | 2 + arch/s390/include/asm/cpacf.h | 2 + arch/s390/include/asm/kmsan.h | 36 +++++++++ arch/s390/include/asm/pgtable.h | 10 +++ arch/s390/include/asm/string.h | 49 ++++++++----- arch/s390/include/asm/thread_info.h | 2 +- arch/s390/include/asm/uaccess.h | 110 ++++++++++++++++++++-------- arch/s390/kernel/ftrace.c | 1 + arch/s390/kernel/traps.c | 2 + arch/s390/kernel/unwind_bc.c | 2 + arch/s390/kernel/vdso32/Makefile | 1 + arch/s390/kernel/vdso64/Makefile | 1 + arch/s390/purgatory/Makefile | 1 + include/linux/kmsan-checks.h | 26 +++++++ include/linux/kmsan.h | 14 ++++ include/linux/kmsan_types.h | 2 +- kernel/trace/ftrace.c | 1 + lib/string.c | 6 ++ lib/zlib_dfltcc/dfltcc.h | 1 + lib/zlib_dfltcc/dfltcc_util.h | 23 ++++++ mm/Kconfig | 1 + mm/kfence/core.c | 5 +- mm/kmsan/core.c | 2 +- mm/kmsan/hooks.c | 30 +++++++- mm/kmsan/init.c | 4 +- mm/kmsan/instrumentation.c | 11 +-- mm/kmsan/kmsan.h | 3 +- mm/kmsan/kmsan_test.c | 5 ++ mm/kmsan/report.c | 7 +- mm/kmsan/shadow.c | 9 +-- mm/slub.c | 5 +- 38 files changed, 331 insertions(+), 81 deletions(-) create mode 100644 arch/s390/boot/kmsan.c create mode 100644 arch/s390/include/asm/kmsan.h
Comments
On Wed, Nov 15, 2023 at 9:34 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote: > > Hi, > > This series provides the minimal support for Kernel Memory Sanitizer on > s390. Kernel Memory Sanitizer is clang-only instrumentation for finding > accesses to uninitialized memory. The clang support for s390 has already > been merged [1]. > > With this series, I can successfully boot s390 defconfig and > debug_defconfig with kmsan.panic=1. The tool found one real > s390-specific bug (fixed in master). > > Best regards, > Ilya Hi Ilya, This is really impressive! Can you please share some instructions on how to run KMSAN in QEMU? I've never touched s390, but I'm assuming it should be possible?
On Thu, 2023-11-16 at 09:42 +0100, Alexander Potapenko wrote: > On Wed, Nov 15, 2023 at 9:34 PM Ilya Leoshkevich <iii@linux.ibm.com> > wrote: > > > > Hi, > > > > This series provides the minimal support for Kernel Memory > > Sanitizer on > > s390. Kernel Memory Sanitizer is clang-only instrumentation for > > finding > > accesses to uninitialized memory. The clang support for s390 has > > already > > been merged [1]. > > > > With this series, I can successfully boot s390 defconfig and > > debug_defconfig with kmsan.panic=1. The tool found one real > > s390-specific bug (fixed in master). > > > > Best regards, > > Ilya > > Hi Ilya, > > This is really impressive! > Can you please share some instructions on how to run KMSAN in QEMU? > I've never touched s390, but I'm assuming it should be possible? I developed this natively (without cross-compilation or emulation, just KVM), but I just gave the following a try on x86_64 and had some success: $ make LLVM=1 ARCH=s390 O=../linux-build-s390x-cross CC=clang-18 LD=s390x-linux-gnu-ld OBJCOPY=s390x-linux-gnu-objcopy debug_defconfig $ make LLVM=1 ARCH=s390 O=../linux-build-s390x-cross CC=clang-18 LD=s390x-linux-gnu-ld OBJCOPY=s390x-linux-gnu-objcopy menuconfig $ make LLVM=1 ARCH=s390 O=../linux-build-s390x-cross CC=clang-18 LD=s390x-linux-gnu-ld OBJCOPY=s390x-linux-gnu-objcopy -j24 $ qemu-system-s390x -M accel=tcg -smp 2 -m 4G -kernel ../linux-build- s390x-cross/arch/s390/boot/bzImage -nographic -append 'root=/dev/vda1 rw console=ttyS1 nokaslr earlyprintk cio_ignore=all kmsan.panic=1' - object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng- ccw,rng=rng0 It's also possible to get a free s390 machine at [1]. [1] https://linuxone.cloud.marist.edu/oss
Am 16.11.23 um 11:13 schrieb Ilya Leoshkevich: > It's also possible to get a free s390 machine at [1]. > > [1] https://linuxone.cloud.marist.edu/oss I think the URL for registration is this one https://linuxone.cloud.marist.edu/#/register?flag=VM