Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7553051ybl; Thu, 16 Jan 2020 01:25:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwgV7D+L0PIVU7AJONk6C82eCwkvckEPjK0nP1NBYLKN9UERpl9Qva8IIGtFGxbCfZa2Nxz X-Received: by 2002:a9d:7b4a:: with SMTP id f10mr1301301oto.4.1579166723311; Thu, 16 Jan 2020 01:25:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579166723; cv=none; d=google.com; s=arc-20160816; b=yVcomkS8eTXltW9PJq+JdvxGdUlHKkjfGiq9cL+MwX7x4r7ZzhWvOYTAiSUj8tottr vwDgNrvMpMORhUP4NiAyofaAfwa2/chHNOom/hLiFsH0MjRRGg5ZtOzdLAugs7L1UxKz TkgpEcM7W8hRYQozeaGRSjCOeGPKlz3YhiH7XIxcT0psbaRjh0t+nJTpjJ8eTWJEQIJF 3X+jLq3iEkHAgCKChqO7y7f1WoqOeY/MOO9Y+iffIe5yrydtk82g+yGqVIb9YpbCQpJX cU3sr1E0WVqTRpTsr03xaBoSuMic8ACZVjJ0hErvnRQ0b2vCknvs8BLEgcM+7UVGr1Zv 4bKg== 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=RqTHK7EsHlkxZxI0RjfjnnG8P6WuHcl1Hv4xLIayM+k=; b=Lg1Ngh+w33bhyxMRQ2XCNr3oZZqLpC0Nj8WDImvPdqLvN2xp6X2NiR4vMWIOTF2lzo sQFZuZTxpTpp14E4/hqYyACngfgTsiwBaiMHsZN69DXl2A5XYJ+J+hxUE1g9iNfYlIqc HUQg0ytK0u27oWaxzzFVOU9D6RvRdPFLuzGq0BllPEiI9bX9wtZ5pAR1EUR7+6qzIGGi ESu8hIcZiJVygND9SWXl3ZVzkBmG7q23vKnEsC1S1cnLNFf9QF9U8gMmId5CnQlAOcqN 4A/PCBjfAClg0nml2WxuT+hLYE2ifEOCGXSQ1LlDafuj14V9VNwKRowJ3KQDY5dref9M Qz0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HpLbf4ux; 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 l5si11040899oil.96.2020.01.16.01.25.11; Thu, 16 Jan 2020 01:25:23 -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=HpLbf4ux; 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 S1729210AbgAPJXR (ORCPT + 99 others); Thu, 16 Jan 2020 04:23:17 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:44686 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726684AbgAPJXQ (ORCPT ); Thu, 16 Jan 2020 04:23:16 -0500 Received: by mail-qk1-f194.google.com with SMTP id w127so18434022qkb.11 for ; Thu, 16 Jan 2020 01:23:16 -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=RqTHK7EsHlkxZxI0RjfjnnG8P6WuHcl1Hv4xLIayM+k=; b=HpLbf4uxq8fRi3bKhNWhpU5pHPQckZfZ59vh4lK7H3xBt3xhQD10n+b7yfJQNUjRlE 6lrTGckCWoGJ80lqWQEPzJAX/y8viSSaP6MmBJp5ZRrJ5bO1Tvvcn7dNK6JAAuiRFgJ0 vUsyFFsl7D86NxAhTcG3FNEpM3lkaEpRs02bNjsI0wTbwnCMr6jQX9+ehe2MlUysBU5d FPEjlJw1uTPm0hz5FMQZcvBd2m+HJhpZQaHVy0Ge8LZ/k8ygGX1GdF//REwrGXAZp+Z/ KTczAg81N3qZYs0gBnM03cA3l54YK4/Du1xkipH5D01C69gU++YuCiMObidhYiQSV67a bo5Q== 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=RqTHK7EsHlkxZxI0RjfjnnG8P6WuHcl1Hv4xLIayM+k=; b=pGYL0ZHt3kcIwDCupBqstHqCA2RYgIvvrmWjbCSWYjx4eKngdsrd/t79vVMQX+Wlct joaH7VPtWBRjWcIEWab+3r9HxNnSckksMg3AjjSPlh7jR0rCZD3MtoUUzc6t4cGOmGDy +RQ6r/e1zTynAZjyGy/zcu3ZvZfREt6/NIllemzeOtN06bIlnHj7vvtfTZPTGKCGn5zZ Oy1PToQ3O4vKWPl2oFbooc6wrCvgvBIQ2knjw13CS1N6Akr7CyUWBKyJ090M8C5ri8SS FnQY04ILm5GLVJquvgMyUyno+96VW+1ICt0Cz+lx5bB/7/X4d1ARs8yV3frUmdgpEsNO 1paw== X-Gm-Message-State: APjAAAVQnAWWskyV7QhmMLSih/I+JQFn2xS+FILaLIdJdkEw787eaqdL 3hXwnC4TtXDfgKCAPpsom8mzAxdlQXzUqhlqrbcZPA== X-Received: by 2002:ae9:eb48:: with SMTP id b69mr31201094qkg.43.1579166595511; Thu, 16 Jan 2020 01:23:15 -0800 (PST) MIME-Version: 1.0 References: <20200115182816.33892-1-trishalfonso@google.com> <4f382794416c023b6711ed2ca645abe4fb17d6da.camel@sipsolutions.net> <2092169e6dd1f8d15f1db4b3787cc9fe596097b7.camel@sipsolutions.net> In-Reply-To: <2092169e6dd1f8d15f1db4b3787cc9fe596097b7.camel@sipsolutions.net> From: Dmitry Vyukov Date: Thu, 16 Jan 2020 10:23:04 +0100 Message-ID: Subject: Re: [RFC PATCH] UML: add support for KASAN under x86_64 To: Johannes Berg Cc: Patricia Alfonso , Richard Weinberger , Jeff Dike , Brendan Higgins , LKML , kasan-dev , linux-um@lists.infradead.org, David Gow , Andrey Ryabinin , 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 10:20 AM Johannes Berg wrote: > > On Thu, 2020-01-16 at 10:18 +0100, Dmitry Vyukov wrote: > > > > Looking at this problem and at the number of KASAN_SANITIZE := n in > > Makefiles (some of which are pretty sad, e.g. ignoring string.c, > > kstrtox.c, vsprintf.c -- that's where the bugs are!), I think we > > initialize KASAN too late. I think we need to do roughly what we do in > > user-space asan (because it is user-space asan!). Constructors run > > before main and it's really good, we need to initialize KASAN from > > these constructors. Or if that's not enough in all cases, also add own > > constructor/.preinit array entry to initialize as early as possible. > > We even control the linker in this case, so we can put something into > the .preinit array *first*. Even better! If we can reliably put something before constructors, we don't even need lazy init in constructors. > > All we need to do is to call mmap syscall, there is really no > > dependencies on anything kernel-related. > > OK. I wasn't really familiar with those details. > > > This should resolve the problem with constructors (after they > > initialize KASAN, they can proceed to do anything they need) and it > > should get rid of most KASAN_SANITIZE (in particular, all of > > lib/Makefile and kernel/Makefile) and should fix stack instrumentation > > (in case it does not work now). The only tiny bit we should not > > instrument is the path from constructor up to mmap call. > > That'd be great :) > > johannes > > -- > You received this message because you are subscribed to the Google Groups "kasan-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/2092169e6dd1f8d15f1db4b3787cc9fe596097b7.camel%40sipsolutions.net.