Re: [RFC] Rename various 'IA32' uses in arch/x86/ code

From: Brian Gerst
Date: Thu Jun 18 2015 - 18:11:28 EST


On Thu, Jun 18, 2015 at 5:13 PM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> * Brian Gerst <brgerst@xxxxxxxxx> wrote:
>
>> >> The original one wasn't really a misnomer, as it referred to the ia32 system
>> >> calls specifically, but this works too.
>> >
>> > It was a misnomer, because what are the 'ia32 system calls'? We have no Intel
>> > specific system calls!
>> >
>> > The term 'IA32' (Intel Architecture 32-bit) is a misnomer in many existing
>> > arch/x86/ symbol, function and file names, and most of them should be renamed.
>> >
>> > Some common examples, with a suggested rename target:
>> >
>> > stack_frame_ia32 -> stack_frame_compat
>> > IA32_RT_SIGFRAME_sigcontext -> COMPAT_RT_SIGFRAME_sigcontext
>> > sigcontext_ia32 -> sigcontext_compat
>> > user_i387_ia32_struct -> user_i387_compat_struct
>> > TIF_IA32 -> TIF_COMPAT
>> >
>> > and here a few 'ia32' misnomers that should be addressed not via simple renames,
>> > but via transformations to existing compat facilities:
>> >
>> > CONFIG_IA32_EMULATION -> partly eliminate, partly covert to CONFIG_COMPAT use
>>
>> I think we still want a symbol for code that is exclusive to 32-bit
>> compatibility (like entry and signal code) to keep it separate from X32 which
>> also wants CONFIG_COMPAT. If I get time this weekend I'll get the patchset to
>> do the separation updated to the tip branch.
>
> Ok, so your goal is to allow the x32 ABI, but not 32-bit user-space?

It just seems odd that x32 (which is really a 64-bit ABI with 32-bit
pointers) depended on enabling 32-bit support. Other than both using
the core compat code, they are not really related.

> I suppose that makes some sense, it might be a valid 'attack surface reduction'
> technique, while still allowing the x32 ABI.
>
> But I'm not sure we should bother and complicate things: 32-bit compat isn't going
> away anytime soon, and most of CONFIG_COMPAT is needed for x32.

Many of the compat syscalls are unused by x32. It only needs to
handle syscalls with pointers embedded in data structures differently
than native 64-bit. 64-bit integer arguments (ie., loff_t) do not
need special handling, since they can be passed in a single register
instead of a pair of 32-bit registers. This won't solve that
particular issue yet, but it's something to be aware of for future
cleanups.

> So maybe we could introduce CONFIG_X86_32_ABI=y or so, which would cover just the
> 32-bit entry code and the signal frame compatibility layer?

Yes.

--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/