Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2217991ybb; Mon, 30 Mar 2020 01:42:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu8hNOsQ+rRNImfVk0iETr1qgxBRUSrSyIxgJW5QwLEcMvtWte66MPFRBWAdiot5pI6kCjF X-Received: by 2002:a9d:2f26:: with SMTP id h35mr7899089otb.246.1585557753381; Mon, 30 Mar 2020 01:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585557753; cv=none; d=google.com; s=arc-20160816; b=hPu8XdTsAc88nl9uSKzjeDDxCta02+hD3JDmr2GHwND79ftJz+8XWqfgNysImr+0iV gFX1IeM0GF2R48zPEf+VQFcoKMz9/cNdf2jFOfblyc/XLlO3MhCUmjPfgWF1nj+HjOd1 aNM6A0W2SA/G/XZZKq6Qz2pVfP245NV5tlFW+adU1iyaPTMKChHDYCHxKNRGmxX85V9d wyWwrH9sDeiWRIPL0439sRzr5uwSnDjMwzdYvtTmC0+4np2k9yXjr099taxWqach4yCD fxq1f9KG7i9MqS2jLFEfvv8yHqDQtPk1fdmRwOHiuhH5IbNuvONAAHesCkAgnLdsT7/Z RwRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=t1AP1Z+DLp+G+REyxDxIG8hH7ooygsBWX8eGtMxKgIE=; b=RuxNobPZHyXVBUnRfX3U4R6KIXfCGduI4P9lX89uyIEWO83mwZ/0lQEF/GdwZoXrlQ 3X5i6z8vCBIUZqrJULeVhRnDzKrQLKN1Uofu7GTeXxC67xEHJjiAX8a0ugRuBGDvu7V2 CEbIGaaMSCvuQYCZLfJKYiHez8XdWRuyiJAidgwxtD1vtsJ64XEr07RH16nQO9PCJRCq HagVGapiPqKaPjw/BHYU05DGjLuSHXSjb7j0ftL3bigUlJgDpcsaYC3cIvRRyaAzLawg lIS1n2+f5iAWE/Mq2aoivBBQ7l2k7iUv3deKLHxNkfQ1jqBjYDddENjHaaDcdaEFkoux iqhA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si6043967otl.122.2020.03.30.01.42.21; Mon, 30 Mar 2020 01:42:33 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729726AbgC3Il4 (ORCPT + 99 others); Mon, 30 Mar 2020 04:41:56 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:51258 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729398AbgC3Il4 (ORCPT ); Mon, 30 Mar 2020 04:41:56 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jIpzM-005Qx3-IU; Mon, 30 Mar 2020 10:41:44 +0200 Message-ID: Subject: Re: [PATCH] UML: add support for KASAN under x86_64 From: Johannes Berg To: Dmitry Vyukov Cc: Patricia Alfonso , Jeff Dike , Richard Weinberger , anton.ivanov@cambridgegreys.com, Andrey Ryabinin , Brendan Higgins , David Gow , linux-um@lists.infradead.org, LKML , kasan-dev Date: Mon, 30 Mar 2020 10:41:43 +0200 In-Reply-To: (sfid-20200330_103904_296794_2F7C15A1) References: <20200226004608.8128-1-trishalfonso@google.com> <4b8c1696f658b4c6c393956734d580593b55c4c0.camel@sipsolutions.net> <674ad16d7de34db7b562a08b971bdde179158902.camel@sipsolutions.net> <2cee72779294550a3ad143146283745b5cccb5fc.camel@sipsolutions.net> (sfid-20200330_103904_296794_2F7C15A1) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-03-30 at 10:38 +0200, Dmitry Vyukov wrote: > On Mon, Mar 30, 2020 at 9:44 AM Johannes Berg wrote: > > On Fri, 2020-03-20 at 16:18 +0100, Dmitry Vyukov wrote: > > > > Wait ... Now you say 0x7fbfffc000, but that is almost fine? I think you > > > > confused the values - because I see, on userspace, the following: > > > > > > Oh, sorry, I copy-pasted wrong number. I meant 0x7fff8000. > > > > Right, ok. > > > > > Then I would expect 0x1000 0000 0000 to work, but you say it doesn't... > > > > So it just occurred to me - as I was mentioning this whole thing to > > Richard - that there's probably somewhere some check about whether some > > space is userspace or not. > > > > I'm beginning to think that we shouldn't just map this outside of the > > kernel memory system, but properly treat it as part of the memory that's > > inside. And also use KASAN_VMALLOC. > > > > We can probably still have it at 0x7fff8000, just need to make sure we > > actually map it? I tried with vm_area_add_early() but it didn't really > > work once you have vmalloc() stuff... > > But we do mmap it, no? See kasan_init() -> kasan_map_memory() -> mmap. Of course. But I meant inside the UML PTE system. We end up *unmapping* it when loading modules, because it overlaps vmalloc space, and then we vfree() something again, and unmap it ... because of the overlap. And if it's *not* in the vmalloc area, then the kernel doesn't consider it valid, and we seem to often just fault when trying to determine whether it's valid kernel memory or not ... Though I'm not really sure I understand the failure part of this case well yet. johannes