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]
Date:	Wed, 10 Jun 2015 08:21:10 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Denys Vlasenko <dvlasenk@...hat.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Borislav Petkov <bp@...en8.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>,
	Oleg Nesterov <oleg@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Will Drewry <wad@...omium.org>,
	Kees Cook <keescook@...omium.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] x86/asm/entry/32: Shorten __audit_syscall_entry args
 preparation


* Denys Vlasenko <dvlasenk@...hat.com> wrote:

> We use three MOVs to swap edx and ecx. We can use one XCHG instead.
> 
> Expand the comments. It's difficult to keep track which arg# every register
> corresponds to, so spell it out.

> +	/*
> +	 * At this point, registers hold syscall args in 32-bit ABI:
> +	 * eax is syscall#, args are in ebx,ecx,edx,esi,edi,ebp.
> +	 * Shuffle them to match what __audit_syscall_entry() wants.
> +	 */
> +	movl	%esi, %r8d		/* arg5 (r8): 4th syscall arg */
> +	xchg	%ecx, %edx		/* arg4 (rcx): 3rd syscall arg (edx) */
> +					/* arg3 (rdx): 2nd syscall arg (ecx) */
> +	movl	%ebx, %esi		/* arg2 (rsi): 1st syscall arg */
> +	movl	%eax, %edi		/* arg1 (rdi): syscall number */
>  	call	__audit_syscall_entry

So while we are at it I improved this a bit more, to:

        /*
         * At this point, registers hold syscall args in 32-bit syscall ABI:
         *   eax is syscall#, args are in ebx,ecx,edx,esi,edi,ebp.
         *
         * We want to pass them to __audit_syscall_entry(), which is a 64-bit
         * C function with 5 parameters, so shuffle them to match what
         * __audit_syscall_entry() expects: rdi,rsi,rdx,rcx,r8.
         */
        movl    %esi, %r8d              /* arg5 (r8 ) <= 4th syscall arg (esi) */
        xchg    %ecx, %edx              /* arg4 (rcx) <= 3rd syscall arg (edx) */
                                        /* arg3 (rdx) <= 2nd syscall arg (ecx) */
        movl    %ebx, %esi              /* arg2 (rsi) <= 1st syscall arg (ebx) */
        movl    %eax, %edi              /* arg1 (rdi) <= syscall number  (eax) */
        call    __audit_syscall_entry

Btw., syscall auditing is not auditing syscall arguments #5 and #6?

Thanks,

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ