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=-7.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 545E1C433EF for ; Mon, 20 Sep 2021 18:28:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E808460F23 for ; Mon, 20 Sep 2021 18:28:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E808460F23 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7CDF0900002; Mon, 20 Sep 2021 14:28:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77D966B0072; Mon, 20 Sep 2021 14:28:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 644CA900002; Mon, 20 Sep 2021 14:28:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 5275E6B0071 for ; Mon, 20 Sep 2021 14:28:54 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0ABD8180ACF16 for ; Mon, 20 Sep 2021 18:28:54 +0000 (UTC) X-FDA: 78608788188.28.6B0C132 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf05.hostedemail.com (Postfix) with ESMTP id C727951ECFDE for ; Mon, 20 Sep 2021 18:28:53 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id e16so17083687pfc.6 for ; Mon, 20 Sep 2021 11:28:53 -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=thLxpg55L9L13LgTK3I+f/Vrx/go018u31qP2p6Akx0=; b=WHXDWtWcwFGk7LtXnSZ+PjQsT2VIAEZhKXrYUYCUqx275UrjId3tNEFrVrFval+6VY ASne1xFDtcgrVAHM0ho6Jz0an8+X7rpaMwNgpvvoptvSiH7Nh4vjF4vM8+OwOEh54BVO he7wqilNLX8KmGWIidRONIwihDDVpXGrUbUOc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=thLxpg55L9L13LgTK3I+f/Vrx/go018u31qP2p6Akx0=; b=strgoEsNJE3q+wBe/pd9Olx4JAUd494uxnuf68870mSKFqx8hXJKI3HgAhPkAdy8Ht VrWqcrWZ0s/ZfujOsFZv4kVpN5+AOGdUauUAHFh2iHwrYmawLNRPAhw5KPWJu1V4egiL lRWzhqsnziGtOr1ET/bc/VUK8B6iLLb5UJC70A2fa5hAUcDe/rJsiHTWYcZfPWB9Qm5d J3wy0GAXJ+J6WVrVAO/M15d4nZWCe/udUBwAd1NIM4R8Y42Xd0wghB+A3fpNhAFzphIo UJRg1fbN+TF18K1dj18GZRnRWwwhQS3bxNkw/HOt34VnPhObSdN2/eJzKyjKfYLlB7bU qnyg== X-Gm-Message-State: AOAM5316mUi+FRTa+irU7xgrBrhP2q7TazAsbhRgpbwlb4gXkXWhe5JD pC7ecjrTSOIcgz4YzvgJpm/RaQ== X-Google-Smtp-Source: ABdhPJwhFVKdYlCToObhylE8KnrZUUrTqmif27AzPVOfkfhLdgmla4KXX1yzLyQmcd3Kf9O4pHq1Dg== X-Received: by 2002:a62:7c01:0:b0:447:cd36:c9a7 with SMTP id x1-20020a627c01000000b00447cd36c9a7mr3827780pfc.2.1632162532349; Mon, 20 Sep 2021 11:28:52 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u6sm1965997pgc.68.2021.09.20.11.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 11:28:51 -0700 (PDT) Date: Mon, 20 Sep 2021 11:28:50 -0700 From: Kees Cook To: Stephen Boyd Cc: Andrew Morton , linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , linux-mm@kvack.org, Petr Mladek , Joe Perches Subject: Re: [PATCH v3 4/4] slub: Force on no_hash_pointers when slub_debug is enabled Message-ID: <202109201126.E9902480D9@keescook> References: <20210601182202.3011020-1-swboyd@chromium.org> <20210601182202.3011020-5-swboyd@chromium.org> <202109200726.2EFEDC5@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=WHXDWtWc; spf=pass (imf05.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.170 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C727951ECFDE X-Stat-Signature: 1k5gqe37caztd8udwfdgh6nbiphkn1m7 X-HE-Tag: 1632162533-443945 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 Mon, Sep 20, 2021 at 11:23:01AM -0700, Stephen Boyd wrote: > Quoting Kees Cook (2021-09-20 07:29:54) > > On Tue, Jun 01, 2021 at 11:22:02AM -0700, Stephen Boyd wrote: > > > Obscuring the pointers that slub shows when debugging makes for some > > > confusing slub debug messages: > > > > > > Padding overwritten. 0x0000000079f0674a-0x000000000d4dce17 > > > > > > Those addresses are hashed for kernel security reasons. If we're trying > > > to be secure with slub_debug on the commandline we have some big > > > problems given that we dump whole chunks of kernel memory to the kernel > > > logs. Let's force on the no_hash_pointers commandline flag when > > > slub_debug is on the commandline. This makes slub debug messages more > > > meaningful and if by chance a kernel address is in some slub debug > > > object dump we will have a better chance of figuring out what went > > > wrong. > > > > > > Note that we don't use %px in the slub code because we want to reduce > > > the number of places that %px is used in the kernel. This also nicely > > > prints a big fat warning at kernel boot if slub_debug is on the > > > commandline so that we know that this kernel shouldn't be used on > > > production systems. > > > > Eeeek. I missed this patch. NAK NAK. People use slub_debug for > > production systems to gain redzoning, etc, as a layer of defense, and > > they absolutely do not want %p-hashing disabled. %p hashing is > > controlled by the no_hash_pointers boot param (since v5.12), and needs to stay > > separate from slub_debug. > > > > Can we please revert this in Linus's tree and in v5.14? > > > > This is fine with me as long as debugging with slub_debug on the > commandline is possible. Would you prefer v1 of this patch series[1] > that uses the printk format to print unhashed pointers in slub debugging > messages? > > [1] https://lore.kernel.org/r/20210520013539.3733631-1-swboyd@chromium.org I'd like to keep %px use in the kernel minimized. Seeing full pointers (%p hashing disabled) can be done with the no_hash_pointers boot param, and that's used in other debug cases as well. I'd rather keep it a global knob. Thanks! -Kees -- Kees Cook