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.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,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 EECCAC433E0 for ; Wed, 27 Jan 2021 00:20:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0A3B20691 for ; Wed, 27 Jan 2021 00:20:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390123AbhA0AP0 (ORCPT ); Tue, 26 Jan 2021 19:15:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:32984 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730107AbhAZRFN (ORCPT ); Tue, 26 Jan 2021 12:05:13 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A7A4DAC97; Tue, 26 Jan 2021 16:47:33 +0000 (UTC) To: Sergey Senozhatsky , Matthew Wilcox Cc: Timur Tabi , Andrew Morton , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, Petr Mladek , roman.fietze@magna.com, keescook@chromium.org, Steven Rostedt , John Ogness , linux-mm@kvack.org, Akinobu Mita References: <20210116220950.47078-1-timur@kernel.org> <20210118182635.GD2260413@casper.infradead.org> <20210119014725.GH2260413@casper.infradead.org> From: Vlastimil Babka Subject: Re: [PATCH 0/2] introduce DUMP_PREFIX_UNHASHED for hex dumps Message-ID: <09c70d6b-c989-ca23-7ee8-b404bb0490f0@suse.cz> Date: Tue, 26 Jan 2021 17:47:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/19/21 11:38 AM, 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. Given Linus' current stance later in this thread, could we revive the idea of a boot time option, or at least a CONFIG (I assume a runtime toggle would be too much, even if limited to !kernel_lockdown :) , that would disable all hashing? It would be really useful for a development/active debugging, as evidenced below. Thanks. > 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 >