From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F661C10DCE for ; Sun, 8 Mar 2020 19:34:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F13A2067C for ; Sun, 8 Mar 2020 19:34:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F13A2067C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DECEC6B0003; Sun, 8 Mar 2020 15:34:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9DF26B0006; Sun, 8 Mar 2020 15:34:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8C176B0007; Sun, 8 Mar 2020 15:34:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B1C586B0003 for ; Sun, 8 Mar 2020 15:34:25 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 741D6181AC9BF for ; Sun, 8 Mar 2020 19:34:25 +0000 (UTC) X-FDA: 76573196490.26.bath16_97cd90792807 X-HE-Tag: bath16_97cd90792807 X-Filterd-Recvd-Size: 2836 Received: from gentwo.org (gentwo.org [3.19.106.255]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Sun, 8 Mar 2020 19:34:25 +0000 (UTC) Received: by gentwo.org (Postfix, from userid 1002) id 8A8C03F1C0; Sun, 8 Mar 2020 19:34:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 8845B3E998; Sun, 8 Mar 2020 19:34:24 +0000 (UTC) Date: Sun, 8 Mar 2020 19:34:24 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: David Rientjes cc: Vlastimil Babka , Kees Cook , Jann Horn , Pekka Enberg , Joonsoo Kim , Andrew Morton , Linux-MM , kernel list , Matthew Garrett , Vijayanand Jitta Subject: Re: SLUB: sysfs lets root force slab order below required minimum, causing memory corruption In-Reply-To: Message-ID: References: <202003031820.7A0C4FF302@keescook> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 4 Mar 2020, David Rientjes wrote: > I'm not sure how dependent the CONFIG_SLUB_DEBUG users are on being able > to modify these are runtime (they've been around for 12+ years) but I > agree that it seems particularly dangerous. The order of each individual slab page is stored in struct page. That is why every slub slab page can have a different order. This enabled fallback to order 0 allocations and also allows a dynamic configuration of the order at runtime. > The slub_debug kernel command line options are already pretty > comprehensive as described by Documentation/vm/slub.rst. I *think* these > tunables were primarily introduced for kernel debugging and not general > purpose, perhaps with the exception of "order". What do you mean by "general purpose? Certainly the allocator should not blow up when forcing zero order allocations. > So I think we may be able to fix "order" with a combination of my patch as > well as a fix to the freelist randomization and that the others should > likely be made read only. Hmmm. races increases as more metadata is added that is depending on the size of the slab page and the number of objects in it.