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=-5.9 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 05BF9C433E0 for ; Tue, 19 Jan 2021 19:45:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 620112310B for ; Tue, 19 Jan 2021 19:45:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 620112310B 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 CF9F36B0006; Tue, 19 Jan 2021 14:45:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C83836B0007; Tue, 19 Jan 2021 14:45:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4BD26B0008; Tue, 19 Jan 2021 14:45:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 9987F6B0006 for ; Tue, 19 Jan 2021 14:45:53 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5DBB78249980 for ; Tue, 19 Jan 2021 19:45:53 +0000 (UTC) X-FDA: 77723554986.22.chain61_220438c27554 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 3866318038E67 for ; Tue, 19 Jan 2021 19:45:53 +0000 (UTC) X-HE-Tag: chain61_220438c27554 X-Filterd-Recvd-Size: 4615 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 19:45:52 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id md11so600483pjb.0 for ; Tue, 19 Jan 2021 11:45:52 -0800 (PST) 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=j1wetYO36UaWe02LKLO5JOOk43Nsnbf+M6tRDh80Z4o=; b=OUX5tjdXRfLznD8jIANBdiWUxte6jruaZKP8XaWopCFLIS+gZ/eFfduPojDdaqyM61 mKVv/HPl8C5ipjrgekEDwkMonO/KgKxtmfrej7YMS527qKEaKE591YkNitfYFrwFCP2W RGkDF26DwzK7GeUPJCMylj/jP5ZQS4P3LA1os= 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=j1wetYO36UaWe02LKLO5JOOk43Nsnbf+M6tRDh80Z4o=; b=CNSRiCo7+AAUvC+oBCo3dyoNFnkkJSyM1vBtSVihNK7OSgfqaxZwb42armTA2rF1m7 RVJVSidb9jv5vd0D+lnhIfNK8w1hV82CqVhduID6V2+0sWt8auZaWXkUTUpbZLN7FsST 9dD6LWsb6AqcjhyE1HhfT2R7X5IBEqUkiu92Pcy5yJ2t2NwqYd2YNZ8T9mnpQ5WNujN0 nFQUoGvluy+Y7V9SzuiFKRp1d+Vy6q2g58KureblKWsHC3Wt0hjvpF1ZisBYAM0Y/vMC W3RhgkEeDwkJdcirblEEZTrCh4/i/5X58MzXBdy+DE1lOhVLFqR/Kb9G0w9lzm6b0z7M or2g== X-Gm-Message-State: AOAM530H9mq2XTA2JfPZCCixskJfdKfSRoK2DgW7Ouwsg6Dxfncfd4TY 07hcNb9d/ODxSi2yu3FTHZ9uWw== X-Google-Smtp-Source: ABdhPJzNu0666uPUGZSh8cSOuQ0fGaNEAz/2rp0GooPV2Bekf0Z56+42DAxbMqo8Jmmnj/KXmtKY6Q== X-Received: by 2002:a17:90b:4c85:: with SMTP id my5mr1372206pjb.225.1611085551698; Tue, 19 Jan 2021 11:45:51 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id kr9sm4210380pjb.0.2021.01.19.11.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 11:45:50 -0800 (PST) Date: Tue, 19 Jan 2021 11:45:49 -0800 From: Kees Cook To: Sergey Senozhatsky Cc: Matthew Wilcox , Timur Tabi , Andrew Morton , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, Petr Mladek , roman.fietze@magna.com, Steven Rostedt , John Ogness , linux-mm@kvack.org, Akinobu Mita Subject: Re: [PATCH 0/2] introduce DUMP_PREFIX_UNHASHED for hex dumps Message-ID: <202101191145.FE17081@keescook> References: <20210116220950.47078-1-timur@kernel.org> <20210118182635.GD2260413@casper.infradead.org> <20210119014725.GH2260413@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Jan 19, 2021 at 07:38:24PM +0900, Sergey Senozhatsky wrote: > On (21/01/19 01:47), Matthew Wilcox wrote: > [..] > > > > > So maybe DUMP_PREFIX_UNHASHED can do the unhashed dump only when > > > CONFIG_DEBUG_KERNEL=y and fallback to DUMP_PREFIX_ADDRESS otherwise? > > > > Distros enable CONFIG_DEBUG_KERNEL. > > Oh, I see. > > > If you want to add CONFIG_DEBUG_LEAK_ADDRESSES, then that's great, > > and you won't even have to change users, you can just change how %p > > behaves. > > I like the name. config dependent behaviour of %p wouldn't be new, > well, to some extent, e.g. XFS does something similar (see below). > I don't think Linus will be sold on this, however. > > > fs/xfs/xfs_linux.h: > > /* > * Starting in Linux 4.15, the %p (raw pointer value) printk modifier > * prints a hashed version of the pointer to avoid leaking kernel > * pointers into dmesg. If we're trying to debug the kernel we want the > * raw values, so override this behavior as best we can. > */ > #ifdef DEBUG > # define PTR_FMT "%px" > #else > # define PTR_FMT "%p" > #endif > > And then they just use it as > > xfs_alert(mp, "%s: bad inode magic number, dip = "ptr_fmt", > dino bp = "ptr_fmt", ino = %ld", > __func__, dip, bp, in_f->ilf_ino); > > -ss Please no, this is effectively a toggle. -- Kees Cook