[PATCH 04/18] arm64: alternatives: Enforce alignment of struct alt_instr
Marc Zyngier
marc.zyngier at arm.com
Wed Dec 6 06:57:29 PST 2017
On 06/12/17 14:48, Konrad Rzeszutek Wilk wrote:
> On Wed, Dec 06, 2017 at 02:38:25PM +0000, Marc Zyngier wrote:
>> We're playing a dangerous game with struct alt_instr, as we produce
>> it using assembly tricks, but parse them using the C structure.
>> We just assume that the respective alignments of the two will
>> be the same.
>>
>> But as we add more fields to this structure, the alignment requirements
>> of the structure may change, and lead to all kind of funky bugs.
>>
>> TO solve this, let's move the definition of struct alt_instr to its
>> own file, and use this to generate the alignment constraint from
>> asm-offsets.c. The various macros are then patched to take the
>> alignment into account.
>
> Would it be better to use .p2align as on 32-bit ARM you must
> have it 4-byte aligned. Or at least have and BUILD_BUG_ON
> to make sure the size can be divided by four??
>
> Oh wait. You are not even touching ARM-32, how come? The alternative
> code can run on ARM-32 ...
How? Given that I haven't written yet, I'd be grateful if you could
share your time machine...
Thanks,
M.
--
Jazz is not dead. It just smells funny...
More information about the linux-arm-kernel
mailing list