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 C5677C432C3 for ; Wed, 27 Jan 2021 00:35:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 969EA20679 for ; Wed, 27 Jan 2021 00:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390736AbhA0A3X (ORCPT ); Tue, 26 Jan 2021 19:29:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:40312 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389583AbhAZRPf (ORCPT ); Tue, 26 Jan 2021 12:15:35 -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 64A15B913; Tue, 26 Jan 2021 17:14:52 +0000 (UTC) To: Timur Tabi , Sergey Senozhatsky , Matthew Wilcox Cc: 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> <09c70d6b-c989-ca23-7ee8-b404bb0490f0@suse.cz> From: Vlastimil Babka Subject: Re: [PATCH 0/2] introduce DUMP_PREFIX_UNHASHED for hex dumps Message-ID: <083dd940-60c1-4cc8-fc89-8815b253d5c5@suse.cz> Date: Tue, 26 Jan 2021 18:14:51 +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/26/21 5:59 PM, Timur Tabi wrote: > On 1/26/21 10:47 AM, Vlastimil Babka wrote: >> 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. > > So you're saying: > > if CONFIG_PRINTK_NEVER_HASH is disabled, then %p prints hashed addresses and %px > prints unhashed. > > If CONFIG_PRINTK_NEVER_HASH is enabled, then %p and %px both print unhashed > addresses. Minimally, yes. KASLR is configurable like this, so why not printing of kernel pointers? > I like this idea, and I would accept it as a solution if I had to, but I still > would also like for an option for print_hex_dump() to print unhashed addresses > even when CONFIG_PRINTK_NEVER_HASH is disabled.  I can't always recompile the > entire kernel for my testing purposes. Yeah, obviously a boot option would be nicer. The discussion Kees pointed to [1] seemed to be about papering over problems with entropy? Not about making development/debugging easier. But I understand it was not the first time and I didn't check the older ones. > The only drawback to this idea is: what happens if distros start enabling > CONFIG_PRINTK_NEVER_HASH by default, just because it makes debugging easier? There's tons of other options already where the choice is between security and performance, and distros make their choice (including, again, KASLR itself). Pointer hashing would be just another one. If it was a boot option, I would personally be for leaving hashing enabled by default, with opt-in boot option to disable it. Then if I'm instructing a user to boot the distro kernel (without recompile) with e.g. slub_debug or debug_pagealloc or page_owner in order to debug some issue, I would additionally instruct them to add the 'no_pointer_hashing' parameter. [1] https://lore.kernel.org/lkml/CA+55aFwieC1-nAs+NFq9RTwaR8ef9hWa4MjNBWL41F-8wM49eA@mail.gmail.com/