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=-7.3 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,USER_AGENT_SANE_1 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 EEFF7C04FF3 for ; Mon, 24 May 2021 11:32:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8DE7B610FA for ; Mon, 24 May 2021 11:32:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DE7B610FA 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 1BA8D94006C; Mon, 24 May 2021 07:32:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16B95940055; Mon, 24 May 2021 07:32:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00B3594006C; Mon, 24 May 2021 07:32:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id BE083940055 for ; Mon, 24 May 2021 07:32:15 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 59877180ACEEB for ; Mon, 24 May 2021 11:32:15 +0000 (UTC) X-FDA: 78175911030.18.2D537B8 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf16.hostedemail.com (Postfix) with ESMTP id 3BC968019116 for ; Mon, 24 May 2021 11:32:10 +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=1621855933; 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=l4+YR55d73GMIRIIlhwxLCsLisFSGbrwblla1Qo1l+U=; b=HC/MwSOYsmtSMg+sZk4b9YxGLPj9SzNWvf6WXi+952zumYJshJGJaqKgk9p4bd5VnmEb90 RtGn5D4y3BNZQP3ywjsnqmUUTa4hoz1V3Bl0nzMu45nF2MaCkKOD5ciF2ZhgxQG+bo8ma/ OdRyaifMK23g+QrvhVyVSEkyGWa60ao= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 86CF6AD8A; Mon, 24 May 2021 11:32:13 +0000 (UTC) Date: Mon, 24 May 2021 13:32:13 +0200 From: Petr Mladek To: Stephen Boyd Cc: Andrew Morton , linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , linux-mm@kvack.org Subject: Re: [PATCH 2/3] slub: Print raw pointer addresses when debugging Message-ID: <20210524113213.h33k3t2exr5rlwin@pathway.suse.cz> References:<20210520013539.3733631-1-swboyd@chromium.org> <20210520013539.3733631-3-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To:<20210520013539.3733631-3-swboyd@chromium.org> User-Agent: NeoMutt/20170912 (1.9.0) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="HC/MwSOY"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf16.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=pmladek@suse.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3BC968019116 X-Stat-Signature: ddcms5wiwhwrogimus9siu47nyk9rgu6 X-HE-Tag: 1621855930-225364 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 Wed 2021-05-19 18:35:38, Stephen Boyd wrote: > Obscuring the pointers that slub shows when debugging makes for some > confusing slub debug messages: > > Padding overwritten. 0x0000000079f0674a-0x000000000d4dce17 > > Those addresses are hashed for kernel security reasons. If we're trying > to be secure with slub_debug on the commandline we have some big > problems given that we dump whole chunks of kernel memory to the kernel > logs. Let's use %px here and dump buffers with the actual address for > the buffer instead of the hashed version so that the logs are > meaningful. This also helps if a kernel address is in some slub debug > report so we can figure out that the object is referencing itself. Please, do not do this! Use "no_hash_pointers" commandling option when you want to see raw pointers. It will make it clear when the kernel logs are save and when not. If "slub_debug" is useless with hashed pointers then it might enable "no_hash_pointers". But make sure that it prints the fat warning. This patch is the worst approach. We have to keep the number of "%px" callers at minimum to keep it maintainable. The only safe use-case is when the system is in panic() [*]. If the pointers might be printed at any time then users should be warned by the fat message printed by "no_hash_pointers". [*] Raw pointers are currently printed also by Oops/WARN messages. It is from historic reasons. Anyway, they are fat warnings on its own. The system often need to get reported anyway. Best Regards, Petr