RE: [PATCH V2 01/15] x86/fsgsbase/64: Introduce FS/GS base helper functions

From: Bae, Chang Seok
Date: Thu May 31 2018 - 17:03:12 EST


>> 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".

Okay, will take "active" out from the note.

>> +/*
>> + * 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."

Will do that.

>> +
>> +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.

Okay, thanks.