Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5286971ybb; Tue, 24 Mar 2020 14:31:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv6S0IU0v7cm9S2SvfLo5Nr3l0TmCKrYUrj2pR9Ge1qBww9PgxXdCjndMPwnR3HkAwIAn+Y X-Received: by 2002:a9d:2215:: with SMTP id o21mr89988ota.113.1585085459864; Tue, 24 Mar 2020 14:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585085459; cv=none; d=google.com; s=arc-20160816; b=Lpzd4F1+vZ36ivolHrojPK49dZYHbPS0YSMwjISqVG5KflqdgMjMmCMNBP4sq5p7V5 f1gs/jZKxpdBRMiwIqQt57q6/TiBvhzrJiDk2VpkkTgwgUH4ekOp0+UUkmoweQba7kan JZ8dLuDQUwgQYtg9ZOcCzAYYAAMVGc8hZKp9wAHJrP4XXvMPvNNw39yuRwWwr9MJ36sR rvhnLJceJzD1dxWAUHKesSZcHU8VYhO7zgw93U7F0rr6fxvQv325VMDOuzlKhPRLQzH9 vwajnLo+eyXpFliUuedfOKbnpEJ4DyKg8QU9mDk4zDVWypv07W+1wcUIdxQT0rPkrMjg Gjqw== 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=mt9R6MAwAgMsRiTLzlySm2VmV71YyEXXijbHmE8WTzk=; b=Ga3GU0GSiiWULrmWvfNsF1irqLlyogP49WylvtBjViNwEET5qu3oAMaPkZBh6P1Upj 8j5X5CPWE0FdhqZPxcq4cFgaWEVatiFfbLUxuhsdDCayZB9CHyZn6BTBNm+Z9Y3RWeC8 +sGlhdNljRBglC759YdUgHGl5M9fGeMcL56/44szAte+9dtKb25/SRRIC/E1+xhfMfa7 BQ8wcNzjnmuxT3M9TH14mLgIKPBca0jjKUz5VqOOgMHcOHuPoTm1+uwOSbYkzBrzlKvC 96GCiZGjAANBfMZLMlK1xL7fhD2TF6YHCwrUqVwlMAxJJjHDGZD2f2OLQei5jovz1pAk I0zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YSCmWxRY; 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 n125si3020470oib.97.2020.03.24.14.30.47; Tue, 24 Mar 2020 14:30:59 -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=@google.com header.s=20161025 header.b=YSCmWxRY; 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 S1728212AbgCXV3F (ORCPT + 99 others); Tue, 24 Mar 2020 17:29:05 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44042 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727270AbgCXV3F (ORCPT ); Tue, 24 Mar 2020 17:29:05 -0400 Received: by mail-lj1-f196.google.com with SMTP id p14so245324lji.11 for ; Tue, 24 Mar 2020 14:29:03 -0700 (PDT) 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=mt9R6MAwAgMsRiTLzlySm2VmV71YyEXXijbHmE8WTzk=; b=YSCmWxRY40BGiMze1Yvin1YLkJXXl+PFUME/YQdtuWumwzPRmAdvKghADmWKlRrN0K f9xnko63sgT0KH37iYw/9/MXZe1oLeb2jpfOZFVn6TSxlkYn1LgOxa54s9Ewh6bUAMOy BTu90myx9FunEp53IT4emC25nbXXzPJhnl84W6vhgEIa5wtgGP30cMvv/5ZskWvr8+4O Nr3uuT2MSmd1BDUPB1tsmSRiIQExkkO/w1eNM2f0qE61UeZwTTOh9IfxQOOmNTpezIgO mLkwFd5DYS6Gf4stv1h7MySVYHXya5QyIbq/2+4YJQUlIUc7dad9mqPuRzul6/Z7nzr+ FAAw== 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=mt9R6MAwAgMsRiTLzlySm2VmV71YyEXXijbHmE8WTzk=; b=JSD2COL/yUZny+wx8FbZCxoW0CrUxxZsDzfvOuWfKu+r7TUVMBe8lr5yaqyzzD9sLi aUy0ykQ6WHkMmDgIWUiV0ghUVnrud02hkZN44Vo17XPbwUfM/1YKWRuq7YUvDdV0t7e9 DcHguRTExABoa9inG0oIb9Q6I2YnJjwlGl7GYaGAay4AW8xC43XUUsAqf3wp5YpBcRpx Q07wFw+pG57rWj4nKntr0Z/P7UbLtpxLkLW8iNV6HuiWp3wxwWPIS2t2ofNVoqc06B9p +c3oglHyoqXsK1cE/m5/wvdWlb+kNbo6oYG+AybDistSL8557wq7Zqio3pEN2vr34CEZ wNZA== X-Gm-Message-State: ANhLgQ0bd9P/JjRKRrXd9QIy+dYa6KEG4+/Ds79CTHVsEMwLx+Y1WEVo GpoDng5piN1GHPSym0G/8acTuly4bOWmsPSQ0uoCag== X-Received: by 2002:a2e:89c1:: with SMTP id c1mr17348550ljk.215.1585085342690; Tue, 24 Mar 2020 14:29:02 -0700 (PDT) MIME-Version: 1.0 References: <20200324203231.64324-1-keescook@chromium.org> In-Reply-To: <20200324203231.64324-1-keescook@chromium.org> From: Jann Horn Date: Tue, 24 Mar 2020 22:28:35 +0100 Message-ID: Subject: Re: [PATCH v2 0/5] Optionally randomize kernel stack offset each syscall To: Kees Cook Cc: Thomas Gleixner , Elena Reshetova , "the arch/x86 maintainers" , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon , Mark Rutland , Alexander Potapenko , Ard Biesheuvel , "Perla, Enrico" , Kernel Hardening , linux-arm-kernel@lists.infradead.org, Linux-MM , kernel list 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 Tue, Mar 24, 2020 at 9:32 PM Kees Cook wrote: > This is a continuation and refactoring of Elena's earlier effort to add > kernel stack base offset randomization. In the time since the previous > discussions, two attacks[1][2] were made public that depended on stack > determinism, so we're no longer in the position of "this is a good idea > but we have no examples of attacks". :) [...] > [1] https://a13xp0p0v.github.io/2020/02/15/CVE-2019-18683.html This one only starts using the stack's location after having parsed it out of dmesg (which in any environment that wants to provide a reasonable level of security really ought to be restricted to root), right? If you give people read access to dmesg, they can leak all sorts of pointers; not just the stack pointer, but also whatever else happens to be in the registers at that point - which is likely to give the attacker more ways to place controlled data at a known location. See e.g. , which leaks the pointer to a BPF map out of dmesg. Also, are you sure that it isn't possible to make the syscall that leaked its stack pointer never return to userspace (via ptrace or SIGSTOP or something like that), and therefore never realign its stack, while keeping some controlled data present on the syscall's stack? > [2] https://repositorio-aberto.up.pt/bitstream/10216/125357/2/374717.pdf That's a moderately large document; which specific part are you referencing?