[v2,0/4] Make IA32_EMULATION boot time overridable

Message ID 20230609111311.4110901-1-nik.borisov@suse.com
Headers
Series Make IA32_EMULATION boot time overridable |

Message

Nikolay Borisov June 9, 2023, 11:13 a.m. UTC
  Here's the 2nd version of the patch which aims to make IA32_EMULATION essentially
a boot time option. The changes in this posting are:

* Introduced a compile-time option CONFIG_IA32_EMULATION_DEFAULT_DISABLED which
can be set during compile time and can be overriden at boot time via a new
parameter 'ia32_mode'.

* Documented the new parameter as per Thomas' suggestion

* Added a new patch which renames ignore_sysret as per Andrew Cooper's suggestion

* Fixed compat_elf_check_arch condition check to only affect compat process
loading and leave x32 abi processes alone

* Dropped GDT modification as this was deemed a separate change. Likely I'd need
to follow up with a more complete solution.

Nikolay Borisov (4):
  x86: Introduce CONFIG_IA32_EMULATION_DEFAULT_DISABLED Kconfig option
  x86/entry: Rename ignore_sysret and compile it unconditionally
  x86/entry: Disable IA32 syscall if ia32_disabled is true
  x86: Disable laoding 32bit processes if ia32_disabled is true

 .../admin-guide/kernel-parameters.txt         |  4 ++
 arch/x86/Kconfig                              |  5 +++
 arch/x86/entry/common.c                       | 16 ++++++++
 arch/x86/entry/entry_64.S                     |  6 +--
 arch/x86/include/asm/desc.h                   |  1 +
 arch/x86/include/asm/elf.h                    |  9 ++++-
 arch/x86/include/asm/processor.h              |  2 +-
 arch/x86/include/asm/traps.h                  |  4 ++
 arch/x86/kernel/cpu/common.c                  | 37 ++++++++++---------
 arch/x86/kernel/idt.c                         |  7 ++++
 10 files changed, 67 insertions(+), 24 deletions(-)

--
2.34.1
  

Comments

David Laight June 10, 2023, 9:46 p.m. UTC | #1
From: Nikolay Borisov
> Sent: 09 June 2023 12:13
> 
> Here's the 2nd version of the patch which aims to make IA32_EMULATION essentially
> a boot time option. The changes in this posting are:

Does it make any sense to be able to enable/disable it at run-time
(through a sysctl).
Perhaps only if enabled at boot - where it can be a 'soft disable'
even though the cpu is initialised to allow the 32bit system calls.

Remember, if you are root (and the system isn't hard locked down)
it is pretty easy to change a global boolean variable.
So it doesn't really affect the attack surface.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
  
Nikolay Borisov June 11, 2023, 8:19 a.m. UTC | #2
On 11.06.23 г. 0:46 ч., David Laight wrote:
> From: Nikolay Borisov
>> Sent: 09 June 2023 12:13
>>
>> Here's the 2nd version of the patch which aims to make IA32_EMULATION essentially
>> a boot time option. The changes in this posting are:
> 
> Does it make any sense to be able to enable/disable it at run-time
> (through a sysctl).

I'd say now, because then we are losing consistency, that is if the 
sysctl is off, then some 32bit process is being run, then you flip it 
back to on and suddenly this process dies (if it's using syscalls that is).

With a boot time switch we'll ensure that no 32bit process can be 
loaded, which at least can give the sysadmin some assurance that the 
machine is 32bit clean. Am I missing something?

> Perhaps only if enabled at boot - where it can be a 'soft disable'
> even though the cpu is initialised to allow the 32bit system calls.
> 
> Remember, if you are root (and the system isn't hard locked down)

Well, if you are root then every bet's off?

> it is pretty easy to change a global boolean variable.
> So it doesn't really affect the attack surface.
> 
> 	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>