[PATCH 01/17] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

Nadav Amit namit at vmware.com
Fri Jan 25 18:28:04 UTC 2019


> On Jan 25, 2019, at 1:30 AM, Borislav Petkov <bp at alien8.de> wrote:
> 
> On Wed, Jan 16, 2019 at 04:32:43PM -0800, Rick Edgecombe wrote:
>> From: Nadav Amit <namit at vmware.com>
>> 
>> text_mutex is currently expected to be held before text_poke() is
>> called, but we kgdb does not take the mutex, and instead *supposedly*
>> ensures the lock is not taken and will not be acquired by any other core
>> while text_poke() is running.
>> 
>> The reason for the "supposedly" comment is that it is not entirely clear
>> that this would be the case if gdb_do_roundup is zero.
> 
> I guess that variable name is "kgdb_do_roundup” ?

Yes. Will fix.

> 
>> This patch creates two wrapper functions, text_poke() and
> 
> Avoid having "This patch" or "This commit" in the commit message. It is
> tautologically useless.
> 
> Also, do
> 
> $ git grep 'This patch' Documentation/process
> 
> for more details.

Ok.

>> 
>> +void *text_poke_kgdb(void *addr, const void *opcode, size_t len)
> 
> text_poke_unlocked() I guess. I don't think kgdb is that special that it
> needs its own function flavor.

Tglx suggested this naming to prevent anyone from misusing text_poke_kdgb().
This is a very specific use-case that nobody else should need.

Regards,
Nadav



More information about the Linux-security-module-archive mailing list