Re: [PATCH 2/2] lib/vsprintf: reduce space taken by no_hash_pointers warning

Timur Tabi
2021-03-12T03:47:36Z

On Mon, Mar 8, 2021 at 4:51 AM Marco Elver <elver@google.com> wrote:
> If we do __initconst change we need to manually remove the duplicate
> lines because we're asking the compiler to create a large array (and
> there's no more auto-dedup). If we do not remove the duplicate lines,
> the __initconst-only approach would create a larger image and result
> in subtly increased memory consumption during init. The additional
> code together with manual dedup should offset that. (I can split this
> patch as Andy suggests, but first need confirmation what people
> actually want.)
>
> I have no idea what the right trade-off is, and appeal to Geert to
> suggest what would be acceptable to him.

Maybe we can have only the message itself wrapped in an #ifdef CONFIG_
of some kind. For example:

+#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
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");
...
+#endif

return 0;
}

In other words, if space is really constrained, then don't include the
message. Or maybe just include part of the message.