Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2244725ybd; Mon, 24 Jun 2019 03:12:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiG3FD7+5kdeoNsmnvoB5Df3q2kRvZniyCqT7HevgWY6jChDjeeZXd3MKh6lXkn0XaPFT9 X-Received: by 2002:a17:90b:8d8:: with SMTP id ds24mr23552363pjb.135.1561371158376; Mon, 24 Jun 2019 03:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371158; cv=none; d=google.com; s=arc-20160816; b=ljilEC9plStKqQK6iBjZ/D4QByOdHP95E5PKqRxPUtQqkxJGTlbSxgznBTadepLt2g GcLEFheXjgfsV4IJy3VJcAapVRwYVOdi1dpTKD0Puy+HzFMbVOrxhfVxf4IYpyw56wOu RZx5m7XHE95blDcT+JXb4wXBXGNLV9rDu8Zt7mVJd3S4jIDLZRsa5EzjJDsi7iEd9GoY fN5RcSy/4Ow+ZLl4x6GpmRkud1iftgpZXml5/9R9dKUv4fPUdt/1/abS/5zFDPtR+dix kd9n4dKZuU34W1ITEGBLMXZBiKgV5Ce9iGb2RDP3M4F9Izn1nN9LYGwutSyQP6mvQD2X r20w== 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=jzjhqKUQE+QT87VlGM7mrbkwUfIug49zvMwL3mtkgLI=; b=PTk0IhFxv+qa8SkrByIxmMqjXVpSnfpoJAl3HQ0oGxBxO+G/4qVFPwslUHhwIBAon9 h+XKY28blubhqtXzGi+KZ95VnMJFLlUvU0ATShgW99+9xkWgO1Y2C/WsDXvGpJB3zJ8S HKH78yaBgYsayJsgaHbtQrUv+6cq4sakyRMXa7k7mSHHezQcJhobmcI9/J+2Be9nIxxA KGYxC9qnalfqvwsWk+7xZG7TZDGg77Q/bFsJbPQ0gtcuDw6FSbabjdGSFe9WDqfokpTv 1Npyk2dEz0cp6DF/pmkQEuNJ5X6GO8tCDtyHDEnYLGMObUw5kUKap5CUyjOrQqLXCL1v IYdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nsgcCRD4; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si8116413pgp.429.2019.06.24.03.12.22; Mon, 24 Jun 2019 03:12:38 -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; dkim=pass header.i=@linaro.org header.s=google header.b=nsgcCRD4; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730153AbfFXKGk (ORCPT + 99 others); Mon, 24 Jun 2019 06:06:40 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:39152 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728873AbfFXKGd (ORCPT ); Mon, 24 Jun 2019 06:06:33 -0400 Received: by mail-io1-f65.google.com with SMTP id r185so740646iod.6 for ; Mon, 24 Jun 2019 03:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jzjhqKUQE+QT87VlGM7mrbkwUfIug49zvMwL3mtkgLI=; b=nsgcCRD4CD7gAOEhmxdS9KtrV1XDmK+5s3tRYAp4HsTfnT8B4aoKgDLyD6HpN5bSKn Emsl7eP2xijq0eANUtP0KvD/WoHMrGgOyW9IebxKrBzgTnq8rg7HWaY1HiETeI+wVCy3 G0x1q+sKHGvktCR3zFb/ltoxVGFvwJ8UiRlSdeXa1JY87nKd8jkdRUZsagcB8fNP2IsO 5Tzq0jCElctINZ9ixKqDwpWfKrUXZl1inBuoVPQObeQ9VIgGrIzSZj33cST1DvsZkQkt kWOD/4dgdYs0UhB5mDmCjKCO8oP7XkPLXtP2+kJoFvLZGT21/9PxD/UiuYBhnX8OFA3A Zwng== 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=jzjhqKUQE+QT87VlGM7mrbkwUfIug49zvMwL3mtkgLI=; b=Pec8mVQjPc/BimqPb0u+C2ebpep6vpy5F9QWDD7mqwJe8NjhWQ3e1KJWpxEmRfCsV5 SThRT8CFPd3u4pQx06LuNiz3nPJBWtgz96Hru9YO15NpoJH4DNb306ZV4lslJ35oD7qS rhTbasCHMm6qM7+RW/N0oXAXQ9qr7YWwaqdYe1ylVMu1r0fHR8JohbyJ0O39wxEswkvj JJNlcc8bvJLjoxvD1egOk8P9dh6VJfiNjE85xVVpQamwHLdP2sUoaZ74woZ7vN7CLKVX 4dpdpq08OuPlVsBRLK/vflqHkUM+oRxhZ4hrJayrlXFXxXnpxNkNrn49hGdKiFIILyID pWeg== X-Gm-Message-State: APjAAAX6BLkRFd8OR/oncajbdqQ56ty8XFudFRivxesiAZK9C3Q3X9YA Z2ne2y8HONn0kAa+PgM4pher/i35al/n6sQpyqlBAw== X-Received: by 2002:a02:6597:: with SMTP id u145mr28812545jab.26.1561370790929; Mon, 24 Jun 2019 03:06:30 -0700 (PDT) MIME-Version: 1.0 References: <20190620003244.261595-1-ndesaulniers@google.com> <20190620074640.GA27228@brain-police> <20190624095749.wasjfrgcda7ygdr5@willie-the-truck> In-Reply-To: <20190624095749.wasjfrgcda7ygdr5@willie-the-truck> From: Ard Biesheuvel Date: Mon, 24 Jun 2019 12:06:18 +0200 Message-ID: Subject: Re: [PATCH] arm64: defconfig: update and enable CONFIG_RANDOMIZE_BASE To: Will Deacon Cc: Nick Desaulniers , Kees Cook , Sami Tolvanen , Jeffrey Vander Stoep , Mark Rutland , Enric Balletbo i Serra , Arnd Bergmann , Maxime Ripard , Catalin Marinas , Will Deacon , Linux Kernel Mailing List , Bjorn Andersson , Dinh Nguyen , Mark Brown , Jagan Teki , Olof Johansson , Shawn Guo , linux-arm-kernel 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 Mon, 24 Jun 2019 at 11:57, Will Deacon wrote: > > Hi Nick, Kees, Ard, > > Thanks for the responses. > > On Fri, Jun 21, 2019 at 01:27:45PM -0700, Nick Desaulniers wrote: > > On Thu, Jun 20, 2019 at 1:17 AM Ard Biesheuvel > > wrote: > > > On Thu, 20 Jun 2019 at 09:47, Will Deacon wrote: > > > > On the flip side, I worry that it could make debugging more difficult, but I > > > > don't know whether that's a genuine concern or not. I'm assuming you've > > > > debugged your fair share of crashes from KASLR-enabled kernels; how bad is > > > > it? (I'm thinking of the case where somebody mails you part of a panic log > > > > and a .config). > > > > I don't recall specific cases where KASLR made debugging difficult. I > > went and spoke to our stability team that debugs crash reports from > > the field. My understanding is that we capture full ramdumps. They > > have a lot of custom tooling for debugging, but they did not recall > > ever having to disable KASLR to debug further. We've had KASLR > > enabled since I think the 2016 Pixel 1, so I assume their tooling > > accounts for the seed/offset. > > > > I think if a full ramdump of the kernel image is loaded into GDB with > > the matching kernel image it "just works" but could be mistaken. For > > external developers, "nokaslr" boot time param is pretty standard. > > > > > In fact, given how many Android phones are running this code: Nick, > > > can you check if there are any KASLR related kernel fixes that haven't > > > been upstreamed? > > > > I spoke with the android common kernel team that's trying to burn down > > their out of tree patches. I triple checked a doc they had where they > > had audited every last patch, looking for for KASLR and > > CONFIG_RANDOMIZE_BASE. I also triple checked our internal bug tracker > > for burning down the out of tree patches. Finally I'm scanning each > > branch of our android-common trees via `git log --all --grep > > `. I haven't found anything yet, and the > > team doesn't expect any out of tree patches related to that feature. > > Sorry for not responding sooner, but I'm still going through our 4.4, > > 4.9, 4.14, and 4.19 branches. > > Thanks for having a look. It could be that we've fixed the issue Catalin was > running into in the past -- he was going to see if the problem persists with > mainline, since it was frequent enough that it was causing us to ignore the > results from our testing infrastructure when RANDOMIZE_BASE=y. > I had no idea this was the case. I can look into it if we are still seeing failures. > > > So KASLR is known to be broken unless you enable KPTI as well, so that > > > is something we could take into account. I.e., mitigations that don't > > > reduce the attack surface at all are just pointless complexity, which > > > should obviously be avoided. > > > > (Note to Sami + Jeff if they had KPTI on their radar) > > I mean, we could have RANDOMIZE_BASE select UNMAP_KERNEL_AT_EL0 if you like? > The latter is already default y and hidden behind EXPERT. > IIRC, when KASLR is enabled (and we have a seed), we override the runtime decision to out out of KPTI, and so even uarchs that don't require the Meltdown mitigations it provides will still be using it. So I'd be fine with just adding a note to the UNMAP_KERNEL_AT_EL0 Kconfig help text that even non-affected uarchs have a use for it if KASLR is enabled, but given that it is already behind EXPERT, I don't think more hand holding is necessary. > > > Another thing to note is that the runtime cost of KASLR is ~zero, with > > > the exception of the module PLTs. However, the latter could do with > > > some additional coverage as well, so in summary, I think enabling this > > > is a good thing. Otherwise, we could disable full module randomization > > > so that the module PLT code doesn't get used in practice. > > > > > > Acked-by: Ard Biesheuvel > > > > Olof mentioned on IRC that I should resend without the other defconfig > > changes. Do others have thoughts on that? > > That's not a bad idea. If you do that, feel free to add my Ack to the one > adding RANDOMIZE_BASE=y: > > Acked-by: Will Deacon > > Will