[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.21.2004221411140.28581@pobox.suse.cz>
Date: Wed, 22 Apr 2020 14:28:26 +0200 (CEST)
From: Miroslav Benes <mbenes@...e.cz>
To: Josh Poimboeuf <jpoimboe@...hat.com>
cc: live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Jessica Yu <jeyu@...nel.org>, linux-s390@...r.kernel.org,
heiko.carstens@...ibm.com
Subject: Re: [PATCH v2 6/9] s390/module: Use s390_kernel_write() for late
relocations
> +int apply_relocate_add(Elf_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 = s390_kernel_write;
> + mutex_lock(&text_mutex);
> + }
> +
> + ret = __apply_relocate_add(sechdrs, strtab, symindex, relsec, me,
> + write);
> +
> + if (!early)
> + mutex_unlock(&text_mutex);
> +
> + return ret;
> +}
It means that you can take text_mutex the second time here because it
is still taken in klp_init_object_loaded(). It is removed later in the
series though. The same applies for x86 patch.
Also, s390_kernel_write() grabs s390_kernel_write_lock spinlock before
writing anything, so maybe text_mutex is not really needed as long as
s390_kernel_write is called everywhere for text patching.
Miroslav
Powered by blists - more mailing lists