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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86426C433EF for ; Wed, 9 Feb 2022 11:54:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B17E36B0073; Wed, 9 Feb 2022 06:54:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC7336B0074; Wed, 9 Feb 2022 06:54:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B5FE6B0075; Wed, 9 Feb 2022 06:54:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id 889A16B0073 for ; Wed, 9 Feb 2022 06:54:12 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 173189674A for ; Wed, 9 Feb 2022 11:54:12 +0000 (UTC) X-FDA: 79123083144.13.98E810A Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf02.hostedemail.com (Postfix) with ESMTP id 2D4DA80006 for ; Wed, 9 Feb 2022 11:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644407651; x=1675943651; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XHcEyr4TkkEQt0L52yL9PfVN/CDEFOJal7rChg5lePM=; b=mAYBKbI97axO8LvaprvjQp1hgOwlF5Ik+0qHBV8MVksKqyFES2bshf9A I6fQW8csJwPPdIlhCjEPvndZUqsl7jJkO/SnNUpoL2n+q6FNKng2XKbHN W54Bc2mkZEXyPqGC5be5JaLqsyAaHNsJ0PHh0q5zqlpf0DT4xDWNluOCR 2spHY/7xFvl2dQX7urA8n/IS5dVBC7oD+kauyidZksEe2A8q1cs0c+jaZ KrQntPi/p/gRlYLiqWVggB5To0i0T5UgOoS8jvMYHOZALtJJzw5H9F2r7 cS/3j12Fjpu+v+B5eYfypXf19+mIKVwmw8PeElCM4tKxHZjMnwj4tOqqM Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="246770810" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="246770810" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 03:54:05 -0800 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="482306049" Received: from smile.fi.intel.com ([10.237.72.61]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 03:54:02 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nHlWy-002bH8-ER; Wed, 09 Feb 2022 13:53:04 +0200 Date: Wed, 9 Feb 2022 13:53:04 +0200 From: Andy Shevchenko To: Petr Mladek Cc: Christophe Leroy , Steven Rostedt , Sergey Senozhatsky , Rasmus Villemoes , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Kees Cook , Linus Torvalds Subject: Re: [PATCH] vsprintf: Fix %pK with kptr_restrict == 0 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Rspamd-Queue-Id: 2D4DA80006 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mAYBKbI9; spf=none (imf02.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 192.55.52.93) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Stat-Signature: 19nfjscnpfqo6uu59yx1rx6wk47awe9f X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1644407650-420730 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: On Tue, Feb 08, 2022 at 02:51:39PM +0100, Petr Mladek wrote: > On Thu 2022-01-27 11:11:02, Christophe Leroy wrote: ... > Instead, I would create: > > /* > * default is to _not_ leak addresses, so hash before printing, > * unless no_hash_pointers is specified on the command line. > */ > static noinline_for_stack > char *default_pointer(const char *fmt, char *buf, char *end, void *ptr, > struct printf_spec spec) > { > if (unlikely(no_hash_pointers)) > return pointer_string(buf, end, ptr, spec); > > return ptr_to_id(buf, end, ptr, spec); > } > > and use it in both hash_pointer() and pointer(). I like this idea. -- With Best Regards, Andy Shevchenko