Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2123174ybf; Mon, 2 Mar 2020 02:24:54 -0800 (PST) X-Google-Smtp-Source: ADFU+vsuc+mvHCVOSSqNF4ed7RC5S5tnPQ94f41FKPSE6fgaTpEOzB3vOVtJKYtqmNOg41veVCtV X-Received: by 2002:a9d:82e:: with SMTP id 43mr5593285oty.101.1583144693969; Mon, 02 Mar 2020 02:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583144693; cv=none; d=google.com; s=arc-20160816; b=olwgfsuLFEt81ZxvgDEghnMkvfIj6p+87F6kqDXGwPD6UKAFWqtE7UtY6uCf15/wEa /goQJInqKzQL52UIWtkJrlzRKuNlvkrbx5M/J/9NIuuFbZCiUalevQriutNZgzEYPZYv bh0tk9YOPbX97m3QH6dCVubienFShuBlRe/BTfakzn8W7ymTUnfFGT/XdA50FTduoykE 98ZuG3GCseSv4dHj4d9hCr/+slGydMsGSmyQbraKTvIIbTPm+Yy8OA00HisR4mU9key3 XRY2XjWe2ySa7ndD95lzeymf0EvrjJBUJpFhlL0lp4vqnMtkwnVuTwu5KQWUjSC3xsWr NHJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=9w1I1i7uUgxgz2GsbcpNmbxSyEpqg4D1QubjLgrHoOs=; b=ZpuVaPCB6kU22+EupesYzNHcFA2kUyxPxlw7z8D8T/s9rW0LlrBBFjqztUTBD6n4Su wDQvKk3tjsk0hswDdMKxLxfngUSTuy+Cx1C4AYsb24sHYg+PuICuVFmd5jMR0BqyltNK 6YtZrfn3t6jl4ivi6Msn8SRi6wv4Bhgy/tj1l1QIkXY2ZoTHvlVbuxdKRnZ6EuDRwbQo B90IL/Hwgz2Ikf6IMfpRag06g07Tf0nX5kHcLTHWWVrD3Rxf5MgFx/A2q9XwO9JvGxch 1O9A1pKb/fKSuCM+nhk6Q/GHR1V8zze9drSuDPPpINEzPfHOomny+cIVodJ1/9AACvOJ oL5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si1495927otc.315.2020.03.02.02.24.41; Mon, 02 Mar 2020 02:24:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbgCBKYc (ORCPT + 99 others); Mon, 2 Mar 2020 05:24:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:38010 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726874AbgCBKYc (ORCPT ); Mon, 2 Mar 2020 05:24:32 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9A1BEAF4E; Mon, 2 Mar 2020 10:24:29 +0000 (UTC) Date: Mon, 2 Mar 2020 11:24:27 +0100 From: Petr Mladek To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Andy Shevchenko , Sergey Senozhatsky , Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , linux-kernel@vger.kernel.org, Ilya Dryomov , Kees Cook , "Tobin C . Harding" Subject: Re: [PATCH 1/3] lib/test_printf: Clean up test of hashed pointers Message-ID: <20200302102427.brzxardpanwqlyfy@pathway.suse.cz> References: <20200227130123.32442-1-pmladek@suse.com> <20200227130123.32442-2-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-02-27 15:30:51, Uwe Kleine-K?nig wrote: > Hello Petr, > > On 2/27/20 2:01 PM, Petr Mladek wrote: > > The commit ad67b74d2469d9b82a ("printk: hash addresses printed with %p") > > helps to prevent leaking kernel addresses. > > > > The testing of this functionality is a bit problematic because the output > > depends on a random key that is generated during boot. Though, it is > > still possible to check some aspects: > > > > + output string length > > + hash differs from the original pointer value > > + top half bits are zeroed on 64-bit systems > > Is "hash differs from the original pointer value" a valid check? > Depending on the random value and the actual pointer I can imagine a > valid match. Such a match is unlikely but not necessarily bogus, is it? Yes, there is a small risk or false negative. It might be possible to try if the problem persist with PTR+1 value or so. But I am not sure if it is worth it. The problem is only on 32-bit systems. The chance is really small. I have added a comment above the check. It can be found via the added error message. Note that this check has been there even before in plain_hash(). But it was worse because it was without any comment or error message. Best Regards, Petr