Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp96407pxk; Mon, 5 Oct 2020 19:12:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtZmCSoIhBBNWNHWwxQrakhVmjrfpt5pNvmM+xMSUmWsYPazFr41aeh1vzNyk4Rw78dem8 X-Received: by 2002:a50:ff10:: with SMTP id a16mr2896565edu.83.1601950323026; Mon, 05 Oct 2020 19:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601950323; cv=none; d=google.com; s=arc-20160816; b=MRr+tANmjv2+7Xm8Z67tGNEWlYV3MtLrhkrnbcm7E6x+a2laqAn/6H9NaIX3t5CmI7 WHDltfitmHxJbnCgw+pOd3DFdq3AW4fGi1g9eFaGNU/UG9n6cagT3XDy+5kE87o4DZ3r WCfI3UOkn2UrLXg+ud8zlBNUP5sAe8p0x2RkjverX1wNAIKhk5ZsxXct+BVcRqtVz5qU xX2pDNQselc+MOpSR3Nb1pe5k1TJ9UcUFB2Ar/9lYEQJ7EPRzv/Mn53i3fyLb+LjrVWg 6ALbdVSCX+eRj3a/AY1TZs/++/sl+rLlnEN/aPrkfGoDRfv0qFSo9B6e3u/YW0LZHKra iH4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5uyUjU81WTaoePaJ6pjDUCkELEhzyE83H9lRZhP1V5g=; b=KUYsgVGQR9xQFQgPfSFeSQeUK4LENcuI6UYYeMZv9+U10vzq4Rb8o2RZoiRU9lfBB2 WjD3Q+zC/8cbO7ILK34Wg2w6SodzY/BmVPWYjMrHI79WxBfcgvr5LkrbyDxnbfAPfWX4 vxKNWDggiVOj9Y39bVN0vsppac+gSFTqAxHKCoeMN2ITrpRXhlm8w+/KA5f5Rd+i9JUq q11fmQLhUAO36FnxYswpt8TPsPJXiD7QOAR4rPBxpOlJYV2kPiS5BMOsJIrs4t8fpjIZ RHUe1tyYTwsDriEiT1koKAV7JJsFq1H6P+nVsJ0w3M/L2XUsr6Uz9ECe0dLxxPAsREDB MQCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jDfIYFTb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si1042818ejl.239.2020.10.05.19.11.24; Mon, 05 Oct 2020 19:12:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jDfIYFTb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbgJFCJ1 (ORCPT + 99 others); Mon, 5 Oct 2020 22:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbgJFCJ1 (ORCPT ); Mon, 5 Oct 2020 22:09:27 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BE62C0613CE for ; Mon, 5 Oct 2020 19:09:27 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id y14so7103045pgf.12 for ; Mon, 05 Oct 2020 19:09:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5uyUjU81WTaoePaJ6pjDUCkELEhzyE83H9lRZhP1V5g=; b=jDfIYFTbm5fkMc29R8o9ZHzX7Pte5RCT8w+9F5TNDpMHIl3zGQzp4q/T71oiQgb/Si k1O/y8IqkbJWAFT7y97YeQ6EIsYzITVWj2oBZvzYlLyMjwb8Wu46wKdTHdqb5EdpdpIe 2MJyTF338pNoHuKyl4uFjC7Li4Vt/hvBkHZ6Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5uyUjU81WTaoePaJ6pjDUCkELEhzyE83H9lRZhP1V5g=; b=eD2pJH9ApWx5hyE5Sf53+tDqOxCCl1Pfx/hRYf++DiKI8L+WW7gHWuH3PLsO6StXv5 7CRC61Z/njs+A1kVuqjntQoxrRZsK1CFtKbYQ6ltzEaWhG7ZzCjcz6Pk3yDNNCTUpxaL X4CHTwt2KXJx6rr6tDITDYT/BG/bt+oKIDFpeJQyQXv0JdGj1JmJa3dQOlIQpogWU04q aYbiJfl3bTkMH/JDVG8/S5OaKKB4vz4T4o7CY7wkQBv/fRysP/lrTWD/MZdr8MyBUwi+ 3k4v9eTJzuX+UDt0nkSbxWmJToyGmzLipFDVxikgedGyGt2EQPszLQn8ce+7PGpcvtgT 3unw== X-Gm-Message-State: AOAM532sDyZliOv1P2YTEKdVz2XXdjBKQXTtvzJEv3k8fgg0EG3A9FCZ sNCIxr5otdseTKDojtHgizlx4g== X-Received: by 2002:aa7:8249:0:b029:142:2501:3964 with SMTP id e9-20020aa782490000b029014225013964mr2373840pfn.41.1601950167029; Mon, 05 Oct 2020 19:09:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id c9sm941792pgl.92.2020.10.05.19.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 19:09:25 -0700 (PDT) Date: Mon, 5 Oct 2020 19:09:24 -0700 From: Kees Cook To: Matthew Wilcox Cc: Jann Horn , Alexander Popov , Will Deacon , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Masahiro Yamada , Masami Hiramatsu , Steven Rostedt , Peter Zijlstra , Krzysztof Kozlowski , Patrick Bellasi , David Howells , Eric Biederman , Johannes Weiner , Laura Abbott , Arnd Bergmann , Greg Kroah-Hartman , Daniel Micay , Andrey Konovalov , Pavel Machek , Valentin Schneider , kasan-dev , Linux-MM , Kernel Hardening , kernel list , notify@kernel.org Subject: Re: [PATCH RFC v2 0/6] Break heap spraying needed for exploiting use-after-free Message-ID: <202010051905.62D79560@keescook> References: <20200929183513.380760-1-alex.popov@linux.com> <91d564a6-9000-b4c5-15fd-8774b06f5ab0@linux.com> <20201006004414.GP20115@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201006004414.GP20115@casper.infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 06, 2020 at 01:44:14AM +0100, Matthew Wilcox wrote: > On Tue, Oct 06, 2020 at 12:56:33AM +0200, Jann Horn wrote: > > It seems to me like, if you want to make UAF exploitation harder at > > the heap allocator layer, you could do somewhat more effective things > > with a probably much smaller performance budget. Things like > > preventing the reallocation of virtual kernel addresses with different > > types, such that an attacker can only replace a UAF object with > > another object of the same type. (That is not an idea I like very much > > either, but I would like it more than this proposal.) (E.g. some > > browsers implement things along those lines, I believe.) > > The slab allocator already has that functionality. We call it > TYPESAFE_BY_RCU, but if forcing that on by default would enhance security > by a measurable amount, it wouldn't be a terribly hard sell ... Isn't the "easy" version of this already controlled by slab_merge? (i.e. do not share same-sized/flagged kmem_caches between different caches) The large trouble are the kmalloc caches, which don't have types associated with them. Having implicit kmem caches based on the type being allocated there would need some pretty extensive plumbing, I think? -- Kees Cook