lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mhng-f51a8614-665a-4961-b6d6-a37c0af73a8d@palmerdabbelt-glaptop1>
Date:   Mon, 27 Jul 2020 13:19:40 -0700 (PDT)
From:   Palmer Dabbelt <palmer@...belt.com>
To:     kernel@...il.dk
CC:     linux-riscv@...ts.infradead.org, kernel@...il.dk,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Bjorn Topel <bjorn.topel@...il.com>,
        linux-kernel@...r.kernel.org
Subject:     Re: [PATCH] riscv: Grab text_mutex before patching jump-labels

On Thu, 23 Jul 2020 09:36:28 PDT (-0700), kernel@...il.dk wrote:
> Like other arch's we use patch_text_nosync or equivalent
> to patch the jump-labels, but also like other arch's we
> need to hold the text_mutex before calling that.
>
> Signed-off-by: Emil Renner Berthing <kernel@...il.dk>
> ---
>
> Fixes: b6e0878a4ec8 ("riscv: Add jump-label implementation")
> ..that is already in riscv/for-next.
>
> Palmer: Sorry, I didn't notice this before. Feel free to
> squash this into the commit above if you like.
> ---
>  arch/riscv/kernel/jump_label.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/jump_label.c b/arch/riscv/kernel/jump_label.c
> index 1bab1abc1aa5..20e09056d141 100644
> --- a/arch/riscv/kernel/jump_label.c
> +++ b/arch/riscv/kernel/jump_label.c
> @@ -4,8 +4,10 @@
>   *
>   * Based on arch/arm64/kernel/jump_label.c
>   */
> -#include <linux/kernel.h>
>  #include <linux/jump_label.h>
> +#include <linux/kernel.h>
> +#include <linux/memory.h>
> +#include <linux/mutex.h>
>  #include <asm/bug.h>
>  #include <asm/patch.h>
>
> @@ -33,7 +35,9 @@ void arch_jump_label_transform(struct jump_entry *entry,
>  		insn = RISCV_INSN_NOP;
>  	}
>
> +	mutex_lock(&text_mutex);
>  	patch_text_nosync(addr, &insn, sizeof(insn));
> +	mutex_unlock(&text_mutex);
>  }
>
>  void arch_jump_label_transform_static(struct jump_entry *entry,

I've just put this on for-next as is.  I generally try to avoid rebasing stuff,
but I think I saw a message today about a patch I put there prematurely so I
might have to rewrite history anyway.  If I do I'll squash it and a few other
small fixes.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ