Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp312061ybv; Thu, 13 Feb 2020 00:45:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyr4d7YDph+hR+oi3LdRtff4eQzbATypD539tzPt6r0GvxmCC6Q/J69VZE4oq+pyKAL7kkP X-Received: by 2002:aca:43c1:: with SMTP id q184mr2080272oia.116.1581583532315; Thu, 13 Feb 2020 00:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581583532; cv=none; d=google.com; s=arc-20160816; b=Ev8u5d2rh4A2JUanLQ500WaSpi6zXLbQBdxdoD05F0SV8OIgzl9+3/Xe1AQCx1kkt6 Qj8z+jyxBaPD6S/b1pqGVil6o4ULR+xHVB7iiavymXpHPfkGPSutX/sISOp83xbv226f 9/C0y6QdBR+RC//uBYdYXFO5Kwv0qnlIKYUVuZgEcZPXGxfA8aehEQTaFK2D2lHDtLry q87yhsqG/U3c6B+oiZc1gBJVdFlHb/PkUBZ/tJeF1E5IOV51KBz18cVlMPIEhEzVJY6q s8IqHXYFcViMBF7pozG9SW3AGXkfKzCdJ9izXDvkvoL+oYZKrYrz+T6GiadSJglZWUdT zSMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KOSVM3SCrmejITCMr3GluXgYMymHjzYiqiilJMCtfIo=; b=ySU27ykax14Eask294wDkS8UqXmu1y7pBXS/emCvZvel0KmCDZsU9yc/tkgVgct8e+ nQBIWx36IwWXXkVw4JABkiqmnl2kZZpfGZZft1JyXU8RUa971ac+WEq1smVzBJHJJE8c 5aTmFPAXiWVfbsUIt924FB+/fVjdHzauPDHMLVm6beqRZjUKK1X7q01uLxNPr4V6Z7dB eMEEn3+daFFBPQ81ldgoogf7X83UuaIMKddCIjwoC3dtTiIWYzlMUG/9UBo2TB1xy/bG Pozaz0TXMOyfIYh9sz6DHqiYjgB0Xt//kOWqm9b5Henybcx4+B/TDxBE1P9dhvhqZrc5 VKDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NPtaUJUr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si817240otp.236.2020.02.13.00.45.20; Thu, 13 Feb 2020 00:45:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NPtaUJUr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729557AbgBMIou (ORCPT + 99 others); Thu, 13 Feb 2020 03:44:50 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:46459 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729406AbgBMIou (ORCPT ); Thu, 13 Feb 2020 03:44:50 -0500 Received: by mail-qt1-f193.google.com with SMTP id e21so3787398qtp.13 for ; Thu, 13 Feb 2020 00:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KOSVM3SCrmejITCMr3GluXgYMymHjzYiqiilJMCtfIo=; b=NPtaUJUrHrgkXufReVIevgow9DgZl2OKuyPO8hT6d+F7xLGlqPXjQh/3lcHQQlw6Ai P7LyDIUQM8v6bMydOpYp6lGLTQTuYskdEkSfgYDRV5OSzBxsf8y001ygJgNSwxx5/YON 32oVmuKlslI3S7NGNaaCgn4PrGeySYRDP1pThEOrV0H4dszmfQ+mjkn2ioQTX4FHGxih T5dVeKVECRVjebE+UEmRT4VG18wci/MtxXD+cvaHnE2y53WnfOwOo5VX/ShWB4rcRk6h JIRRGUPe6raHp0YkROsKIBiTGim39fD2i6vuzecV+d+bDQBVi3ve4KvoxWWtWOEksW7G gm0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KOSVM3SCrmejITCMr3GluXgYMymHjzYiqiilJMCtfIo=; b=uacuJ+RkFjeauo93uHQnE40nDSY03sSBKsy6VqnVvIOQFmnlFtVqygElDndnQG5I7D Nfc6XmL3VtlzgtuhkCu6lcGuese+PJz41kgQwCoPqpXq7zi7jZm/a4EsLgCVVYoriPuC tlY4Pj1DYqVFyJPDXZrALXbRrtD/p0I6Vjs+Yh8isIrgGnYOgHJWrmM0FB34F3nh5mwI UL34X3NGNX5aXhUm7hLFtMQfNEho+DnWC4JjPH1RxxcU+0GpelQw9IWeEDrSCLquxMTn 9iuIiu4msn97G4NtpuryHn3/8m16KuoMSPEabxjASon2QAz6Njiz3fcmcMxH64C8JtHX D8XQ== X-Gm-Message-State: APjAAAWYRjHvhN4VUBCaZ0uWp98Dj5oFgISMDarZEvgjR/4/BV3ac4v0 6JVKiF3lOY3KkoD5hCF3vOKnR4WphrboKP9KK0OJUQ== X-Received: by 2002:aed:36a5:: with SMTP id f34mr10288280qtb.57.1581583489053; Thu, 13 Feb 2020 00:44:49 -0800 (PST) MIME-Version: 1.0 References: <20200210225806.249297-1-trishalfonso@google.com> <13b0ea0caff576e7944e4f9b91560bf46ac9caf0.camel@sipsolutions.net> In-Reply-To: From: Dmitry Vyukov Date: Thu, 13 Feb 2020 09:44:37 +0100 Message-ID: Subject: Re: [RFC PATCH v2] UML: add support for KASAN under x86_64 To: Johannes Berg Cc: Patricia Alfonso , Jeff Dike , Richard Weinberger , anton.ivanov@cambridgegreys.com, Andrey Ryabinin , David Gow , Brendan Higgins , kasan-dev , LKML , linux-um@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 13, 2020 at 9:19 AM Johannes Berg wrote: > > On Wed, 2020-02-12 at 16:37 -0800, Patricia Alfonso wrote: > > > > > That also means if I have say 512MB memory allocated for UML, KASAN will > > > use an *additional* 64, unlike on a "real" system, where KASAN will take > > > about 1/8th of the available physical memory, right? > > > > > Currently, the amount of shadow memory allocated is a constant based > > on the amount of user space address space in x86_64 since this is the > > host architecture I have focused on. > > Right, but again like below - that's just mapped, not actually used. But > as far as I can tell, once you actually start running and potentially > use all of your mem=1024 (MB), you'll actually also use another 128MB on > the KASAN shadow, right? > > Unlike, say, a real x86_64 machine where if you just have 1024 MB > physical memory, the KASAN shadow will have to fit into that as well. Depends on what you mean by "real" :) Real user-space ASAN will also reserve 1/8th of 47-bit VA on start (16TB). This implementation seems to be much closer to user-space ASAN rather than to x86_64 KASAN (in particular it seems to be mostly portable across archs and is not really x86-specific, which is good). I think it's reasonable and good, but the implementation difference with other kernel arches may be worth noting somewhere in comments.