Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4424447ybl; Tue, 21 Jan 2020 20:28:00 -0800 (PST) X-Google-Smtp-Source: APXvYqz5qnWWHqEojHFtWTOig8bKaPvopvv+yOz6jGNmJm8csgDJR6m6NBg8hsbrJp+FBIa4j8Tv X-Received: by 2002:a9d:6557:: with SMTP id q23mr5858069otl.368.1579667280005; Tue, 21 Jan 2020 20:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579667279; cv=none; d=google.com; s=arc-20160816; b=TxWy5DfUC+BOB+9wfbnVfnh5ct1CQV/tJVATHEhAJk+cU+rAfHK7nZZBvG3507WmWe 2caWyUN3i3ORp3KbWodK+XWQhLHXn3kkXb8ZbNVRt/cLbFRcS63ChxWJ3jrW4rxiQuZ/ 4fFkrZTr6/P91se3yEDwBPEo+ohzua4HmEX/YeIQDA+1czD7WvvBrHnEWlaO+NF514qX OU6AabBzuQWvyDNfgdk8vpfxTSJbxU3AqBcnm/oYnteMvC0P1NtSGUdnN4MqNvbruxtC Ji7kuULxDLcb6hD6POV/RDvME/78J+eeD/Qwhi/z+U8TKC4ckCUh2Ho+ztMUAqiiaP75 I4DQ== 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 :message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=p46K/p7jyUoEmoJcNjNXBHco0qcUxklws/5FMtIPmj4=; b=YYC35ZY/QjQPUUYP2CtprLh/R84i7Zk458duYthLw0itOJ2vwNQgCFx0kpyjLO3K4y 2uR35lMOd4hKo98c5/x7pTnrlfsJh5u29stjwnztU+6Ydjt/83qvSMQJHOEyaySEbMme hKbDOlU8GflQBJ/uOZkRRcOp8Xlp6bON+yrZQ681uAx1KbppvLZCCCE/9nWzt7f58hvR zNYIdPKTcexeKI/XRzyFBMrq+XzWNwAkgL09Hyqpi7ztzJkWVEi0efsPZXdnhFl+g7or HAfMjYT2lZxkM+v+jmydFPilMaNc1LiBqNAu9XTBDjN787NezU4DIGBhlmF4ZBrTsLZf JKJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=B5xvv8pu; 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 l18si23294150oth.236.2020.01.21.20.27.46; Tue, 21 Jan 2020 20:27:59 -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=@axtens.net header.s=google header.b=B5xvv8pu; 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 S1729047AbgAVEZm (ORCPT + 99 others); Tue, 21 Jan 2020 23:25:42 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:38565 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbgAVEZm (ORCPT ); Tue, 21 Jan 2020 23:25:42 -0500 Received: by mail-pj1-f68.google.com with SMTP id l35so2793482pje.3 for ; Tue, 21 Jan 2020 20:25:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-transfer-encoding; bh=p46K/p7jyUoEmoJcNjNXBHco0qcUxklws/5FMtIPmj4=; b=B5xvv8puH6bKb5FnJqYIuZj2YH76W1Qv5xBhn+QqL0Mpye8LTbYUpvMp7erkb9Fqrh C06ZdxbYE2N2TIUm7vug4Tq7Mjzu8unyuDtDZzHCgjh5/MMCMcqK5B413/PDc8DoEeSK RuW68Mt8V7aVC9CAGFxRRzYrxiLmdM02HTK8E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=p46K/p7jyUoEmoJcNjNXBHco0qcUxklws/5FMtIPmj4=; b=O9HFwJCR3JBL1zVf31GUCngSUdJo/vY62NCIGtq34KhvW2hxIe50wwnDDlvup/i4b2 J/Nao6gb5JQKBgxuTVmmHqTvYCY+Yn8JgdnIFUXFFOcAGO21Pf+FHWw5olI/IjkIWzg1 XXCtIngUVVlGCEs9Rt/xr68Xhy80+1OByH8AXl7ib5nFSTAJgIDianEZ+G+MdXuEjheI XT1YEJLpOZlgUt+AtJ4AMYzrrUVOYq1WU8c4dnKNn8CG5o/ZTo+7zh2l5S0N565tHkgM iQ39GIniLbEDPRhWEbfHmxrjMuSyt5z62ftiZpcox5TWTDBKKUVynoXuCUm3cARflmZK 18aA== X-Gm-Message-State: APjAAAUDRKQBfJ4rZwr7AOcKc+brAFwYQVJs8K6d6SJ07wuGzbZ5804I Uu7IBvnY0qH6VgrjDB8cs3tDNg== X-Received: by 2002:a17:902:8484:: with SMTP id c4mr9022713plo.43.1579667141754; Tue, 21 Jan 2020 20:25:41 -0800 (PST) Received: from localhost (2001-44b8-111e-5c00-cc3a-f29a-38f6-dc23.static.ipv6.internode.on.net. [2001:44b8:111e:5c00:cc3a:f29a:38f6:dc23]) by smtp.gmail.com with ESMTPSA id d24sm45845707pfq.75.2020.01.21.20.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 20:25:40 -0800 (PST) From: Daniel Axtens To: Christophe Leroy , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, kasan-dev@googlegroups.com, aneesh.kumar@linux.ibm.com, bsingharora@gmail.com Subject: Re: [PATCH v5 0/4] KASAN for powerpc64 radix In-Reply-To: <8a1b7f4b-de14-90fe-2efa-789882d28702@c-s.fr> References: <20200109070811.31169-1-dja@axtens.net> <8a1b7f4b-de14-90fe-2efa-789882d28702@c-s.fr> Date: Wed, 22 Jan 2020 15:25:37 +1100 Message-ID: <87muagjewu.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > Le 09/01/2020 =C3=A0 08:08, Daniel Axtens a =C3=A9crit=C2=A0: >> Building on the work of Christophe, Aneesh and Balbir, I've ported >> KASAN to 64-bit Book3S kernels running on the Radix MMU. >>=20 >> This provides full inline instrumentation on radix, but does require >> that you be able to specify the amount of physically contiguous memory >> on the system at compile time. More details in patch 4. > > This might be a stupid idea as I don't know ppc64 much. IIUC, PPC64=20 > kernel can be relocated, there is no requirement to have it at address=20 > 0. Therefore, would it be possible to put the KASAN shadow mem at the=20 > begining of the physical memory, instead of putting it at the end ? > That way, you wouldn't need to know the amount of memory at compile time= =20 > because KASAN shadow mem would always be at address 0. Good question! I've had a look. Bearing in mind that I'm not an expert in ppc64 early load, I think it would be possible, but a large chunk of work. One challenge is that - as I understand it - the early relocation code in head_64.S currently allows the kernel to either: - run at the address it's loaded at by kexec/the bootloader, or - relocate the kernel to 0 As far as I can tell book3s 64bit doesn't have code to arbitrarily relocate the kernel. It's possible I'm wrong about this, in which case I'm happy to reasses! If I'm right, I think we'd want to implement KASLR for book3s first, along the lines of how book3e does it. That would allow the kernel to be put at an arbitrary location at runtime. We could then leverage that. Another challenge is that some of the interrupt vectors are not easy to relocate, so we'd have to work around that. That's probably not too big an issue and we'd pick that up in KASLR implementation. So I think this is something we could come back to once we have KASLR. Regards, Daniel > > Christophe