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=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 22B3CC433DF for ; Fri, 5 Jun 2020 21:07:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CCFB72074B for ; Fri, 5 Jun 2020 21:07:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mXXZdi6v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCFB72074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 76337280003; Fri, 5 Jun 2020 17:07:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7132D8E0006; Fri, 5 Jun 2020 17:07:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60236280003; Fri, 5 Jun 2020 17:07:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 465B48E0006 for ; Fri, 5 Jun 2020 17:07:14 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 00CA7250C4 for ; Fri, 5 Jun 2020 21:07:13 +0000 (UTC) X-FDA: 76896393588.19.waves50_3c0d8aa26da3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id B1D5F1AD1B2 for ; Fri, 5 Jun 2020 21:07:13 +0000 (UTC) X-HE-Tag: waves50_3c0d8aa26da3 X-Filterd-Recvd-Size: 4035 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Jun 2020 21:07:13 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id n23so5715987pgb.12 for ; Fri, 05 Jun 2020 14:07:13 -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=DIl1c/a1tJwzu9tj9OScxdWzLfr1jbFnh4gamMfxa4U=; b=mXXZdi6vgof7yFFLz8NliqYNwbHFEsnjcD1553WxFYKTO+lNtkWjleP7CfaBTgtaLT kIUVtn5rZ05qv7bMbRv7xg4VnziO3GIAvq3eObq5WOeJTUYqEK90uH8n4lq86F/4xRkd o67qykTVOGIsy++F8bU8ZV7fdZi5diKQuY3rI= 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=DIl1c/a1tJwzu9tj9OScxdWzLfr1jbFnh4gamMfxa4U=; b=pUNLbbVtWxWaHrfA4cyzeB0+lINuxHts91lXIHTk/gPj2GbrPRZt4bWaDQFbYds+tj qwFyqwBd+GvKHiHVDhqzvrX8ueUgzHCSBA0JUmOUOwlfgtcA6DECk6i88kuzT3GQXbFb gyugQoPypzFMlBGetx+pFcOfpj3R85tRlpI2v3PBSX12vvQ7eYrAfD4lVR2ilOFMZFa3 d4eHzaCEEcTH4T7ic7yH3+VTShLT2PQ4HOE/n0nT38h8QxtgGweSG2bBwcueW1LZdD0y PG/mO4rVAFBFEA7qKRkXeKGnjyGyntImuYEHJkwTxn0MY45q4f5bxRewUN5tOZBGWLRn 801Q== X-Gm-Message-State: AOAM533lB6XXsQE1Q2nRaWXM+CMgav/shmdElVNgXYJjAa1/9MoSZbrF 8EQ8Q+9u38FtBjtvSy2n62JCXg== X-Google-Smtp-Source: ABdhPJw3UK7yUcQVNPpsOFwlgYtR9GiEv04lfxyiuj3QJg6BkE/hP4K05bbCQ0Ja4mdmIJqn069GoA== X-Received: by 2002:a65:6801:: with SMTP id l1mr11113171pgt.73.1591391232412; Fri, 05 Jun 2020 14:07:12 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id ca6sm8589394pjb.46.2020.06.05.14.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 14:07:11 -0700 (PDT) Date: Fri, 5 Jun 2020 14:07:10 -0700 From: Kees Cook To: Vlastimil Babka Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com, vinmenon@codeaurora.org, Matthew Garrett , Jann Horn , Vijayanand Jitta Subject: Re: [RFC PATCH 4/5] mm, slub: make remaining slub_debug related attributes read-only Message-ID: <202006051407.F7E66272DA@keescook> References: <20200602141519.7099-1-vbabka@suse.cz> <20200602141519.7099-5-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200602141519.7099-5-vbabka@suse.cz> X-Rspamd-Queue-Id: B1D5F1AD1B2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 Tue, Jun 02, 2020 at 04:15:18PM +0200, Vlastimil Babka wrote: > SLUB_DEBUG creates several files under /sys/kernel/slab// that can be > read to check if the respective debugging options are enabled for given cache. > Some options, namely sanity_checks, trace, and failslab can be also enabled and > disabled at runtime by writing into the files. > > The runtime toggling is racy. Some options disable __CMPXCHG_DOUBLE when > enabled, which means that in case of concurrent allocations, some can still use > __CMPXCHG_DOUBLE and some not, leading to potential corruption. The s->flags > field is also not updated or checked atomically. The simplest solution is to > remove the runtime toggling. The extended slub_debug boot parameter syntax > introduced by earlier patch should allow to fine-tune the debugging > configuration during boot with same granularity. > > Signed-off-by: Vlastimil Babka Reviewed-by: Kees Cook -- Kees Cook