Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp962310pxb; Wed, 3 Mar 2021 22:40:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzybA3YBt7qP6EA+pPUOkqMitW5hm6eSgth9qr96meL1Hyw/CYyokfd8oDRA/0wtg6pt4bG X-Received: by 2002:a05:6402:5255:: with SMTP id t21mr2719561edd.91.1614840027292; Wed, 03 Mar 2021 22:40:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614840027; cv=none; d=google.com; s=arc-20160816; b=ETQMsM9Z3NekoZ/pCa/jVj7sYH6T6nn2A05e+r98nWuuKJkOflblMtwmQDsz5qfTgA F11RC/zxBFQ28f5pvukWDRFUIEfuSwX3rShH9bRbaYl3PLJghRotSBgSWYtZAjwMarxE IdLRck71s8XoEbfJYVSwcc93ZThaS64pvZCzZrzmTu1sS634OL6hTnDsjSPzgryEiQIh ZE6w2gA8GYuvhc5yL2HOHriHrgPOFQez1Ptn2asoFZurXUG7lir7gZU2YfO31jcgGsHf E5idZRMlTMD3Vh0HQ7arlhtsHd/iHLjXtsyus/CHN5e91wXnPHu7HqiBFavX8xCJnMYF R97Q== 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=cWXPysMA7asYOTX40W9IplQ7R0vKyMtv6CPsbE1KGK8=; b=tI5i3TPRRFXGzfInHGqLKtlEHNSONQUbMLGe++7za9XG+t7bznjbObL6n87vkmhD8K Yyfn5+JPg2znyG+bnSCDmaJPx73CJlpZRz9lzsNC1qD0a0pMGaY3BEV3xbngVwXok6dt jwueEagPM8c1lWK3TyowCivCIKzqgG882UslUIirKFLYycDhIMJ+R59T4DiB57wvdeRC uNHNRKlIeDKVYpjy2ydZkbZ+CdvJLFCfZI+n8GEPslqGXTjNLJHWeirM3y4bskzbGwut uOwEGg/X3AikHfvt2G/mxfGSDm5BJyMScIE3yxZCp8wyBZdkhjekUqjG7prByrRBjug2 XvqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=JVhDhE3i; 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 w25si18168251ejy.70.2021.03.03.22.40.05; Wed, 03 Mar 2021 22:40:27 -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=JVhDhE3i; 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 S1839956AbhCBUoe (ORCPT + 99 others); Tue, 2 Mar 2021 15:44:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:43710 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350028AbhCBRzn (ORCPT ); Tue, 2 Mar 2021 12:55:43 -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=1614707591; 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=cWXPysMA7asYOTX40W9IplQ7R0vKyMtv6CPsbE1KGK8=; b=JVhDhE3iCr+hkgEZdFp7vvmSSDwEMxtMXF93Fvc6ZJYuytErPOT85FTpdjKYXQ6T7fcXnh SF3nCseXkJJlcSsTpZ0e02GEyWIIioog5ScNvJwmLXvH0Kn2vhBpGQl1CT9Q3jZCuqCrSo SGGLn8MZdWCeAbANr/afcSLqwlibeIE= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 23258AEA3; Tue, 2 Mar 2021 17:53:11 +0000 (UTC) Date: Tue, 2 Mar 2021 18:53:10 +0100 From: Petr Mladek To: Geert Uytterhoeven Cc: Vlastimil Babka , Marco Elver , Timur Tabi , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Matthew Wilcox , Andrew Morton , Linus Torvalds , roman.fietze@magna.com, Kees Cook , John Ogness , Akinobu Mita , Alexander Potapenko , Andrey Konovalov , Rasmus Villemoes , Pavel Machek , Tetsuo Handa , Linux Kernel Mailing List , Linux MM Subject: Re: [PATCH 3/3] [v4] lib/vsprintf: no_hash_pointers prints all addresses as unhashed Message-ID: References: <20210214161348.369023-1-timur@kernel.org> <20210214161348.369023-4-timur@kernel.org> <8893ff08-1e50-316c-f632-cd37be1690d5@suse.cz> 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 On Tue 2021-03-02 14:49:42, Geert Uytterhoeven wrote: > Hi Vlastimil, Petr, > > On Tue, Mar 2, 2021 at 2:37 PM Vlastimil Babka wrote: > > On 3/2/21 2:29 PM, Petr Mladek wrote: > > > On Tue 2021-03-02 13:51:35, Geert Uytterhoeven wrote: > > >> > > > + > > >> > > > + pr_warn("**********************************************************\n"); > > >> > > > + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); > > >> > > > + pr_warn("** **\n"); > > >> > > > + pr_warn("** This system shows unhashed kernel memory addresses **\n"); > > >> > > > + pr_warn("** via the console, logs, and other interfaces. This **\n"); > > >> > > > + pr_warn("** might reduce the security of your system. **\n"); > > >> > > > + pr_warn("** **\n"); > > >> > > > + pr_warn("** If you see this message and you are not debugging **\n"); > > >> > > > + pr_warn("** the kernel, report this immediately to your system **\n"); > > >> > > > + pr_warn("** administrator! **\n"); > > >> > > > + pr_warn("** **\n"); > > >> > > > + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); > > >> > > > + pr_warn("**********************************************************\n"); > > >> > > > + > > >> > > > + return 0; > > >> > > > +} > > >> > > > +early_param("no_hash_pointers", no_hash_pointers_enable); > > >> > > > > >> > > While bloat-o-meter is not smart enough to notice the real size impact, > > >> > > this does add more than 500 bytes of string data to the kernel. > > >> > > Do we really need such a large message? > > >> > > Perhaps the whole no_hash_pointers machinery should be protected by > > >> > > "#ifdef CONFIG_DEBUG_KERNEL"? > > > > I think it's a no-go only when enabling such option equals to "no_hash_pointers" > > being always passed. What Geert suggests is that you need both > > CONFIG_DEBUG_KERNEL *and* no_hash_pointers and that's different. > > Exactly. > > > So this is basically a kernel tinyfication issue, right? Is that still pursued > > today? Are there better config options suitable for this than CONFIG_DEBUG_KERNEL? > > As long as I hear about products running Linux on SoCs with 10 MiB of > SRAM, I think the answer is yes. > I'm not immediately aware of a better config option. There are no more > TINY options left, and EXPERT selects DEBUG_KERNEL. DEBUG_KERNEL might actually makes sense. A possibility to see real pointers might be pretty useful for the other debugging code. It is a common thing. DEBUG_KERNEL is even needed for many basics debugging helpers, for example, for FRAME_POINTERS. So, if it would be good for SoCs... > > >> > Would placing the strings into an __initconst array help? > > >> > > >> That would indeed help to reduce run-time memory consumption. > > > > > > Sure. We could do this. Do you want to send a patch, please? > > Added to my list. > > > >> It would not solve the raw kernel size increase. > > > > > > I see. Well, the compression should be pretty efficient > > > for a text (with many spaces). > > My worry is not about the medium for storing the kernel image, but the > RAM where the kernel image is loaded. The former is usually less > restricted in size, and easier to expand, than the latter, Well, the __initconst might be enough then. I personally do not have any preference whether to do __initconst or DEBUG_KERNEL or both. We should just keep it simple and do not over engineer it. Best Regards, Petr