lkml.org 
[lkml]   [2021]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [GIT pull] locking/urgent for v5.12-rc3
On Mon, Mar 15, 2021 at 11:59:12AM -0700, Linus Torvalds wrote:
> Is it only the static_call_sites entry itself that needs the
> alignment? Or do we end up depending on the static call function being
> at least 4-byte aligned too? The way it plays games with the key makes
> me worry.

The only thing that absolutely needs to be aligned is the
struct static_call_key address. We use the 2 LSB there.

The code address has no alignment requirements, due to x86 instruction
coding the actual CALL (or JMP for tail-calls) can be anywhere.

Now, static_call_site is PC32 encoded, that is:

struct static_call_key *key =
(void *)((unsigned long)&site->key + site->key);

And assuming &site->key is aligned, then site->key & 3 == key & 3.

Per the missing alignment for modules, the above went side-ways. The
patch in question fixed this by not relying on that and always computing
the absolute address first, then transfer the LSBs and then re-encoding
it.

Anyway, still good to also fix the alignment.

\
 
 \ /
  Last update: 2021-03-15 23:11    [W:0.083 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site