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:   Fri, 17 Sep 2021 16:50:37 +0200
From:   Dmitry Vyukov <dvyukov@...gle.com>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
        Andrey Konovalov <andreyknvl@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Steven Rostedt <rostedt@...dmis.org>,
        Marco Elver <elver@...gle.com>,
        Clark Williams <williams@...hat.com>
Subject: Re: [PATCH 4/5] kcov: Avoid enable+disable interrupts if !in_task().

On Mon, 30 Aug 2021 at 19:26, Sebastian Andrzej Siewior
<bigeasy@...utronix.de> wrote:
>
> kcov_remote_start() may need to allocate memory in the in_task() case
> (otherwise per-CPU memory has been pre-allocated) and therefore requires
> enabled interrupts.
> The interrupts are enabled before checking if the allocation is required
> so if no allocation is required then the interrupts are needlessly
> enabled and disabled again.
>
> Enable interrupts only if memory allocation is performed.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>

Acked-by: Dmitry Vyukov <dvyukov@...gle.com>

> ---
>  kernel/kcov.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 4f910231d99a2..620dc4ffeb685 100644
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -869,19 +869,19 @@ void kcov_remote_start(u64 handle)
>                 size = CONFIG_KCOV_IRQ_AREA_SIZE;
>                 area = this_cpu_ptr(&kcov_percpu_data)->irq_area;
>         }
> -       spin_unlock_irqrestore(&kcov_remote_lock, flags);
> +       spin_unlock(&kcov_remote_lock);
>
>         /* Can only happen when in_task(). */
>         if (!area) {
> +               local_irqrestore(flags);
>                 area = vmalloc(size * sizeof(unsigned long));
>                 if (!area) {
>                         kcov_put(kcov);
>                         return;
>                 }
> +               local_irq_save(flags);
>         }
>
> -       local_irq_save(flags);
> -
>         /* Reset coverage size. */
>         *(u64 *)area = 0;
>
> --
> 2.33.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ