Received: by 10.223.185.116 with SMTP id b49csp1140341wrg; Wed, 14 Feb 2018 12:14:45 -0800 (PST) X-Google-Smtp-Source: AH8x227LASmRZ0DC4vKrRZVR0HbIwMaP18MZcXm8MWUeKhNWeNwL62BfkUqO3SeTKUOM9uAMATZm X-Received: by 2002:a17:902:aa46:: with SMTP id c6-v6mr181426plr.357.1518639285316; Wed, 14 Feb 2018 12:14:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518639285; cv=none; d=google.com; s=arc-20160816; b=t79Pop7bkCvSuptmL7hEnQ4ABWSX3XUj3rPWkMKa/MOidfdOZqfoYxfSuHqY3RlWFr nFeccoEGJi4Tidfijd5yS4mlIVdqnmXW+kRwgQXc9GcX0rJisqmanNl0/HsQFAZ0hoJe z98OY+l7IdpD200vpBvRPBUMo20PrJ04ZHTdILnDGzx8hga3lcaj/Y5HIdncgnduTF8B 3iKDF4JIBSKRMNjAYBtmtL9ix7uXi/b6Uvia95V2G0GjlvdiVUrIUY2Ag/7M20XguStA iGGkc1YlUT7HV3EOxP0zBJ3eD1rpzSk7ptl1bd0DPzDp+useD57idwbXE9rRJ6hBIbuK Fypw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=1lNpz1BEClmqSUTSqH8Pw+a63kZtddb6696oNWiyEWc=; b=RJM+FcJdhsrp1j7C5S85wNMXVWyWRq7cAlT7MT+PWEBuYtVcTNgno/W5Coq89IvTWv /pgkUBwcVQKld/2HRtnvvq5R1G9S29R11uwojzHG8z8G8y/lNolCraLqHIvQIuBie8JQ RjxcLRuLpirhqC3kyvp3Kw5DxQjDIYQbBKiUPaUE52IIlpCv+wQNnd9bY9QYyqEeO/Ax dSa56TC4LVzEvET1O+N5H4tIcXFIsX9kxWgePqhu4muFov7MlVRg/vBI2C+j7aCMaCo0 8GY3eB76Pjo04DIGa6eLX/fqMD6S9jRxzIDARuRrZMXozMeT1nCDpeODHeJa/ixwtcjw x6Pg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u127si1270539pgc.75.2018.02.14.12.14.30; Wed, 14 Feb 2018 12:14:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031852AbeBNUNq (ORCPT + 99 others); Wed, 14 Feb 2018 15:13:46 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:35165 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031680AbeBNUNk (ORCPT ); Wed, 14 Feb 2018 15:13:40 -0500 Received: by mail-ot0-f195.google.com with SMTP id a2so21503529otf.2 for ; Wed, 14 Feb 2018 12:13:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1lNpz1BEClmqSUTSqH8Pw+a63kZtddb6696oNWiyEWc=; b=Xbo+5asIgZL1JvhNDoUVZVCN2zkAoe0g8LLCAtihPecvwFjJyytcvVWdhzdZwh+PrJ efnUcvOWMcnRsN/dXtoi2qfqxpA+hCUwPDFwVTkiTif7eAchow2hMJiz6g2ZNEf3vBfP ZJg9xR8xu1ZHkyx0R4Tvk67l1Q7p5fKchLU+6uMM1hayDBL1+Y0phBpTf4Ok5MGWOwcf lP91ft329UexBI1T5CwdazRlvkbBqOSWNjCfWCzGu5EcwcbZJO1/M2j515LK9FIX6sHj dyUMteJog53lI6NsOrtYuIbiYpbC3XJ5VNjxWgopkuuPwbmaW3/xuSiZI1eeusipKS6o dCkw== X-Gm-Message-State: APf1xPBIDUnlIQLyMbUHILFrP7Hzp5Jk4nRoWnIsYL6DkF3dOUrI9cx3 uoEuPc9PHiApmHFXPPuMY0iaEQ== X-Received: by 10.157.32.228 with SMTP id x91mr209387ota.176.1518639220144; Wed, 14 Feb 2018 12:13:40 -0800 (PST) Received: from ?IPv6:2601:602:9802:a8dc::f21a? ([2601:602:9802:a8dc::f21a]) by smtp.gmail.com with ESMTPSA id f2sm7181558oia.22.2018.02.14.12.13.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 12:13:38 -0800 (PST) Subject: Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory) To: Ard Biesheuvel Cc: Kees Cook , Jann Horn , Igor Stoppa , Boris Lukashev , Christopher Lameter , Matthew Wilcox , Jerome Glisse , Michal Hocko , Christoph Hellwig , linux-security-module , Linux-MM , kernel list , Kernel Hardening , linux-arm-kernel References: <20180124175631.22925-1-igor.stoppa@huawei.com> <20180126053542.GA30189@bombadil.infradead.org> <8818bfd4-dd9f-f279-0432-69b59531bd41@huawei.com> <17e5b515-84c8-dca2-1695-cdf819834ea2@huawei.com> <414027d3-dd73-cf11-dc2a-e8c124591646@redhat.com> <2f23544a-bd24-1e71-967b-e8d1cf5a20a3@redhat.com> From: Laura Abbott Message-ID: <213effab-f0d0-cfc5-8feb-c72eed8ae0aa@redhat.com> Date: Wed, 14 Feb 2018 12:13:36 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/14/2018 11:28 AM, Ard Biesheuvel wrote: > On 14 February 2018 at 19:06, Laura Abbott wrote: >> On 02/13/2018 01:43 PM, Kees Cook wrote: >>> >>> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott wrote: >>>> >>>> No, arm64 doesn't fixup the aliases, mostly because arm64 uses larger >>>> page sizes which can't be broken down at runtime. CONFIG_PAGE_POISONING >>>> does use 4K pages which could be adjusted at runtime. So yes, you are >>>> right we would have physmap exposure on arm64 as well. >>> >>> >>> Errr, so that means even modules and kernel code are writable via the >>> arm64 physmap? That seems extraordinarily bad. :( >>> >>> -Kees >>> >> >> (adding linux-arm-kernel and changing the subject) >> >> Kernel code should be fine, if it isn't that is a bug that should be >> fixed. > > We take care to ensure that the linear alias of the core kernel's > .text and .rodata segments are mapped read-only. When we first moved > the kernel out of the linear region, we did not map it there at all > anymore, but that broke hibernation so we had to put something back. > >> Modules yes are not fully protected. The conclusion from past >> experience has been that we cannot safely break down larger page sizes >> at runtime like x86 does. We could theoretically >> add support for fixing up the alias if PAGE_POISONING is enabled but >> I don't know who would actually use that in production. Performance >> is very poor at that point. >> > > As long as the linear alias of the module is mapped down to pages, we > should be able to tweak the permissions. I take it that PAGE_POISONING > does more than just that? > Page poisoning does exactly that. The argument I was trying to make was that if nobody really uses page poisoning except for debugging it might not be worth it to fix up the alias. Thinking a bit more, this is a terrible argument for many reasons so yes I agree that we can just fix up the alias if PAGE_POISONING (or other features) are enabled. Thanks, Laura