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.8 required=3.0 tests=BAYES_00,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 7E1F8C433DB for ; Fri, 12 Feb 2021 11:52:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0925564E30 for ; Fri, 12 Feb 2021 11:52:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0925564E30 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 786E18D004C; Fri, 12 Feb 2021 06:52:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 737578D0015; Fri, 12 Feb 2021 06:52:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FDEE8D004C; Fri, 12 Feb 2021 06:52:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 4C5018D0015 for ; Fri, 12 Feb 2021 06:52:04 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 169325DD6 for ; Fri, 12 Feb 2021 11:52:04 +0000 (UTC) X-FDA: 77809452168.19.A34CCB3 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP id 6D955E0001AF for ; Fri, 12 Feb 2021 11:52:01 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613130722; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y/PuJ4QsOK7MgaeHvEagRzBSM3sKp/kTBUCgRC9w1bg=; b=gF0pnQ+comDa2B0B2jDLYmlq32hIiXju0e3yoB4Xrf+cq0UrgAqe0kaLTRl5rvDfTm9t+o EoSjDH15+fGRm/gUtp8x9USIwMLaWicR5nEJ9G8Ka+/zl7AxSH7AJ3HwRLrOUDmfjQVPlg UlcdCO4eU4kTaGAQiKhEZrSM27Dfz+Y= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 37EC8B814; Fri, 12 Feb 2021 11:52:02 +0000 (UTC) Date: Fri, 12 Feb 2021 12:52:01 +0100 From: Petr Mladek To: Timur Tabi Cc: Steven Rostedt , Sergey Senozhatsky , Vlastimil Babka , Andy Shevchenko , Matthew Wilcox , akpm@linux-foundation.org, Linus Torvalds , roman.fietze@magna.com, Kees Cook , John Ogness , akinobu.mita@gmail.com, glider@google.com, Andrey Konovalov , Marco Elver , Rasmus Villemoes , Pavel Machek , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/3] lib/vsprintf: make-printk-non-secret printks all addresses as unhashed Message-ID: References: <20210210051814.845713-1-timur@kernel.org> <20210210051814.845713-4-timur@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: ujbpfo9ce99a85at9gsthqq3moc76ib3 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6D955E0001AF Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1613130721-23953 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: Hi, I have realized that I did not comment the two ideas. On Wed 2021-02-10 11:27:45, Timur Tabi wrote: > > > On 2/10/21 7:41 AM, Petr Mladek wrote: > > > > The option causes that vsprintf() will not hash pointers. Yes, it is > > primary used by printk(). But it is used also in some other > > interfaces, especially trace_printk(), seq_buf() API. The naked > > pointers might appear more or less anywhere, including procfs, > > sysfs, debugfs. > > Fair point. Shouldn't calls to seq_buf_printf() (and any printk usage that > always exists in the context of a user-space process) use %pK anyway? seq_buf is a handy API that might be used for different purpose. For example, it seems to be used ftrace where people might want to see real pointers when debugging. > Hmmm.... maybe vsprintf() should automatically replace %p with %pK if it > detects a user-space context? I am not sure if there is an easy and reliable way how to detect the user-space context. On some architectures, it might be possible to guess it by the address of the buffer. But it will not work when the message is temporary printed into a local buffer and copied later. Let's keep it simple. Heuristics often become very complex over time. Best Regards, Petr