Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1822351ybv; Thu, 6 Feb 2020 10:23:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyUcmo2R406CRHfZ9hyPZip9jzgkbSzA+d+J3h75BKcLONprvm8yJXm3JAieTAlkjA4VHX/ X-Received: by 2002:a05:6830:1305:: with SMTP id p5mr29590179otq.124.1581013421628; Thu, 06 Feb 2020 10:23:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581013421; cv=none; d=google.com; s=arc-20160816; b=S4j7UtBSuv3hfCsFFiiMRWv18eg2y1TbbLjBOQldVzNyTg1LuU816LKpkCPBzxfRN+ AFmEfiRKU3lkmT+/C0tl7r6kCY9XL3CYGoQlHrLWKfNVhAagM6XN6OKyLeguvIZhj6t4 gLTytf24VHkgS0onc087A8Q7LVXwo32KRWdgtkrtfTAgZo36OB2dO33FI3soUyEli0V3 8SN8nOLbTVtFqXRtRVl3mf0Nrty5cKRSm5iFh6XAlaH47360b/SB6J++Ca00N0hXChka xNTxSiR3CSWu6t3ayQcWLtZUTPXEt+74LwtgRCErEHST6zGtdEeG9I+VC1RF4l+Dqxi2 hgmA== 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=d9qzkt0YHl1j1zQLYfgUtStKm8RvBNZBr/cpsyPQQSI=; b=zwM6b9XhDuVoP21yR/ocIRP3z/ab4HQWLrtUySoK2Dyqkuo6bvCdxvlTWWqOOKcQHM HnaXLhqbmyP8RBO6LAx+6m+HiBJiASNQ3MGDjyk7DEl7Km6IY4zI5RJfJWEAnC7LJO5/ Tuo+KrLta3nBd+uM1TZHtIcq7Ihc36+NSULiMbcfUPfqz5D0W0DJLmekm8M0YtzrJHjJ Sr3PYJThgRBEwWS2b9bclYL8oAW5zbsVLM30vWWfW9HeSKbjPZNn3fH77yshyc3XSRq/ ytgzCcfiJx6BmnPjASzdAOEYfgAeKYPXVC/l1/R+Ov5NQXRn+I+vLOaLFx5dGn5mkCPy r13Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=of3NEExB; 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 i20si202854otk.270.2020.02.06.10.23.25; Thu, 06 Feb 2020 10:23:41 -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=of3NEExB; 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 S1727923AbgBFSWN (ORCPT + 99 others); Thu, 6 Feb 2020 13:22:13 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37476 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727910AbgBFSWN (ORCPT ); Thu, 6 Feb 2020 13:22:13 -0500 Received: by mail-wm1-f66.google.com with SMTP id f129so1185656wmf.2 for ; Thu, 06 Feb 2020 10:22:11 -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=d9qzkt0YHl1j1zQLYfgUtStKm8RvBNZBr/cpsyPQQSI=; b=of3NEExBfV2fM3I7sikgdT51i48Le7uGtsh0aom2rPnbXnlRVzXZslTrwBengkOpRM xzK9PhZ54PL14asPAWbWPNlJ0XAfSFKw6J6kaRrdWkqiEuWbJK8SFRCG9HF0bvux/Xuh 3qKGCz/THV4rH4Oatl7fJiyyny9fVGqB3mVVzR4/VWmnxFJCgEddpFJ8btmrPAKOKttM on1g6h5SGxVJj/KVPgMz8gWdgpHugVI7ovgGKwP4yJtjPtt8mmIkspa3iqgztzpXaIje S4GLKh1iz044JTZVSGbLejM9DJIpQQXbTamJ3tlthKcVWzCAzNm95u5mI5/OTy+hRRdA 6A2A== 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=d9qzkt0YHl1j1zQLYfgUtStKm8RvBNZBr/cpsyPQQSI=; b=Q/M12ejfs0WOsXr7DxIcyDBTrMS59NI8N9Rul01hsOBPkpXw7dW3VpHIxEg/gQHY0i 8zwVwStV5/1PkvpBTMg+J0GEDtesiCFPBPT2WBnIt0REkSIXQblFkOXM5ko7ylRSo3yp +0Eq/zanohHig3HyFzbUuNhp6zhJ+ETWw7fuKTAs+4oKN/6jjyjFV3l6AQ4RAYFm++aA SkMgqSKEDlfvazRV48kHbX0g6PM15rUBRbCW/mveYhIITXLTaFRgNwTR28Ijm05XCNj1 10EtcQlSKVE/INAbjUDPrcnPPYfApL2LwTPV7DfrEJY0qyBM8dPEs1LPiqc2DLWGoHxL pVTA== X-Gm-Message-State: APjAAAUkUlbKCWMoLJyUpvcAAxjUELD09beCDfyTeJIWS/fGg6+vP2Gd b0CPCsTdkt9dlJ7rmdzu9GXqjMCPhDvTjReEszbKtA== X-Received: by 2002:a7b:c119:: with SMTP id w25mr6125664wmi.112.1581013330505; Thu, 06 Feb 2020 10:22:10 -0800 (PST) MIME-Version: 1.0 References: <20200115182816.33892-1-trishalfonso@google.com> <4f382794416c023b6711ed2ca645abe4fb17d6da.camel@sipsolutions.net> In-Reply-To: From: Patricia Alfonso Date: Thu, 6 Feb 2020 10:21:59 -0800 Message-ID: Subject: Re: [RFC PATCH] UML: add support for KASAN under x86_64 To: Johannes Berg Cc: richard@nod.at, jdike@addtoit.com, Brendan Higgins , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-um@lists.infradead.org, David Gow , aryabinin@virtuozzo.com, Dmitry Vyukov , anton.ivanov@cambridgegreys.com 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, Jan 16, 2020 at 12:03 AM Johannes Berg wrote: > > On Thu, 2020-01-16 at 08:57 +0100, Johannes Berg wrote: > > > > And if I remember from looking at KASAN, some of the constructors there > > depended on initializing after the KASAN data structures were set up (or > > at least allocated)? It may be that you solved that by allocating the > > shadow so very early though. > > Actually, no ... it's still after main(), and the constructors run > before. > > So I _think_ with the CONFIG_CONSTRUCTORS revert, this will no longer > work (but happy to be proven wrong!), if so then I guess we do have to > find a way to initialize the KASAN things from another (somehow > earlier?) constructor ... > > Or find a way to fix CONFIG_CONSTRUCTORS and not revert, but I looked at > it quite a bit and didn't. > > johannes I've looked at this quite extensively over the past week or so. I was able to initialize KASAN as one of the first things that gets executed in main(), but constructors are, in fact, needed before main(). I think it might be best to reintroduce constructors in a limited way to allow KASAN to work in UML. I have done as much testing as I can on my machine and this limited version seems to work, except when STATIC_LINK is set. I will send some patches of what I have done so far and we can talk more about it there. I would like to add your name, Johannes, as a co-developed-by on that patch. If there is a better way to give you credit for this, please let me know. -- Patricia Alfonso