Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1300165pxa; Sat, 15 Aug 2020 15:00:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRu6MhYpch1rXR9MTbv8qt5CCmkLO1MJlOirVMJRhLNzUYKbyhSsOQ5HA87K8O2+i2bjNk X-Received: by 2002:a17:906:7856:: with SMTP id p22mr8214229ejm.262.1597528806392; Sat, 15 Aug 2020 15:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597528806; cv=none; d=google.com; s=arc-20160816; b=HNrBcBOBLj/RJT4+kO7bAVvuf1xZXOTRVUNE6+yb3sudAeyckutXGQim3UtmEY+ONm fFVsxiMGw/Kz5E0Vs/QO96jkh2LVh3QCGyJfNAfMPPmR2kBJaa8wETHrSEf2Jh55d3Z7 6nr6Hb/vzBrVCOmDTa+dJKKUPfSHkGM2/Ec4yNZNfen2iL2DUY1fITMCdJmwCIKx4MwF f2HHqd+9bJ9yph0S88oV/fpRBAPdx4cu0zwPt+al7Kmu36TNoJmv+1n3icdyXLrz7syX I2W4ZA9eiNI46uS8YD8UXQXoMrfo1BvDjSBLA3fskDKj5qtbvqaF7+3n+TcUuNILwfo6 M1qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SYhsdz9Ikw/5Id67XdrFAG6RYY/GnifUtuavkK2F1mo=; b=SezptQg0/KkXhh+HKun8oGb1dZtZV+qTTzOnllgt9g6UsMnht56V/ef2swd5Iwrlrl EYjc+U4c+KbJAzoxgYbjRtWGrgrrfDKz7YpT4qyhtOsc6eNIMgMfx8D73TOmyPYxZlYT wg67OM4CAS7fSYGFSl920HZtyp9ACtWwf12UKytr7wYatWGA0G+AUrYJf4Ms30pGI9oo KPky4Pmk6nVa7ojY5lblG69D3s0WkxaIYH3q2nbeYILuLIN8KNmgsV7RbIfnawzYaYoo Mrr5tott+OFcu+CAO+EFZ8QG1UOpzOMEO01wB3dNgtdPPNYo6p6fc3G13n4Ql3G4XuL1 rSLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=GPHj7mF5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si7756620edy.290.2020.08.15.14.59.44; Sat, 15 Aug 2020 15:00:06 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=GPHj7mF5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729406AbgHOV4X (ORCPT + 99 others); Sat, 15 Aug 2020 17:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbgHOVwO (ORCPT ); Sat, 15 Aug 2020 17:52:14 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E65BC004597 for ; Sat, 15 Aug 2020 11:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SYhsdz9Ikw/5Id67XdrFAG6RYY/GnifUtuavkK2F1mo=; b=GPHj7mF5tQxFUHGIb+vUHBhFvb viu4v6hOIabQCCvC2ShC+wg5VDEpFLVz3pQ9emHprrtHALfAeBm8tyXyXzr+5ScH78gcFybPBuBFp 8JoyUaq4GaPGa9sNYZ/RdQWnBZZO5NgJVySKsAbK0v35o2Mt5iRFpJBOy6SDfSAL5zCQathZaYN45 aIKp7Fxx83adx921tPLvn93HeDfLHLek7YBiuGjhTMdquC435ptpkXDvrPlyaAXEnoK34Yk+ugwbX /++ZiDWW2wuYR6x4WAiq2ZCcu3A1BddzYWUKJhR6Kb9jmMzcxus+gohduHlSqtPrS6HYuabKex/Sf h/l9nB9w==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k71KR-00061N-Qf; Sat, 15 Aug 2020 18:54:55 +0000 Date: Sat, 15 Aug 2020 19:54:55 +0100 From: Matthew Wilcox To: Alexander Popov Cc: Kees Cook , Jann Horn , 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 , kasan-dev@googlegroups.com, linux-mm@kvack.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, notify@kernel.org Subject: Re: [PATCH RFC 1/2] mm: Extract SLAB_QUARANTINE from KASAN Message-ID: <20200815185455.GB17456@casper.infradead.org> References: <20200813151922.1093791-1-alex.popov@linux.com> <20200813151922.1093791-2-alex.popov@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200813151922.1093791-2-alex.popov@linux.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 13, 2020 at 06:19:21PM +0300, Alexander Popov wrote: > +config SLAB_QUARANTINE > + bool "Enable slab freelist quarantine" > + depends on !KASAN && (SLAB || SLUB) > + help > + Enable slab freelist quarantine to break heap spraying technique > + used for exploiting use-after-free vulnerabilities in the kernel > + code. If this feature is enabled, freed allocations are stored > + in the quarantine and can't be instantly reallocated and > + overwritten by the exploit performing heap spraying. > + This feature is a part of KASAN functionality. After this patch, it isn't part of KASAN any more ;-) The way this is written is a bit too low level. Let's write it in terms that people who don't know the guts of the slab allocator or security terminology can understand: Delay reuse of freed slab objects. This makes some security exploits harder to execute. It reduces performance slightly as objects will be cache cold by the time they are reallocated, and it costs a small amount of memory. (feel free to edit this) > +struct qlist_node { > + struct qlist_node *next; > +}; I appreciate this isn't new, but why do we have a new singly-linked-list abstraction being defined in this code?