Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1478586pxb; Thu, 4 Mar 2021 12:22:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcRR5LBKu14ZTD+0T96pfTNxcYUHZx7HoaUggXLLBNhzWjv/AXPTGYQRwuAQxS1tUtCy8f X-Received: by 2002:a17:906:b884:: with SMTP id hb4mr6264495ejb.536.1614889355008; Thu, 04 Mar 2021 12:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614889355; cv=none; d=google.com; s=arc-20160816; b=mwK2k1ayF2YYHNoRVU1lJb/t5VAZAXSO5uDBiBsrs8RnPIOGOia0cResJNHyTu7vsq mRk2a7fN6hLmK+FnpVaI6Kt94ceXlNSZJo8E1QezhANY1WrgQdUqgTspDkynnmldCXt0 SDqJy/OTQZTKl7qRdIYeIWEHuCmcuukLibS5wC96qFZVpr7uDjPSnod+8aHxVyfhd4Fi ztIh/AFHJ1VwIVZkIIP+yRfYFpO2rIaBAoNETEwmzD36hGFhHeO0epGNODdptueAvOqm 9FMNKU+PXORU53ikrTeFVLk2KutLy8iHA9PpWdOc8KKz5C1N93VhT1L6CpE8Kj1iko1c UmPg== 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; bh=/3D/HygHM2s+B6WKXxJW0gcme/YrKFpE/BZDVmFOXmQ=; b=AapXWPEJBSlNz1RFw36QfbK7PrXvzz/DXaCXO4t5YhbbeIr2ZJGXL8MnlLFw3aUaID f5d4hHkMTVIsMD6oEDW+bMoatM5U6oK9qANjLy3Szw/DFbQMvJw0eAoxxG6XWcANAzmI 1pBNY5lQtonRVGJ3WqkWY0r+7A/JYRcjh12m0EifQhndaBlNoLixk9ldR9xHts1yb7JS VqitBJMqB8tL2Bz1324QNGGESqT7NmNOZ1o8UUezmC17Jb13snyDIoyxYx4RGTsEI3vj uGzr2ggrOKNf/0C1rCAn2OtZk5yUL9Wi4zpFS2XuLtWENuAVUKrKI8DM5prS1eSovo4+ s7Hw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo5si330983edb.459.2021.03.04.12.21.57; Thu, 04 Mar 2021 12:22:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349842AbhCBRhA (ORCPT + 99 others); Tue, 2 Mar 2021 12:37:00 -0500 Received: from mail-pl1-f170.google.com ([209.85.214.170]:45211 "EHLO mail-pl1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384553AbhCBPFU (ORCPT ); Tue, 2 Mar 2021 10:05:20 -0500 Received: by mail-pl1-f170.google.com with SMTP id u18so5997704plc.12 for ; Tue, 02 Mar 2021 07:04:58 -0800 (PST) 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=/3D/HygHM2s+B6WKXxJW0gcme/YrKFpE/BZDVmFOXmQ=; b=NiZarwH5IpCJp+U+uWnqs9OOtUZEO6+M7apZvEUXLpwW1SdAaVFvnbHOR0QJt719fH YKyirTUkBtFiVdYiOFs6s43VUvvmL+EgrIvpaporMICV+0NYQVZzptSZYHVKgD7hLUQL HFFbC9shBTUkMzPhatTu6OIAQefRDSZouWN6zoHbPdOENPl6rdk5HWl+kL4F2+ERpqKB +ydDM5bxT6l454rglntcKIbHKdvlX04T2usbFskhyWFrxI3TapDdrnXNc3RDbt5+y93+ X4Nwhg1w0XcvfwkaKtQrt//lbTc0DigUIh7nnCBmH/ofJhd3c0uLXzqgXVlyrrWuhKwP Ivpw== X-Gm-Message-State: AOAM533EHAD00x5XtknH/8PYpvt2iroK0hYHUZtZMefBBVIl4AgS1Bqp 7OE74d/b1QM4dheVJy7gFVkBd8yeD0yvDsD5M1YoJBiP X-Received: by 2002:a1f:2502:: with SMTP id l2mr2306082vkl.5.1614696934432; Tue, 02 Mar 2021 06:55:34 -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: From: Geert Uytterhoeven Date: Tue, 2 Mar 2021 15:55:23 +0100 Message-ID: Subject: Re: [PATCH 3/3] [v4] lib/vsprintf: no_hash_pointers prints all addresses as unhashed To: Marco Elver Cc: Matthew Wilcox , Steven Rostedt , 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 Hi Marco, On Tue, Mar 2, 2021 at 3:40 PM Marco Elver wrote: > 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? :-) Gcc deduplicates the identical strings, so you don't have to go through a double indirection at all? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds