Re: [PATCH] module: set __jump_table alignment to 8

From: Michael Ellerman
Date: Thu Mar 02 2017 - 05:58:29 EST


David Daney <david.daney@xxxxxxxxxx> writes:

> For powerpc the __jump_table section in modules is not aligned, this
> causes a WARN_ON() splat when loading a module containing a __jump_table.

Thanks for doing the patch.

If it helps:

Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc)

> Strict alignment became necessary with commit 3821fd35b58d
> ("jump_label: Reduce the size of struct static_key"), currently in
> linux-next, which uses the two least significant bits of pointers to
> __jump_table elements.

It would obviously be nice if this could go in before the commit that
exposes the breakage, but I guess that's problematic because Steve
doesn't want to rebase the tracing tree.

Steve I think you've already sent your pull request for this cycle? So I
guess if this can go in your first batch of fixes?

Or we could just send it directly to Linus?

cheers

> Fix by forcing __jump_table to 8, which is the same alignment used for
> this section in the kernel proper.
>
> Signed-off-by: David Daney <david.daney@xxxxxxxxxx>
> Tested-by: Sachin Sant <sachinp@xxxxxxxxxxxxxxxxxx>
> ---
> scripts/module-common.lds | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/scripts/module-common.lds b/scripts/module-common.lds
> index 73a2c7d..53234e8 100644
> --- a/scripts/module-common.lds
> +++ b/scripts/module-common.lds
> @@ -19,4 +19,6 @@ SECTIONS {
>
> . = ALIGN(8);
> .init_array 0 : { *(SORT(.init_array.*)) *(.init_array) }
> +
> + __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) }
> }
> --
> 2.9.3