lkml.org 
[lkml]   [2020]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 7/9] x86/module: Use text_poke() for late relocations
On Fri, Apr 17, 2020 at 09:04:32AM -0500, Josh Poimboeuf wrote:
> +int apply_relocate_add(Elf64_Shdr *sechdrs,
> + const char *strtab,
> + unsigned int symindex,
> + unsigned int relsec,
> + struct module *me)
> +{
> + int ret;
> + bool early = me->state == MODULE_STATE_UNFORMED;
> + void *(*write)(void *, const void *, size_t) = memcpy;
> +
> + if (!early) {
> + write = text_poke;
> + mutex_lock(&text_mutex);
> + }
> +
> + ret = __apply_relocate_add(sechdrs, strtab, symindex, relsec, me,
> + write);
> +
> + if (!early) {
> + mutex_unlock(&text_mutex);
> + text_poke_sync();

I'm thinking text_poke_sync() wants to be inside text_mutex. Although
given that nothing should be running that text, it really doesn't
matter.

> + }
> +
> + return ret;
> +}
> +
> #endif
>
> int module_finalize(const Elf_Ehdr *hdr,
> --
> 2.21.1
>

\
 
 \ /
  Last update: 2020-04-17 16:30    [W:0.189 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site