From patchwork Mon May 14 09:46:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 135717 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1534650lji; Mon, 14 May 2018 02:50:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpG64Oswri5TFlq8F1145uGKNBExpvoW6cEHwA2oVfV7LsbczTtDvIIM0x/s7NZjs45Wxj3 X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr8924736plt.162.1526291448312; Mon, 14 May 2018 02:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526291448; cv=none; d=google.com; s=arc-20160816; b=j+szHq5lvr/nR30G5Uw3a1W4RCRyrLBC8CzsljWZKnzjPONyW5/hvpznopjdnfgK+U Rw1XjLRPf4grAsueCzwVxSTwxlEEbfT6vUMe65LKdBbPXjNz2lw+kJXguy3OEXIza/op Y50CObjvj5ni7QYBJLwaidSWq100LRO0QzpSW9d1KlUpl3uEZwiYJGePMY8ZjHIDU+6P zwVVYVgK9dF3NQsJ2VO/t9F6RYI/4MC7IHeCl9++WG1IG/CjFZZcfVd8zwkP4SMnlI44 4E4Y8oLW9syd46isO8T4sIjyIBR5FNBiyLOPr9CTYFblB2FBydkiuCf7TPiZSAIYVy2l Oggg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=erxRZcdY1UuR+r6SNI72qvmIfM8ccVC8jD32eLJticU=; b=Wgpk3IdiUC++NawHjMZAAsVWwokwa8vOYu1Wyv6ABGLo8P33jcKh0DDIYF0W2dAzno aIxxXDcmXGmrhcP8lwPx5h2g/Px7OwI72rrxKKDKmidX9kAyhjFuR8BFVwrMhdJ7ovfE zQ+JMT6zAG6Rwxx8DzDqF4QcFx6EqGZWTdaEjJazykSden6E4uKVMaRV6XPgNzsqwV7X lJCfSNQJOQhjpoCZYuUMYWgMp2xJFXAsCQ/slTI4VSake+JvYTxZwcqO/IJ8qajFTRhV AVpDmDbD+dbbbi0VjhCOu4tKifJtPbES3uLH+/B86kohrHdqr0KgbbMWyTlk8ucjeTEx bu7A== 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 g72-v6si10161501pfb.280.2018.05.14.02.50.48; Mon, 14 May 2018 02:50:48 -0700 (PDT) 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 S1752706AbeENJuo (ORCPT + 29 others); Mon, 14 May 2018 05:50:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38320 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbeENJrx (ORCPT ); Mon, 14 May 2018 05:47:53 -0400 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 40DB21991; Mon, 14 May 2018 02:47:53 -0700 (PDT) Received: from lakrids.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 53E6E3F25D; Mon, 14 May 2018 02:47:51 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, dave.martin@arm.com, james.morse@arm.com, linux@dominikbrodowski.net, linux-fsdevel@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, viro@zeniv.linux.org.uk, will.deacon@arm.com Subject: [PATCH 12/18] kernel: add ksys_personality() Date: Mon, 14 May 2018 10:46:34 +0100 Message-Id: <20180514094640.27569-13-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180514094640.27569-1-mark.rutland@arm.com> References: <20180514094640.27569-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using this helper allows us to avoid the in-kernel call to the sys_personality() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_personality(). This is necessary to enable conversion of arm64's syscall handling to use pt_regs wrappers. Signed-off-by: Mark Rutland Cc: Al Viro Cc: Dominik Brodowski --- include/linux/syscalls.h | 1 + kernel/exec_domain.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) -- 2.11.0 Reviewed-by: Dave Martin diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 70fcda1a9049..6723ea51ec99 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -1148,6 +1148,7 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff); ssize_t ksys_readahead(int fd, loff_t offset, size_t count); +unsigned int ksys_personality(unsigned int personality); /* * The following kernel syscall equivalents are just wrappers to fs-internal diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index a5697119290e..4ba2b404cba2 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c @@ -47,7 +47,7 @@ static int __init proc_execdomains_init(void) module_init(proc_execdomains_init); #endif -SYSCALL_DEFINE1(personality, unsigned int, personality) +unsigned int ksys_personality(unsigned int personality) { unsigned int old = current->personality; @@ -56,3 +56,8 @@ SYSCALL_DEFINE1(personality, unsigned int, personality) return old; } + +SYSCALL_DEFINE1(personality, unsigned int, personality) +{ + return ksys_personality(personality); +}