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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-b8350c55-39e7-4502-b797-2b4a2c4dd758@palmer-ri-x1c9>
Date: Thu, 01 Aug 2024 11:47:27 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: samuel.holland@...ive.com
CC: alexghiti@...osinc.com, Paul Walmsley <paul.walmsley@...ive.com>,
  aou@...s.berkeley.edu, andy.chiu@...ive.com, linux-riscv@...ts.infradead.org,
  linux-kernel@...r.kernel.org
Subject:     Re: [PATCH -fixes] riscv: Re-introduce global icache flush in patch_text_XXX()

On Thu, 01 Aug 2024 10:32:28 PDT (-0700), samuel.holland@...ive.com wrote:
> Hi Alex,
>
> On 2024-07-30 8:59 AM, Alexandre Ghiti wrote:
>> commit edf2d546bfd6 ("riscv: patch: Flush the icache right after
>> patching to avoid illegal insns") mistakenly removed the global icache
>> flush in patch_text_nosync() and patch_text_set_nosync() functions, so
>> reintroduce them.
>>
>> Fixes: edf2d546bfd6 ("riscv: patch: Flush the icache right after patching to avoid illegal insns")
>> Reported-by: Samuel Holland <samuel.holland@...ive.com>
>> Closes: https://lore.kernel.org/linux-riscv/CAHVXubh8Adb4=-vN4cSh0FrZ16TeOKJbLj4AF09QC241bRk1Jg@mail.gmail.com/T/#m800757c26f72a1d45c240cb815650430166c82ea
>
> Shouldn't this use the permalink for the specific message, not the thread?
>
>> Signed-off-by: Alexandre Ghiti <alexghiti@...osinc.com>
>> ---
>>  arch/riscv/kernel/patch.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
>> index ab03732d06c4..91edfd764ed9 100644
>> --- a/arch/riscv/kernel/patch.c
>> +++ b/arch/riscv/kernel/patch.c
>> @@ -205,6 +205,9 @@ int patch_text_set_nosync(void *addr, u8 c, size_t len)
>>
>>  	ret = patch_insn_set(tp, c, len);
>>
>> +	if (!ret)
>> +		flush_icache_range((uintptr_t)tp, (uintptr_t)tp + len);
>
> This patch was based on an old tree from before
> https://git.kernel.org/riscv/c/47742484ee16 removed the "tp" variable. While it
> still compiles because flush_icache_range() is a macro that discards its
> arguments, it will be confusing to anyone reading the code.

Thanks.  Alex is going to spin a new one, so I dropped this.

>
> Regards,
> Samuel
>
>> +
>>  	return ret;
>>  }
>>  NOKPROBE_SYMBOL(patch_text_set_nosync);
>> @@ -237,6 +240,9 @@ int patch_text_nosync(void *addr, const void *insns, size_t len)
>>
>>  	ret = patch_insn_write(tp, insns, len);
>>
>> +	if (!ret)
>> +		flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len);
>> +
>>  	return ret;
>>  }
>>  NOKPROBE_SYMBOL(patch_text_nosync);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ