Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp122891imu; Thu, 3 Jan 2019 15:30:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ws0GCbwWA4Sv7Fhuobwq88hrLC7FzCG+McUI2vPAfi9+NlFxiQ/08mHFHqzdvjjaCLeD8 X-Received: by 2002:a17:902:4124:: with SMTP id e33mr48475024pld.236.1546558242739; Thu, 03 Jan 2019 15:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546558242; cv=none; d=google.com; s=arc-20160816; b=sIJQVDGaZaUL3xkqyVexO75Wff98M2bhNV0Nz6cUOnCLrvFPmyP+2u95ejFOIYwDfG rU5/NK7sqhhptHmGqKSgla++uU35XxuxQCUbRo89w0qbdB8rkNoVItSh8RCAngfFIBBx f+hJztfYHunzJMaz/sjTmHjz89Ioij+0HingRmYow0rGkbSjiFeUkcKZBxZhV47CmPNt 75whTaX3tcu38ytz8KupAOx7/f0QI4c2NKav5NGoayPE2tYKELaoyncZVJ/lBzslIdA4 qJeiTBFAqnPzWiooQlegT+swpuEHWhwWL0+SmieDAy3HK0aJZlEHrGqGnYV83euqGdcS SAsw== 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=UAzrg0v6H2qNwqKkWpilDmOS3u5lgLdW5dw0Y1q568Q=; b=i9jCjtSnMmFqJDo/KDwBfKVgoH23qdXMhXqTuR0/gKqaK7chb0enW5/HMCDmk+/E9U oWILIFAXlo9ljr7h0pmZCgbSjpPrB0CQk1lUTDC1GQtpovP5DfKI9G4x7LXi6iis6gDc tksU4gdB+0cHnMkGxXkhxQZbxdINQKvrT9FxWnV/ingoAgHkc0npff3aJ1X8KAC+tFyQ hbexfaY1llvlVzBfUBCHWRaxkfMo2fxxW+Isn+2qgKxXx5MIGimX0ha88+prugQk0F+W anzmOTyfD4AocLw0oMKc2tyJ5p26YhORzfnB8ytyZ/fMgHqK4cox57ySftKH9iJdQ1mN XZGA== 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 133si5211472pfw.64.2019.01.03.15.30.27; Thu, 03 Jan 2019 15:30:42 -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 S1731157AbfACQvp (ORCPT + 99 others); Thu, 3 Jan 2019 11:51:45 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53014 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730564AbfACQvo (ORCPT ); Thu, 3 Jan 2019 11:51:44 -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 67D1115AD; Thu, 3 Jan 2019 08:51:44 -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 351063F5D4; Thu, 3 Jan 2019 08:51:44 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 633721AE1799; Thu, 3 Jan 2019 16:51:44 +0000 (GMT) Date: Thu, 3 Jan 2019 16:51:44 +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: <20190103165144.GA10221@edgewater-inn.cambridge.arm.com> References: <20190103074550.217421-1-pihsun@chromium.org> <20190103114959.GA3529@e103592.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190103114959.GA3529@e103592.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 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 so for arm64 compat, we need to do the following: 1. Ensure we only SIGILL for that last region 2. Don't pull the syscall number directly from pt_regs, since it may have been changed by a tracer 3. Hook up compat_sys_io_pgetevents Patches incoming... Will