lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44116d94-20f8-29e1-5046-1f8c49fb67ed@akamai.com>
Date:   Wed, 22 Feb 2017 10:11:18 -0500
From:   Jason Baron <jbaron@...mai.com>
To:     Michael Ellerman <mpe@...erman.id.au>,
        Sachin Sant <sachinp@...ux.vnet.ibm.com>,
        Steven Rostedt <rostedt@...dmis.org>
Cc:     linux-next@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        linuxppc-dev@...abs.org
Subject: Re: next-20170217 boot on POWER8 LPAR : WARNING
 @kernel/jump_label.c:287

On 02/22/2017 12:38 AM, Michael Ellerman wrote:
> Jason Baron <jbaron@...mai.com> writes:
> 
>> On 02/20/2017 10:05 PM, Sachin Sant wrote:
>>>
>>>> On 20-Feb-2017, at 8:27 PM, Jason Baron <jbaron@...mai.com
>>>> <mailto:jbaron@...mai.com>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> On 02/19/2017 09:07 AM, Sachin Sant wrote:
>>>>> While booting next-20170217 on a POWER8 LPAR following
>>>>> warning is displayed.
>>>>>
>>>>> Reverting the following commit helps boot cleanly.
>>>>> commit 3821fd35b5 :  jump_label: Reduce the size of struct static_key
>>>>>
>>>>> [   11.393008] ------------[ cut here ]------------
>>>>> [   11.393031] WARNING: CPU: 5 PID: 2890 at kernel/jump_label.c:287
>>>>> static_key_set_entries.isra.10+0x3c/0x50
>>>>
>>>> Thanks for the report. So this is saying that the jump_entry table is
>>>> not at least 4-byte aligned. I wonder if this fixes it up?
>>>>
>>>
>>> Yes. With this patch the warning is gone.
>>
>> Hi,
>>
>> Thanks for testing. We probably need something like the following to 
>> make sure we don't hit this on other arches. Steve - I will send 4 
>> separate patches for this to get arch maintainers' acks for this?
> 
> What's the 4 byte alignment requirement from?
>

The 4 byte alignment is coming from this patch in linux-next:

https://lkml.org/lkml/2017/2/3/558

It reduces the size of 'struct static_key' by making use of the two
least significant bits of the static_key::entry pointer. Thus, the
jump_entry table needs to be 4 byte aligned to make it work. I added a
WARN_ON() to make sure the jump_entry table is in fact 4 byte aligned,
and that is what we hit here.

> On 64-bit our JUMP_ENTRY_TYPE is 8 bytes, should we be aligning to 8
> bytes?
> 

4 bytes should be sufficient and apparently fixes the WARN_ON() that was
hit.

>> diff --git a/arch/powerpc/include/asm/jump_label.h 
>> b/arch/powerpc/include/asm/jump_label.h
>> index 9a287e0ac8b1..f870a85bac46 100644
>> --- a/arch/powerpc/include/asm/jump_label.h
>> +++ b/arch/powerpc/include/asm/jump_label.h
>> @@ -24,6 +24,7 @@ static __always_inline bool arch_static_branch(struct 
>> static_key *key, bool bran
>>          asm_volatile_goto("1:\n\t"
>>                   "nop # arch_static_branch\n\t"
>>                   ".pushsection __jump_table,  \"aw\"\n\t"
>> +                ".balign 4 \n\t"
> 
> Can you line those up vertically?
> 
> (That may just be an email artifact)

sure will fix.

Thanks,

-Jason

> 
>>                   JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
>>                   ".popsection \n\t"
>>                   : :  "i" (&((char *)key)[branch]) : : l_yes);
>> @@ -38,6 +39,7 @@ static __always_inline bool 
>> arch_static_branch_jump(struct static_key *key, bool
>>          asm_volatile_goto("1:\n\t"
>>                   "b %l[l_yes] # arch_static_branch_jump\n\t"
>>                   ".pushsection __jump_table,  \"aw\"\n\t"
>> +                ".balign 4 \n\t"
>>                   JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
>>                   ".popsection \n\t"
>>                   : :  "i" (&((char *)key)[branch]) : : l_yes);
>> @@ -63,6 +65,7 @@ struct jump_entry {
>>   #define ARCH_STATIC_BRANCH(LABEL, KEY)         \
>>   1098:  nop;                                    \
>>          .pushsection __jump_table, "aw";        \
>> +       .balign 4;                              \
>>          FTR_ENTRY_LONG 1098b, LABEL, KEY;       \
>>          .popsection
>>   #endif
> 
> Otherwise that looks fine assuming 4 bytes is the correct alignment.
> 
> cheers
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ