The jump_table stores two 32-bit words and one 32- (on 32-bit kernel) or one 64-bit word (on 64-bit kernel). Ensure that the last word is always 64-bit aligned on a 64-bit kernel by aligning the whole structure on sizeof(long).
Unified · Split
| @@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran · 14 unmodified lines | ||
| 15 | 15 | asm_volatile_goto("1:\n\t" |
| 16 | 16 | "nop\n\t" |
| 17 | 17 | ".pushsection __jump_table, \"aw\"\n\t" |
| 18 | + ".align %1\n\t" | |
| 18 | 19 | ".word 1b - ., %l[l_yes] - .\n\t" |
| 19 | 20 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" |
| 20 | 21 | ".popsection\n\t" |
| 21 | − : : "i" (&((char *)key)[branch]) : : l_yes); | |
| 22 | + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) | |
| 23 | + : : l_yes); | |
| 22 | 24 | |
| 23 | 25 | return false; |
| 24 | 26 | l_yes: |
| @@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool · 5 unmodified lines | ||
| 30 | 32 | asm_volatile_goto("1:\n\t" |
| 31 | 33 | "b,n %l[l_yes]\n\t" |
| 32 | 34 | ".pushsection __jump_table, \"aw\"\n\t" |
| 35 | + ".align %1\n\t" | |
| 33 | 36 | ".word 1b - ., %l[l_yes] - .\n\t" |
| 34 | 37 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" |
| 35 | 38 | ".popsection\n\t" |
| 36 | − : : "i" (&((char *)key)[branch]) : : l_yes); | |
| 39 | + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) | |
| 40 | + : : l_yes); | |
| 37 | 41 | |
| 38 | 42 | return false; |
| 39 | 43 | l_yes: |