Skip to content
Snippets Groups Projects
  • Catalin Marinas's avatar
    16dd46bb
    arm64: No need to set the x0-x2 registers in start_thread() · 16dd46bb
    Catalin Marinas authored
    
    For historical reasons, ARM used to set r0-r2 in start_thread() to the
    first values on the user stack when starting a new user application. The
    same logic has been inherited in AArch64. The x0 register is overridden
    by the sys_execve() return value so it's always zero on success. The x1
    and x2 registers are ignored by AArch64 and EABI AArch32 applications,
    so we can safely remove the register setting for both native and compat
    user space.
    
    This also fixes a potential fault with the kernel accessing user space
    stack directly.
    
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    16dd46bb
    History
    arm64: No need to set the x0-x2 registers in start_thread()
    Catalin Marinas authored
    
    For historical reasons, ARM used to set r0-r2 in start_thread() to the
    first values on the user stack when starting a new user application. The
    same logic has been inherited in AArch64. The x0 register is overridden
    by the sys_execve() return value so it's always zero on success. The x1
    and x2 registers are ignored by AArch64 and EABI AArch32 applications,
    so we can safely remove the register setting for both native and compat
    user space.
    
    This also fixes a potential fault with the kernel accessing user space
    stack directly.
    
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>