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: <87fs3x4yh9.ffs@tglx>
Date:   Fri, 01 Sep 2023 19:03:46 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Ammar Faizi <ammarfaizi2@...weeb.org>,
        Joshua Hudson <joshudson@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:     x86-ml <x86@...nel.org>
Subject: Re: System Call trashing registers

On Fri, Sep 01 2023 at 23:24, Ammar Faizi wrote:
> On 8/24/23 11:15 PM, Joshua Hudson wrote:
>> 2) syscall is documented to trash rcx and r11.
>> 
>> What I don't understand is why this hasn't ever led to a security
>> issue due to leaking values from kernel space (in the trashed
>> registers) back to userspace.
>
> That behavior is architectural. It's the 'syscall' instruction that
> clobbers %rcx and %r11. Not the kernel.
>
> The kernel's syscall entry point even saves %rcx and %r11, but at that
> point they've already been overwritten by the syscall instruction
> itself with the original %rip and %rflags values. So they contain
> userspace values. No internal kernel data is leaked in %rcx and %r11.

Correct.

It does not matter which entry method you use. The kernel always saves
all registers and restores them. syscall, sysenter, int80 behave the
same way. The implicit clobber by the syscall instruction is done in
hardware and the kernel can't do anything about it.

I can't reproduce this either and the code tells me that any attempt to
reproduce is futile.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ