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: <CAHk-=wg74E_1NXafYaemRT7R9dqU3DSOf+YGftD832BJqXBwoQ@mail.gmail.com>
Date: Thu, 25 Jul 2024 09:55:12 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] orphaned patches for 6.11

On Thu, 25 Jul 2024 at 04:06, Tetsuo Handa
<penguin-kernel@...ove.sakura.ne.jp> wrote:
>
>
> Do you mean
>
>  void profile_tick(int type)
>  {
>         struct pt_regs *regs = get_irq_regs();
>
> -       if (!user_mode(regs) && cpumask_available(prof_cpu_mask) &&
> +       if (!user_mode(regs) && prof_buffer &&
>             cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))
>                 profile_hit(type, (void *)profile_pc(regs));
>  }
>
> because prof_cpu_mask != NULL is guaranteed if prof_buffer != NULL
> because prof_cpu_mask is assigned before prof_buffer is assigned and
> prof_buffer is never reassigned?

Yeah, I think that would be much clearer.

What would make things even clearer is to not have that horrible
complex conditional there in the first place.

The code could do something like

        struct pt_regs *regs;

        /* Are we supposed to profile at all? */
        if (!prof_buffer)
                return;
        /* Are we profiling this CPU? */
        if (cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))
                return;
        /* This is the old kernel-only legacy profiling */
        regs = get_irq_regs();
        if (user_mode(regs))
                return;
        profile_hit(type, (void *)profile_pc(regs));

and each line would be much simpler.

I think this code has grown all these historical barnacles, because
this really is the really old kernel-only profiling that nobody should
even use any more, but is the only thing we have for the early boot
situation.

                Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ