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 3D0E4C433DB for ; Fri, 12 Feb 2021 11:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0158A64E89 for ; Fri, 12 Feb 2021 11:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbhBLLyW (ORCPT ); Fri, 12 Feb 2021 06:54:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:39810 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbhBLLwt (ORCPT ); Fri, 12 Feb 2021 06:52:49 -0500 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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