All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Emese Revfy <re.emese@gmail.com>
Cc: "kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Josh Triplett <josh@joshtriplett.org>,
	PaX Team <pageexec@freemail.hu>,
	Brad Spengler <spender@grsecurity.net>,
	Michal Marek <mmarek@suse.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	minipli@ld-linux.so, Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	David Brown <david.brown@linaro.org>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jeff Layton <jlayton@poochiereds.net>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH v4 0/4] Introduce the initify gcc plugin
Date: Thu, 12 Jan 2017 15:40:41 -0800	[thread overview]
Message-ID: <CAGXu5jJ_9Gbre2J1HYrY-gwnsStL8P+MKmKQwCBtY4-7m53RLA@mail.gmail.com> (raw)
In-Reply-To: <CAGXu5jLB_ZxPcJDsBK0h-HTfb8G-GdC+BnD-1rTL5ePUvcwuzA@mail.gmail.com>

On Thu, Jan 12, 2017 at 3:27 PM, Kees Cook <keescook@chromium.org> wrote:
> On Thu, Jan 12, 2017 at 1:41 PM, Emese Revfy <re.emese@gmail.com> wrote:
>> On Tue, 10 Jan 2017 17:09:31 -0800
>> Kees Cook <keescook@chromium.org> wrote:
>>
>>> WARNING: vmlinux.o(.text+0x1087e7): Section mismatch in reference from
>>> the function rebind_subsystems() to the variable
>>> .init.rodata.str:__func__.4400
>>> The function rebind_subsystems() references
>>> the variable __initconst __func__.4400.
>>> This is often because rebind_subsystems lacks a __initconst
>>> annotation or the annotation of __func__.4400 is wrong.
>>
>> Thanks for the report, you can find the fix here:
>> https://github.com/ephox-gcc-plugins/initify/commit/25f34834e3373e067133bc5d39d42c50a3592d56
>
> Awesome! I can confirm, it builds without warnings now. Thanks!

Hm, actually, with an "allyesconfig" build, I'm still seeing warnings
(and possibly some nocapture verification failures).

Most look like this:

WARNING: drivers/clk/bcm/built-in.o(.text+0xec2): Section mismatch in
reference from the function clk_gate() to the variable
.init.rodata.str:__func__.29708
The function clk_gate() references
the variable __initconst __func__.29708.
This is often because clk_gate lacks a __initconst
annotation or the annotation of __func__.29708 is wrong.

And there's this (should KASAN be disabled for initify?)

mm/kasan/kasan.c: In function ‘memmove’:
mm/kasan/kasan.c:346:7: warning: ‘memmove’ captures its 2 (‘src’)
parameter, please remove it from the nocapture attribute.
 void *memmove(void *dest, const void *src, size_t len)
       ^
mm/kasan/kasan.c: In function ‘memcpy’:
mm/kasan/kasan.c:355:7: warning: ‘memcpy’ captures its 2 (‘src’)
parameter, please remove it from the nocapture attribute.
 void *memcpy(void *dest, const void *src, size_t len)
       ^

And ACPI:

drivers/acpi/acpica/utdebug.c: In function ‘acpi_debug_print’:
drivers/acpi/acpica/utdebug.c:158:1: warning: ‘acpi_debug_print’
captures its 3 (‘function_name’) parameter, please remove it from the
nocapture attribute.
 acpi_debug_print(u32 requested_debug_level,
 ^


I used my initify v5 development tree, with the following patch, with
"make allyesconfig":

http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=for-next/gcc-plugin/initify

diff --git a/arch/Kconfig b/arch/Kconfig
index b6009a21ebea..5693ef5f22c8 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -359,7 +359,6 @@ config HAVE_GCC_PLUGINS
 menuconfig GCC_PLUGINS
        bool "GCC plugins"
        depends on HAVE_GCC_PLUGINS
-       depends on !COMPILE_TEST
        help
          GCC plugins are loadable modules that provide extra features to the
          compiler. They are useful for runtime instrumentation and
static analysis.
@@ -429,6 +428,7 @@ config GCC_PLUGIN_INITIFY
 config GCC_PLUGIN_INITIFY_VERBOSE
        bool "Report initification"
        depends on GCC_PLUGIN_INITIFY
+       depends on !COMPILE_TEST
        help
          Print all initified strings and all functions which should be
          __init/__exit.


I'll see if acpi needs __noverified_nocapture ...

-Kees

-- 
Kees Cook
Nexus Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: Emese Revfy <re.emese@gmail.com>
Cc: "kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Josh Triplett <josh@joshtriplett.org>,
	PaX Team <pageexec@freemail.hu>,
	Brad Spengler <spender@grsecurity.net>,
	Michal Marek <mmarek@suse.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	minipli@ld-linux.so, Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	David Brown <david.brown@linaro.org>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jeff Layton <jlayton@poochiereds.net>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: [kernel-hardening] Re: [PATCH v4 0/4] Introduce the initify gcc plugin
Date: Thu, 12 Jan 2017 15:40:41 -0800	[thread overview]
Message-ID: <CAGXu5jJ_9Gbre2J1HYrY-gwnsStL8P+MKmKQwCBtY4-7m53RLA@mail.gmail.com> (raw)
In-Reply-To: <CAGXu5jLB_ZxPcJDsBK0h-HTfb8G-GdC+BnD-1rTL5ePUvcwuzA@mail.gmail.com>

On Thu, Jan 12, 2017 at 3:27 PM, Kees Cook <keescook@chromium.org> wrote:
> On Thu, Jan 12, 2017 at 1:41 PM, Emese Revfy <re.emese@gmail.com> wrote:
>> On Tue, 10 Jan 2017 17:09:31 -0800
>> Kees Cook <keescook@chromium.org> wrote:
>>
>>> WARNING: vmlinux.o(.text+0x1087e7): Section mismatch in reference from
>>> the function rebind_subsystems() to the variable
>>> .init.rodata.str:__func__.4400
>>> The function rebind_subsystems() references
>>> the variable __initconst __func__.4400.
>>> This is often because rebind_subsystems lacks a __initconst
>>> annotation or the annotation of __func__.4400 is wrong.
>>
>> Thanks for the report, you can find the fix here:
>> https://github.com/ephox-gcc-plugins/initify/commit/25f34834e3373e067133bc5d39d42c50a3592d56
>
> Awesome! I can confirm, it builds without warnings now. Thanks!

Hm, actually, with an "allyesconfig" build, I'm still seeing warnings
(and possibly some nocapture verification failures).

Most look like this:

WARNING: drivers/clk/bcm/built-in.o(.text+0xec2): Section mismatch in
reference from the function clk_gate() to the variable
.init.rodata.str:__func__.29708
The function clk_gate() references
the variable __initconst __func__.29708.
This is often because clk_gate lacks a __initconst
annotation or the annotation of __func__.29708 is wrong.

And there's this (should KASAN be disabled for initify?)

mm/kasan/kasan.c: In function ‘memmove’:
mm/kasan/kasan.c:346:7: warning: ‘memmove’ captures its 2 (‘src’)
parameter, please remove it from the nocapture attribute.
 void *memmove(void *dest, const void *src, size_t len)
       ^
mm/kasan/kasan.c: In function ‘memcpy’:
mm/kasan/kasan.c:355:7: warning: ‘memcpy’ captures its 2 (‘src’)
parameter, please remove it from the nocapture attribute.
 void *memcpy(void *dest, const void *src, size_t len)
       ^

And ACPI:

drivers/acpi/acpica/utdebug.c: In function ‘acpi_debug_print’:
drivers/acpi/acpica/utdebug.c:158:1: warning: ‘acpi_debug_print’
captures its 3 (‘function_name’) parameter, please remove it from the
nocapture attribute.
 acpi_debug_print(u32 requested_debug_level,
 ^


I used my initify v5 development tree, with the following patch, with
"make allyesconfig":

http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=for-next/gcc-plugin/initify

diff --git a/arch/Kconfig b/arch/Kconfig
index b6009a21ebea..5693ef5f22c8 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -359,7 +359,6 @@ config HAVE_GCC_PLUGINS
 menuconfig GCC_PLUGINS
        bool "GCC plugins"
        depends on HAVE_GCC_PLUGINS
-       depends on !COMPILE_TEST
        help
          GCC plugins are loadable modules that provide extra features to the
          compiler. They are useful for runtime instrumentation and
static analysis.
@@ -429,6 +428,7 @@ config GCC_PLUGIN_INITIFY
 config GCC_PLUGIN_INITIFY_VERBOSE
        bool "Report initification"
        depends on GCC_PLUGIN_INITIFY
+       depends on !COMPILE_TEST
        help
          Print all initified strings and all functions which should be
          __init/__exit.


I'll see if acpi needs __noverified_nocapture ...

-Kees

-- 
Kees Cook
Nexus Security

  reply	other threads:[~2017-01-12 23:40 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16 22:06 [PATCH v4 0/4] Introduce the initify gcc plugin Kees Cook
2016-12-16 22:06 ` [kernel-hardening] " Kees Cook
2016-12-16 22:06 ` [PATCH v4 1/4] gcc-plugins: Add " Kees Cook
2016-12-16 22:06   ` [kernel-hardening] " Kees Cook
2016-12-16 22:45   ` PaX Team
2016-12-16 22:45     ` [kernel-hardening] " PaX Team
2016-12-16 22:45     ` PaX Team
2016-12-16 23:02     ` Kees Cook
2016-12-16 23:02       ` [kernel-hardening] " Kees Cook
2016-12-16 23:02       ` Kees Cook
2016-12-16 23:15       ` PaX Team
2016-12-16 23:15         ` [kernel-hardening] " PaX Team
2016-12-16 23:15         ` PaX Team
2016-12-16 22:06 ` [PATCH v4 2/4] util: Move type casts into is_kernel_rodata Kees Cook
2016-12-16 22:06   ` [kernel-hardening] " Kees Cook
2016-12-16 22:06 ` [PATCH v4 3/4] initify: Mark functions with the __nocapture attribute Kees Cook
2016-12-16 22:06   ` [kernel-hardening] " Kees Cook
2016-12-16 22:06 ` [PATCH v4 4/4] initify: Mark functions with the __unverified_nocapture attribute Kees Cook
2016-12-16 22:06   ` [kernel-hardening] " Kees Cook
2016-12-16 22:19 ` [PATCH v4 0/4] Introduce the initify gcc plugin Kees Cook
2016-12-16 22:19   ` [kernel-hardening] " Kees Cook
2016-12-16 22:19   ` Kees Cook
2016-12-19 11:10   ` Emese Revfy
2016-12-19 11:10     ` [kernel-hardening] " Emese Revfy
2016-12-19 11:10     ` Emese Revfy
2017-01-04  0:23     ` Kees Cook
2017-01-04  0:23       ` [kernel-hardening] " Kees Cook
2017-01-04  0:23       ` Kees Cook
2017-01-11  0:24       ` Emese Revfy
2017-01-11  0:24         ` [kernel-hardening] " Emese Revfy
2017-01-11  0:24         ` Emese Revfy
2017-01-11  1:09         ` Kees Cook
2017-01-11  1:09           ` [kernel-hardening] " Kees Cook
2017-01-11  1:09           ` Kees Cook
2017-01-12 21:41           ` Emese Revfy
2017-01-12 21:41             ` [kernel-hardening] " Emese Revfy
2017-01-12 21:41             ` Emese Revfy
2017-01-12 23:27             ` Kees Cook
2017-01-12 23:27               ` [kernel-hardening] " Kees Cook
2017-01-12 23:27               ` Kees Cook
2017-01-12 23:40               ` Kees Cook [this message]
2017-01-12 23:40                 ` [kernel-hardening] " Kees Cook
2017-01-12 23:40                 ` Kees Cook
2017-01-17 20:31                 ` Emese Revfy
2017-01-17 20:31                   ` [kernel-hardening] " Emese Revfy
2017-01-17 20:31                   ` Emese Revfy
2017-01-19  1:22                   ` Kees Cook
2017-01-19  1:22                     ` [kernel-hardening] " Kees Cook
2017-01-19  1:22                     ` Kees Cook
2017-02-15  0:23                 ` Emese Revfy
2017-02-15  0:23                   ` [kernel-hardening] " Emese Revfy
2017-02-15  0:23                   ` Emese Revfy
2017-02-15 19:27                   ` Kees Cook
2017-02-15 19:27                     ` [kernel-hardening] " Kees Cook
2017-02-15 19:27                     ` Kees Cook
2017-02-20 21:42                     ` Emese Revfy
2017-02-20 21:42                       ` [kernel-hardening] " Emese Revfy
2017-02-20 21:42                       ` Emese Revfy
2016-12-19 18:24 ` Laura Abbott
2016-12-19 18:24   ` [kernel-hardening] " Laura Abbott
2017-01-04  0:23   ` Kees Cook
2017-01-04  0:23     ` [kernel-hardening] " Kees Cook
2017-01-04  0:23     ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGXu5jJ_9Gbre2J1HYrY-gwnsStL8P+MKmKQwCBtY4-7m53RLA@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=david.brown@linaro.org \
    --cc=jlayton@poochiereds.net \
    --cc=josh@joshtriplett.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=minipli@ld-linux.so \
    --cc=mmarek@suse.com \
    --cc=pageexec@freemail.hu \
    --cc=re.emese@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=spender@grsecurity.net \
    --cc=tglx@linutronix.de \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.