From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965317AbaGCKZ0 (ORCPT ); Thu, 3 Jul 2014 06:25:26 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:54072 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754895AbaGCKZX (ORCPT ); Thu, 3 Jul 2014 06:25:23 -0400 Date: Thu, 3 Jul 2014 11:24:50 +0100 From: Will Deacon To: AKASHI Takahiro Cc: Kees Cook , =?iso-8859-1?Q?Andr=E9?= Hentschel , Russell King , Jonathan Austin , "linux-kernel@vger.kernel.org" , Andy Lutomirski , Oleg Nesterov , Andrew Morton , "linux-arm-kernel@lists.infradead.org" , Ricky Zhou Subject: Re: [PATCH] arm: ptrace: fix syscall modification under PTRACE_O_TRACESECCOMP Message-ID: <20140703102450.GD12958@arm.com> References: <20140618202748.GA9022@www.outflux.net> <20140620102258.GA26626@arm.com> <20140620172330.GA30656@arm.com> <20140623084608.GA9316@arm.com> <20140624085405.GA26013@arm.com> <53B5098B.9050801@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53B5098B.9050801@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 03, 2014 at 08:43:07AM +0100, AKASHI Takahiro wrote: > Hi Will, Hi Akashi, > On 06/24/2014 05:54 PM, Will Deacon wrote: > > On Mon, Jun 23, 2014 at 08:46:52PM +0100, Kees Cook wrote: > >> What's the state of seccomp on arm64? I saw a series back in March, > >> but nothing since then? It looked complete, but I haven't set up a > >> test environment yet to verify. > > > > I think Akashi was going to repost `real soon now' so we can include them > > for 3.17. He missed the merge window last time around. > > I took a quick look at the current implementation of ptrace. > ptrace(PTRACE_GETREGSET/SETREGSET), eventually gpr_get/set(), handles only > 'struct user_pt_regs', and we have no way to modify orig_x0 nor syscallno > in 'struct pt_regs' directly. > So it seems to me that we can't change a system call by ptrace(). > Do I misunderstand anything? No, it looks like you have a point here. I don't think userspace has any business with orig_x0, but changing syscallno is certainly useful. I can think of two ways to fix this: (1) Updating syscallno based on w8, but this ties us to the current ABI and could get messy if this register changes in the future. (2) Adding a PTRACE_SET_SYSCALL request, like we have for arch/arm/, but that means adding arch-specific stuff to arch_ptrace (which currently goes straight to ptrace_request on arm64). It looks like x86 uses orig_ax, which I *think* means we would go with (1) above if we followed their lead. Anybody else have an opinion about this? Will