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: <CALCETrXp5at9nQgz0x9TZOpajDGfbMhQXM-igBFjrQGJ_w_Wsg@mail.gmail.com>
Date:   Thu, 31 May 2018 13:14:06 -0700
From:   Andy Lutomirski <luto@...nel.org>
To:     "Bae, Chang Seok" <chang.seok.bae@...el.com>
Cc:     Andrew Lutomirski <luto@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "Metzger, Markus T" <markus.t.metzger@...el.com>,
        "Ravi V. Shankar" <ravi.v.shankar@...el.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V2 01/15] x86/fsgsbase/64: Introduce FS/GS base helper functions

On Thu, May 31, 2018 at 10:58 AM Chang S. Bae <chang.seok.bae@...el.com> wrote:
>
> With new helpers, FS/GS base access is centralized.
> Eventually, when FSGSBASE instruction enabled, it will
> be faster.
>
> The helpers are used on ptrace APIs (PTRACE_ARCH_PRCTL,
> PTRACE_SETREG, PTRACE_GETREG, etc). Idea is to keep
> the FS/GS-update mechanism organized.
>
> Notion of "active" and "inactive" are used to distinguish
> GS bases between "kernel" and "user". "inactive" GS base
> is the GS base, backed up at kernel entries, of inactive
> (user) task's.

I'm fine with the code, but the changelog entry is confusing.  A bunch
of the active helpers don't contain the term "active".

> +/*
> + * Read/write an (inactive) task's fsbase or gsbase. This returns
> + * the value that the FS/GS base would have (if the task were to be
> + * resumed). The current task is also supported.
> + */

Please change to "Read/write a task's fsbase or gsbase. ... These work
on current or on a different non-running task."

> +
> +unsigned long read_task_fsbase(struct task_struct *task)
> +{
> +       unsigned long fsbase;
> +
> +       if (task == current)
> +               fsbase = read_fsbase();
> +       else
> +               /*
> +                * XXX: This will not behave as expected if called
> +                * if fsindex != 0
> +                */
> +               fsbase = task->thread.fsbase;
> +

Please put braces around the if and else blocks whenever either of
them spans multiple lines.  Also, maybe change add a note to the
comment and/or the changelog that this is preserving an existing bug
and that it's fixed later in the series.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ