From mboxrd@z Thu Jan 1 00:00:00 1970 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 477D9C433EF for ; Fri, 27 May 2022 20:14:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A75C68D0003; Fri, 27 May 2022 16:14:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FD688D0001; Fri, 27 May 2022 16:14:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C3098D0003; Fri, 27 May 2022 16:14:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 75D8E8D0001 for ; Fri, 27 May 2022 16:14:53 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5152935D68 for ; Fri, 27 May 2022 20:14:53 +0000 (UTC) X-FDA: 79512626466.02.00D374B Received: from sipsolutions.net (s3.sipsolutions.net [144.76.43.62]) by imf11.hostedemail.com (Postfix) with ESMTP id 2CB8C4003E for ; Fri, 27 May 2022 20:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=/JbY6NIfEA9XeqiPP6KIr66UKiO0C7oMhJ4ZgGJq/uk=; t=1653682492; x=1654892092; b=xfSuuqE/bjBfmVTrMELGqkYRXs24dn36S9hG5yFx46wfVER CrkUi6TROiYMLL35SbOK/DwYLWcyBYfs4WvlVSzn4gp1QJPkEtDZl8scVSovxZdc8C+Wq2N3W8nb4 JE1YFXu/+P4Tb+8sfopFgNLb8rP1L6jhn1YkurXUkhtsuq8s6uRXOLSjRhKWOxJOgfomhn4Nb4GLs HP2a+3seD3/7c3AJeL7bnwSQLQlqoSpKOsUN2b8TWB2eo6WExilmNCRD55xpvD7Q2P2Pw+74NTGyw IrOJV7f2w80UsRKHErWnmn+O1KMJj5Qtj/OSY4+sRdkFVpujWfIbpNenu483/Rww==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nugM3-006B6d-Au; Fri, 27 May 2022 22:14:39 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] UML: add support for KASAN under x86_64 From: Johannes Berg To: David Gow , Vincent Whitchurch , Patricia Alfonso , Jeff Dike , Richard Weinberger , anton.ivanov@cambridgegreys.com, Dmitry Vyukov , Brendan Higgins , Andrew Morton , Andrey Konovalov , Andrey Ryabinin Cc: kasan-dev , linux-um@lists.infradead.org, LKML , Daniel Latypov , linux-mm@kvack.org Date: Fri, 27 May 2022 22:14:37 +0200 In-Reply-To: <20220527185600.1236769-2-davidgow@google.com> References: <20220527185600.1236769-1-davidgow@google.com> <20220527185600.1236769-2-davidgow@google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.1 (3.44.1-1.fc36) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2CB8C4003E X-Rspam-User: X-Stat-Signature: 4ztdi4cabme9fd3u15mgha8dy6sw1sjb Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=sipsolutions.net header.s=mail header.b="xfSuuqE/"; dmarc=pass (policy=none) header.from=sipsolutions.net; spf=pass (imf11.hostedemail.com: domain of johannes@sipsolutions.net designates 144.76.43.62 as permitted sender) smtp.mailfrom=johannes@sipsolutions.net X-HE-Tag: 1653682485-800318 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: On Fri, 2022-05-27 at 11:56 -0700, David Gow wrote: >=20 > This is v2 of the KASAN/UML port. It should be ready to go. Nice, thanks a lot! :) > It does benefit significantly from the following patches: > - Bugfix for memory corruption, needed for KASAN_STACK support: > https://lore.kernel.org/lkml/20220523140403.2361040-1-vincent.whitchurch@= axis.com/ Btw, oddly enough, I don't seem to actually see this (tried gcc 10.3 and 11.3 so far) - is there anything you know about compiler versions related to this perhaps? Or clang only? The kasan_stack_oob test passes though, and generally 45 tests pass and 10 are skipped. > +# Kernel config options are not included in USER_CFLAGS, but the > option for KASAN > +# should be included if the KASAN config option was set. > +ifdef CONFIG_KASAN > + USER_CFLAGS+=3D-DCONFIG_KASAN=3Dy > +endif >=20 I'm not sure that's (still?) necessary - you don't #ifdef on it anywhere in the user code; perhaps the original intent had been to #ifdef kasan_map_memory()? > +++ b/arch/um/os-Linux/user_syms.c > @@ -27,10 +27,10 @@ EXPORT_SYMBOL(strstr); > #ifndef __x86_64__ > extern void *memcpy(void *, const void *, size_t); > EXPORT_SYMBOL(memcpy); > -#endif > - > EXPORT_SYMBOL(memmove); > EXPORT_SYMBOL(memset); > +#endif > + > EXPORT_SYMBOL(printf); > =20 > /* Here, instead, I can provide a fake prototype. Yes, someone cares: ge= nksyms. > diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile > index ba5789c35809..f778e37494ba 100644 > --- a/arch/x86/um/Makefile > +++ b/arch/x86/um/Makefile > @@ -28,7 +28,8 @@ else > =20 > obj-y +=3D syscalls_64.o vdso/ > =20 > -subarch-y =3D ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk= _64.o > +subarch-y =3D ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk= _64.o \ > + ../lib/memmove_64.o ../lib/memset_64.o I wonder if we should make these two changes contingent on KASAN too, I seem to remember that we had some patches from Anton flying around at some point to use glibc string routines, since they can be even more optimised (we're in user space, after all). But I suppose for now this doesn't really matter, and even if we did use them, they'd come from libasan anyway? Anyway, looks good to me, not sure the little not above about the user cflags matters. Reviewed-by: Johannes Berg johannes