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] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c0db0f8-bab8-7cdb-172e-931658ed0548@loongson.cn>
Date: Fri, 11 Apr 2025 19:37:14 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Jinyang He <hejinyang@...ngson.cn>, Huacai Chen <chenhuacai@...nel.org>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: Enhance robust of kprobe

On 04/11/2025 12:46 PM, Jinyang He wrote:
>
> On 2025-04-11 10:48, Tiezhu Yang wrote:
>> On 04/09/2025 10:17 AM, Jinyang He wrote:
>>> On 2025-04-08 17:27, Tiezhu Yang wrote:

...

> I have just explained the previous status may be broken by IRQ.

The initial aim is to make sure the irq is disabled at the end of
do_bp(), so let us narrow down the scope.

> On the other hand, have you tried only fix do_bp weather cause hang?
>
> bool this_bp_ie = regs->csr_prmd & CSR_PRMD_PIE;
> if (this_bp_ie)
>   local_irq_enable();
> ...
> if (this_bp_ie)
>   local_irq_disable();

This is a good idea, thank you.

I will test the following change, if it works well and no more comments,
I will send v2 in the next week.

---8<---
diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
index 2ec3106c0da3..68cc4165578a 100644
--- a/arch/loongarch/kernel/traps.c
+++ b/arch/loongarch/kernel/traps.c
@@ -710,11 +710,12 @@ asmlinkage void noinstr do_bce(struct pt_regs *regs)
  asmlinkage void noinstr do_bp(struct pt_regs *regs)
  {
         bool user = user_mode(regs);
+       bool pie = regs->csr_prmd & CSR_PRMD_PIE;
         unsigned int opcode, bcode;
         unsigned long era = exception_era(regs);
         irqentry_state_t state = irqentry_enter(regs);

-       if (regs->csr_prmd & CSR_PRMD_PIE)
+       if (pie)
                 local_irq_enable();

         if (__get_inst(&opcode, (u32 *)era, user))
@@ -780,7 +781,7 @@ asmlinkage void noinstr do_bp(struct pt_regs *regs)
         }

  out:
-       if (regs->csr_prmd & CSR_PRMD_PIE)
+       if (pie)
                 local_irq_disable();

         irqentry_exit(regs, state);

Thanks,
Tiezhu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ