Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp129959imu; Thu, 3 Jan 2019 15:41:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6AtoCkLtQjaNzszFLUQH8yr6kE4xXlXq8QfAtlJFgaGCTyoRknCqZH/flWDeAHwVBrmmPp X-Received: by 2002:a17:902:82c2:: with SMTP id u2mr48765361plz.110.1546558899096; Thu, 03 Jan 2019 15:41:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546558899; cv=none; d=google.com; s=arc-20160816; b=XkoRALkP37SklyfW+pnL8Cm0PVjyJpodHhnk8/Wi6ZyQSAoFQh27BBU+HVR4t2fjgl 2RwDx1cQ/lkooW63DrtKIWhJfjc/0Y4sCHFRpWBl8lafOhJfU8nDV1P0Fu2Z+qcGTUNo Hiu6vdMcDcL2AyI9/P1D1f1FgWaHEXEK1B8UoXGoWWNmNoJBE3V5E2LrdotNeuuTE+Mc Gm8jD76H5uJI2h9s4knfHh0w9XeqEw//hBKhukSYzlQgkUSDhSYfhpUwZu3Fh/lNqYJD 5FQc4JB/aG81GYKwJ/fcwFIjryEn0OrGnHVlrrFmr+wVVbhPOmTnva7uyhyAbg1PiRj7 Rt8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xZnofLQwAnDN7TAdvBGbzrOjlh1ECqC95KqkDdhtYCg=; b=CR6KJOjADcSOLK3ZECf8ZkH/jmpEAgbSZflB2b8uAnBO8kQ4/WLCy3L+EQgr0u0NXF E/L+xAU0S17wf3GRMbft3S54Tj6xrhihRhcUO86gRvJWe+ctFCK80oXMkDq5XEj4aQCT NXmrTMruxBRTUDhdTeuo/WYxRXRByZDYnZww+gfmQ5r1TjeSuR4wrdokyT7tobJ3nMb5 6kY92H0AD/7A1juRFN0+RXYxdGDqivKFhuhWULJCrwPNJ/jyqaHEChDwsb6IdZf8WsLT dZzj+UeUkuCQooDdxtFBtVEBOyMtFgnMkFQnJj4ApDsS1Xzl8UkOFwJGNj+LKNSl1Mv2 0oUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e66si13985340plb.107.2019.01.03.15.41.24; Thu, 03 Jan 2019 15:41:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731980AbfACRws (ORCPT + 99 others); Thu, 3 Jan 2019 12:52:48 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54030 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728424AbfACRwr (ORCPT ); Thu, 3 Jan 2019 12:52:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 23DD715AD; Thu, 3 Jan 2019 09:52:47 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E4D823F5D4; Thu, 3 Jan 2019 09:52:46 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 210571AE0BD1; Thu, 3 Jan 2019 17:52:47 +0000 (GMT) Date: Thu, 3 Jan 2019 17:52:47 +0000 From: Will Deacon To: Dave Martin Cc: Pi-Hsun Shih , Mark Rutland , Catalin Marinas , open list , Dominik Brodowski , "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" Subject: Re: [PATCH] arm64: Mirror arm for small unimplemented compat syscalls Message-ID: <20190103175246.GB10221@edgewater-inn.cambridge.arm.com> References: <20190103074550.217421-1-pihsun@chromium.org> <20190103114959.GA3529@e103592.cambridge.arm.com> <20190103165144.GA10221@edgewater-inn.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190103165144.GA10221@edgewater-inn.cambridge.arm.com> User-Agent: Mutt/1.11.1+30 (d10eec459b35) () Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 03, 2019 at 04:51:44PM +0000, Will Deacon wrote: > On Thu, Jan 03, 2019 at 11:50:12AM +0000, Dave Martin wrote: > > On Thu, Jan 03, 2019 at 03:45:47PM +0800, Pi-Hsun Shih wrote: > > > For syscall number smaller than 0xf0000, arm calls sys_ni_syscall > > > instead of arm_syscall in arch/arm/kernel/entry-common.S, which returns > > > -ENOSYS instead of raising SIGILL. Mirror this behavior for compat > > > syscalls in arm64. > > > > > > Fixes: 532826f3712b607 ("arm64: Mirror arm for unimplemented compat > > > syscalls") > > > Signed-off-by: Pi-Hsun Shih > > > --- > > > arch/arm64/kernel/syscall.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c > > > index 8f3371415642ad..95fd8c7ec8a171 100644 > > > --- a/arch/arm64/kernel/syscall.c > > > +++ b/arch/arm64/kernel/syscall.c > > > @@ -21,7 +21,7 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs) > > > { > > > #ifdef CONFIG_COMPAT > > > long ret; > > > - if (is_compat_task()) { > > > + if (is_compat_task() && regs->regs[7] >= __ARM_NR_COMPAT_BASE) { > > > > compat_arm_syscall() ignores all bits r7 except for bits [15:0]. > > > > So, doesn't this mean that 0xf0000, 0x100000, 0x110000 will all do the > > same thing now? (Previously to your patch, 0xe0000, 0xd0000 etc. would > > also match in this code I've misunderstood something.) > > > > The gating check in arch/arm/kernel/trapc.s:arm_syscall() is > > > > if ((no >> 16) != (__ARM_NR_BASE>> 16)) > > > > I would expect that arm64 needs a similar check somewhere. Is the check > > already present? I may have missed it. > > When not using OABI, __ARM_NR_BASE is zero, so I think the 32-bit semantics > for non-OABI are: > > 0 - 399 : Invoke syscall via syscall table > 400 - 0xeffff : -ENOSYS (to be allocated in future) > 0xf0000 - 0xfffff : Private syscall or -ENOSYS if not allocated > > 0xfffff : SIGILL Bah, 0xfffff should be 0xf07ff in the last two lines here. Will