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 1F2D0C04FF3 for ; Mon, 24 May 2021 11:32:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F28DC610FA for ; Mon, 24 May 2021 11:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232646AbhEXLdq (ORCPT ); Mon, 24 May 2021 07:33:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:39516 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232050AbhEXLdm (ORCPT ); Mon, 24 May 2021 07:33:42 -0400 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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