Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2878308pxb; Fri, 12 Feb 2021 03:56:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGkZhdVLIIzoZSYvnT7dDeuGM135QcX6YGE0ggSj/CW7L1Vbi4SYmSA7VWRRB2hf6EANEe X-Received: by 2002:a05:6402:61a:: with SMTP id n26mr2886499edv.51.1613130977224; Fri, 12 Feb 2021 03:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613130977; cv=none; d=google.com; s=arc-20160816; b=gz3bBpnd9SYcqxgYeWQY0CxRqYW6BgR7/p/mxYvO2opB/XKxrIZjGOWrNCPu6zku0Z GDFEAnI3k6F1m5bZEgePL87s4YCw9OEh2JtfG7LXQMSedoYziN0yNIDvkCrtOVdzObYw YZJy6AxKfxVXVC6gZV7Ta7j7UoiozUszf/17hTb+O7MXty3z3lMdlAF41trdhPJ9p+hM zSBYrYvKb+hb8qzAtkC3EI3fc40YxLyU/1Hs87AIR6072SCU4Fm5eBN9flxMCrO5pJhk Jq2gkCpa/yjxU3d2uTK+KNuW7yjrbpnUS5qRHbv7vfe0MsLIVqopcx0xrGhrTaIZmRjg wYuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=y/PuJ4QsOK7MgaeHvEagRzBSM3sKp/kTBUCgRC9w1bg=; b=EO2FPUi6RCk/kt4VcqZ6CZD5wEoRQ1DEbUSkCOZ5OvRQIbIxSEafnK6WWRMD2sBXW4 KyC84LMzjJ/a5f1e7J0iF+HPedxLVGerINZYK751CGFVHf8UJQK1OSbBKB+mkaT/zUQL 6LZi3uVSnMtoUZV0E+bPtpQQ/VaIyIIkAEOOo3/Qe8bSq8GnsMj55bSY21tFyYOsY5jL RbqJeZP9+vQvwkH9QVTCpaEaONsUljCjipwmLYaLFdBp5eTCU0+cr2nk/Ul3i2SNVqhO mxE0V6602zTLhGbYxCSQKN6XmsqM7X0+MAm59/jN9TtX0XF8yohEP+Q80NzsGSimw/4x /Y1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=gF0pnQ+c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch12si5619677edb.463.2021.02.12.03.55.53; Fri, 12 Feb 2021 03:56:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=gF0pnQ+c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbhBLLxv (ORCPT + 99 others); Fri, 12 Feb 2021 06:53:51 -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