linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Jessica Yu <jeyu@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Miroslav Benes <mbenes@suse.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	Sergey Shtylyov <s.shtylyov@omprussia.ru>,
	Stephen Boyd <swboyd@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	llvm@lists.linux.dev
Subject: Re: [PATCH] module: fix clang CFI with MODULE_UNLOAD=n
Date: Mon, 27 Sep 2021 08:27:16 -0700	[thread overview]
Message-ID: <CABCJKucOoov6aWzP3bcTwewNHFRbQn=nFvtkcZQ34hSm+K8+iw@mail.gmail.com> (raw)
In-Reply-To: <20210927121541.939745-1-arnd@kernel.org>

Hi Arnd,

On Mon, Sep 27, 2021 at 5:15 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> When CONFIG_MODULE_UNLOAD is disabled, the module->exit member
> is not defined, causing a build failure:
>
> kernel/module.c:4493:8: error: no member named 'exit' in 'struct module'
>                 mod->exit = *exit;
>
> add an #ifdef block around this.
>
> Fixes: cf68fffb66d6 ("add support for Clang CFI")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/module.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/kernel/module.c b/kernel/module.c
> index 40ec9a030eec..5c26a76e800b 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -4489,8 +4489,10 @@ static void cfi_init(struct module *mod)
>         /* Fix init/exit functions to point to the CFI jump table */
>         if (init)
>                 mod->init = *init;
> +#ifdef CONFIG_MODULE_UNLOAD
>         if (exit)
>                 mod->exit = *exit;
> +#endif
>
>         cfi_module_add(mod, module_addr_min);
>  #endif

Thanks for the fix!

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami

  parent reply	other threads:[~2021-09-27 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 12:15 [PATCH] module: fix clang CFI with MODULE_UNLOAD=n Arnd Bergmann
2021-09-27 13:34 ` Miroslav Benes
2021-09-27 15:27 ` Sami Tolvanen [this message]
2021-09-27 16:21 ` Kees Cook
2021-09-28 11:01 ` Jessica Yu

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='CABCJKucOoov6aWzP3bcTwewNHFRbQn=nFvtkcZQ34hSm+K8+iw@mail.gmail.com' \
    --to=samitolvanen@google.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mbenes@suse.cz \
    --cc=mcgrof@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=s.shtylyov@omprussia.ru \
    --cc=swboyd@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).