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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201030165338.GG1551@shell.armlinux.org.uk>
Date:   Fri, 30 Oct 2020 16:53:39 +0000
From:   Russell King - ARM Linux admin <linux@...linux.org.uk>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Christoph Hellwig <hch@....de>, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org,
        linux-mm@...ck.org, viro@...iv.linux.org.uk,
        linus.walleij@...aro.org, arnd@...db.de
Subject: Re: [PATCH 4/9] ARM: syscall: always store thread_info->syscall

On Fri, Oct 30, 2020 at 04:49:14PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The system call number is used in a a couple of places, in particular
> ptrace, seccomp and /proc/<pid>/syscall.
> 
> The last one apparently never worked reliably on ARM for tasks
> that are not currently getting traced.
> 
> Storing the syscall number in the normal entry path makes it work,
> as well as allowing us to see if the current system call is for
> OABI compat mode, which is the next thing I want to hook into.

I'm not sure this patch is correct.

Tracing the existing code for OABI:

asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
{
        current_thread_info()->syscall = scno;

        /* Legacy ABI only. */
USER(	ldr     scno, [saved_pc, #-4]   )       @ get SWI instruction
	bic     scno, scno, #0xff000000         @ mask off SWI op-code
	eor     scno, scno, #__NR_SYSCALL_BASE  @ check OS number
	tst     r10, #_TIF_SYSCALL_WORK         @ are we tracing syscalls?
	bne     __sys_trace

__sys_trace:
	mov     r1, scno
	add     r0, sp, #S_OFF
	bl      syscall_trace_enter

So, thread_info->syscall does not include __NR_SYSCALL_BASE. The
reason for this is the code that makes use of that via syscall_get_nr().
kernel/trace/trace_syscalls.c:

	syscall_nr = trace_get_syscall_nr(current, regs);
	if (syscall_nr < 0 || syscall_nr >= NR_syscalls)
		return;

and NR_syscalls is the number of syscalls, which doesn't include the
__NR_SYSCALL_BASE offset.

So, I think this patch actually breaks OABI.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ