Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp960317pxb; Wed, 3 Mar 2021 22:35:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwa+fQWjsVOwdURdgD21vST1faNbuIl5yWyALoooAABhg3ZYCXP+8eT4jU9bE+LK/ZxTl1X X-Received: by 2002:aa7:dc56:: with SMTP id g22mr2703309edu.219.1614839747778; Wed, 03 Mar 2021 22:35:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614839747; cv=none; d=google.com; s=arc-20160816; b=Pl7W2JGfVYC6cjdI0xHUQ/PmRhKDtJ0iV9JWyBh2TxGPEdyOwRCatok3eUmkdrD8e6 SMQk0jZo4BHIsK4PKXNaDkHiILNcOioTEuHh67ycFkASok653wOQptrrm+kk2ZN4x2Go MUbTbIFsVMke7MP9Cu4pYHjnQuhLEEsZLOqulCP40UOJvZV+UPrDbS9FonyA3c7mjvrF FqD/BaiC2NvgGFlK06J9qV/S0g+B/AZV2LDQupIT351/G+iJx40Jv2qVuu2ktZyWPCJC 5y2OaRqgO1jkgm6uOwwzgOvoslppPl4lPkzemupqaDcvuw63pUFVZ7AcSQDYpP6Ogs5L QLNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kN+qht5aNloSn99U+wCYtoBLxcHXOR5Y2r7OnXmIE50=; b=XLVt/YVOUae155EeRVlu9ICLX2F7phCXobgoQNxIe8qbhID6VvjfwDLN9247+YXJXf tHnosVddiJoLd+znlYy6vMW107leGxPvnyyK9JZdZl1RmNcKipkGdW20zZDLn68PRvjL YXbfrM4yAE+TNaqrex4dETkR5ziGjOaTzifUT7d1OBmqjxs+ANuxiT96C9xczg1xWBFS nbaEmzEccONy9oofolUF2IJoZcOqUf8YB8soYw112a4yXnfi1h2kS44X3mwglWxhBtBA mA634Ok40yjboRdyF5fiytQUlWZF9fW6BFIto2lt4FnE4DBx0n1bhjNa/VssiKqeXGMc +W9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UYQMjzSo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si6072272edx.438.2021.03.03.22.35.25; Wed, 03 Mar 2021 22:35:47 -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=@google.com header.s=20161025 header.b=UYQMjzSo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580984AbhCBScm (ORCPT + 99 others); Tue, 2 Mar 2021 13:32:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349578AbhCBPq1 (ORCPT ); Tue, 2 Mar 2021 10:46:27 -0500 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EB48C06178A for ; Tue, 2 Mar 2021 06:40:47 -0800 (PST) Received: by mail-ot1-x32f.google.com with SMTP id h10so9492742otm.1 for ; Tue, 02 Mar 2021 06:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kN+qht5aNloSn99U+wCYtoBLxcHXOR5Y2r7OnXmIE50=; b=UYQMjzSo6roQCqqiamnsTLtYfz7qBGxFhi0xS/ciEJyVNhLlobBKXuvOT4LWxeTCpK yYY9eyoahFgKXXAcZ835UJgP7tjaA9uSpMFTVLvHTxk5FOMGsBnOTFw92EmLSJ9wZ59L HBX6djL0MFlHsdg7rDvRW2LICzTp7Z+MWqppYvqG8LFVHwogi/f6wljgTQc2e0QTSV3g MhErOFN/J7GHMGhep7gQvckJrbya/z07YNqkgFm3AROGU+th+Pmm//MGC+v8Ef1lVbrn 4VNY4pfoG100KA/ey7TmERMyirhF+liB032KHQ363JdRQSDaORQ3dcU6u7wEZ5O1229r UV2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kN+qht5aNloSn99U+wCYtoBLxcHXOR5Y2r7OnXmIE50=; b=ZP9JlPUmxz8/lYgisJGynJV3cuj3eYCYidoNxkQDF6/v1I5ytohaRrwTct+ai7qyCM wheJ2b8/CBfNY/OV0ii3rMp0XmX/TelkuBCaVfWo3lZYlBkugJKqhmL40Elwm5OHHZ8Z VL0Aajexu4AD+alroXC0lU7ymKIhGjKYeIl13MytSuF/ZG3U5RLy0cQv3c5P949Z0uU3 oTaeuuP8BfMgClOG+cXpPtPC9FuFNWJMKt2N8Wj5Vj8r0hKNuBR/Pfs6uMrWxJ5mpnud TBouOdw8KqdEnVHTFAtMgoCpmPKcywsa13HoapclxaTtaHy3TSKXhQHKqHy0S4rH5OYc lLtQ== X-Gm-Message-State: AOAM532Yo7WruPT+fJGLDU/UUQYjL6U6LNaNPvv8vWQHe8HYamNA6g9U 9g7dh5CkHq2cI0Ogp3TBQuNYhor59pHDpujrj68mKg== X-Received: by 2002:a05:6830:1355:: with SMTP id r21mr10981842otq.17.1614696046348; Tue, 02 Mar 2021 06:40:46 -0800 (PST) MIME-Version: 1.0 References: <20210214161348.369023-1-timur@kernel.org> <20210214161348.369023-4-timur@kernel.org> <8893ff08-1e50-316c-f632-cd37be1690d5@suse.cz> <20210302090811.620ae7d0@gandalf.local.home> <20210302143516.GY2723601@casper.infradead.org> In-Reply-To: <20210302143516.GY2723601@casper.infradead.org> From: Marco Elver Date: Tue, 2 Mar 2021 15:40:34 +0100 Message-ID: Subject: Re: [PATCH 3/3] [v4] lib/vsprintf: no_hash_pointers prints all addresses as unhashed To: Matthew Wilcox Cc: Steven Rostedt , Geert Uytterhoeven , Vlastimil Babka , Petr Mladek , Timur Tabi , Sergey Senozhatsky , Andy Shevchenko , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Mar 2021 at 15:35, Matthew Wilcox wrote: > > On Tue, Mar 02, 2021 at 03:26:50PM +0100, Marco Elver wrote: > > +static const char no_hash_pointers_warning[9][55] __initconst = { > > + "******************************************************", > > + " NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE ", > > + " ", > > + " This system shows unhashed kernel memory addresses ", > > + " via the console, logs, and other interfaces. This ", > > + " might reduce the security of your system. ", > > + " If you see this message and you are not debugging ", > > + " the kernel, report this immediately to your system ", > > + " administrator! ", > > +}; > > + > > static int __init no_hash_pointers_enable(char *str) > > { > > + const int lines[] = { 0, 1, 2, 3, 4, 5, 2, 6, 7, 8, 2, 1, 0 }; > > + int i; > > + > > no_hash_pointers = true; > > > > - 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"); > > + for (i = 0; i < ARRAY_SIZE(lines); i++) > > + pr_warn("**%s**\n", no_hash_pointers_warning[lines[i]]); > > + for (i = 0; i < 3; i++) > + pr_warn("**%s**\n", no_hash_pointers_warning[lines[2 - i]]); Yeah, I had that before, but then wanted to deal with the blank line in the middle of the thing. So I just went with the lines array above, which seemed cleanest for dealing with the middle blank line and footer. Or maybe there's something even nicer I missed? :-) Thanks, -- Marco