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]
Date:   Sat, 7 May 2022 18:26:58 +0000
From:   Rik van Riel <riel@...com>
To:     "live-patching@...r.kernel.org" <live-patching@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "song@...nel.org" <song@...nel.org>
CC:     Kernel Team <Kernel-team@...com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "joe.lawrence@...hat.com" <joe.lawrence@...hat.com>,
        "vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
        "jpoimboe@...hat.com" <jpoimboe@...hat.com>
Subject: Re: [RFC] sched,livepatch: call klp_try_switch_task in __cond_resched

On Sat, 2022-05-07 at 10:46 -0700, Song Liu wrote:
> Busy kernel threads may block the transition of livepatch. Call
> klp_try_switch_task from __cond_resched to make the transition
> easier.
> 
That seems like a useful idea given what we're seeing on
some systems, but I do have a nitpick with your patch :)

> +++ b/kernel/sched/core.c
> @@ -6990,6 +6990,9 @@ SYSCALL_DEFINE0(sched_yield)
>  #if !defined(CONFIG_PREEMPTION) || defined(CONFIG_PREEMPT_DYNAMIC)
>  int __sched __cond_resched(void)
>  {
> +       if (unlikely(klp_patch_pending(current)))
> +               klp_try_switch_task(current);
> +
>         if (should_resched(0)) {
>                 preempt_schedule_common();
>                 return 1;

While should_resched and klp_patch_pending check the same
cache line (task->flags), now there are two separate
conditionals on this.

Would it make sense to fold the tests for TIF_NEED_RESCHED
and TIF_PATCH_PENDING int should_resched(), and then re-do
the test for TIF_PATCH_PENDING only if should_resched()
returns true?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ