From patchwork Mon May 14 17:14:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 135747 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2049825lji; Mon, 14 May 2018 10:15:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpxb0py8ZLjeHaiDwWNOSYqXjDnDt9gR3XcHOSR30X3C+nNLLCHjEMhc7zMhbSq2Xj+4vCj X-Received: by 2002:a17:902:20e5:: with SMTP id v34-v6mr10798100plg.127.1526318146379; Mon, 14 May 2018 10:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318146; cv=none; d=google.com; s=arc-20160816; b=Ua2vAfIZlh1bUzgOt509dpGZ8wE/jOGExUa0tf5MNqLle5MvFB6VtXCWDO00cK3OSv dwWsXDfszkQAgBRrMfEW1FrWgAmv27ykasIk9N4AXHgg6YNYUPdkQ5tLtnTZkwaO21ag zu+EPD2r8Pi85b6NnjM8RvrMlJXloVTXZi1WUNc95B1wK+zidoxQ9ZrCHOpQzsr4suCf 0XYmGo99ZcMSAzsLgia2zuYtQ+0qaxKGi0cdD7M2LTZxqNKqM11hDZOQYhaAr4Yq/Sux U9ulQCeI3HM7touqr+tZaQmG+QLQw9ENTaXJ0dv6AKsxrOfT2DLTErNhdyjkw1vdijR4 3+DA== 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=ojGifDF5p4qJZMcRYXsx98pJ/O01Q5y8AWzXN0AKJ1Y=; b=HBm3lA6pKaHdZuMG1sxkeuouxo9OS6280YbCqFeWZaIqFHL0mUggtZi9bRJ9I4Dhls qqD05yt1HvkJh341834Tl8Kt/sT/RqjOe4jQCmwMMKxs4zNy5JvIIn/ImgxAN8Rndydz xUpstUgkKl5HHLirMcHeR8u2MEkh35+AszWXthgZg7MJSEbNloTaQycvhb6E1jVvv2ue mpzWxWRtEWyd5V/BOilAmYvZTPNvs0kiKoEkf1vmDd3KfZnlTS9ooF5938UbtoRZILD9 KbBEGPB6FBvzRdix0AoKJ2UIGHT4AJ9sv3EEOfBnTxo7SCT/SQXEFEpFwkqXKz55ksLP m9Gw== 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 w17-v6si10028329plq.115.2018.05.14.10.15.46; Mon, 14 May 2018 10:15:46 -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 S1754211AbeENRPn (ORCPT + 29 others); Mon, 14 May 2018 13:15:43 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47022 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754177AbeENRPh (ORCPT ); Mon, 14 May 2018 13:15:37 -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 E5299165C; Mon, 14 May 2018 10:15:36 -0700 (PDT) Received: from e103592.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 8D5D23F59F; Mon, 14 May 2018 10:15:34 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Kees Cook , Andrew Morton , Ingo Molnar , Richard Henderson , Ivan Kokshaysky , Matt Turner , Tony Luck , Fenghua Yu , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Yoshinori Sato , Rich Felker Subject: [RFC PATCH 10/11] prctl: Remove redundant task argument from PR_{SET, GET}_UNALIGN backends Date: Mon, 14 May 2018 18:14:26 +0100 Message-Id: <1526318067-4964-11-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1526318067-4964-1-git-send-email-Dave.Martin@arm.com> References: <1526318067-4964-1-git-send-email-Dave.Martin@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Architecture backends for the PT_SET_UNALIGN and PR_GET_UNALIGN prctl() calls take a task argument that is redundant, since the only thing ever passed is "current". This patch gets rid of the redundant arguments. No functional change. Signed-off-by: Dave Martin Cc: Kees Cook Cc: Andrew Morton Cc: Ingo Molnar Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Tony Luck Cc: Fenghua Yu Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Yoshinori Sato Cc: Rich Felker --- arch/alpha/include/asm/thread_info.h | 10 +++++----- arch/ia64/include/asm/processor.h | 8 ++++---- arch/parisc/include/asm/processor.h | 8 ++++---- arch/powerpc/include/asm/processor.h | 8 ++++---- arch/powerpc/kernel/process.c | 8 ++++---- arch/sh/include/asm/processor.h | 8 ++++---- arch/sh/mm/alignment.c | 10 +++++----- kernel/sys.c | 8 ++++---- 8 files changed, 34 insertions(+), 34 deletions(-) -- 2.1.4 diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h index 807d7b9..403b3c8 100644 --- a/arch/alpha/include/asm/thread_info.h +++ b/arch/alpha/include/asm/thread_info.h @@ -85,19 +85,19 @@ register struct thread_info *__current_thread_info __asm__("$8"); #define TS_UAC_NOFIX 0x0002 /* ! flags as they match */ #define TS_UAC_SIGBUS 0x0004 /* ! userspace part of 'osf_sysinfo' */ -#define SET_UNALIGN_CTL(task,value) ({ \ - __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \ +#define SET_UNALIGN_CTL(value) ({ \ + __u32 status = current_thread_info()->status & ~UAC_BITMASK; \ if (value & PR_UNALIGN_NOPRINT) \ status |= TS_UAC_NOPRINT; \ if (value & PR_UNALIGN_SIGBUS) \ status |= TS_UAC_SIGBUS; \ if (value & 4) /* alpha-specific */ \ status |= TS_UAC_NOFIX; \ - task_thread_info(task)->status = status; \ + current_thread_info()->status = status; \ 0; }) -#define GET_UNALIGN_CTL(task,value) ({ \ - __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \ +#define GET_UNALIGN_CTL(value) ({ \ + __u32 status = current_thread_info()->status & ~UAC_BITMASK; \ __u32 res = 0; \ if (status & TS_UAC_NOPRINT) \ res |= PR_UNALIGN_NOPRINT; \ diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h index e40242e..8d5184f 100644 --- a/arch/ia64/include/asm/processor.h +++ b/arch/ia64/include/asm/processor.h @@ -247,15 +247,15 @@ typedef struct { unsigned long seg; } mm_segment_t; -#define SET_UNALIGN_CTL(task,value) \ +#define SET_UNALIGN_CTL(value) \ ({ \ - (task)->thread.flags = (((task)->thread.flags & ~IA64_THREAD_UAC_MASK) \ + current->thread.flags = ((current->thread.flags & ~IA64_THREAD_UAC_MASK) \ | (((value) << IA64_THREAD_UAC_SHIFT) & IA64_THREAD_UAC_MASK)); \ 0; \ }) -#define GET_UNALIGN_CTL(task,addr) \ +#define GET_UNALIGN_CTL(addr) \ ({ \ - put_user(((task)->thread.flags & IA64_THREAD_UAC_MASK) >> IA64_THREAD_UAC_SHIFT, \ + put_user((current->thread.flags & IA64_THREAD_UAC_MASK) >> IA64_THREAD_UAC_SHIFT, \ (int __user *) (addr)); \ }) diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h index 2dbe558..b59720f 100644 --- a/arch/parisc/include/asm/processor.h +++ b/arch/parisc/include/asm/processor.h @@ -139,17 +139,17 @@ struct thread_struct { #define PARISC_UAC_SHIFT 0 #define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS) -#define SET_UNALIGN_CTL(task,value) \ +#define SET_UNALIGN_CTL(value) \ ({ \ - (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \ + current->thread.flags = ((current->thread.flags & ~PARISC_UAC_MASK) \ | (((value) << PARISC_UAC_SHIFT) & \ PARISC_UAC_MASK)); \ 0; \ }) -#define GET_UNALIGN_CTL(task,addr) \ +#define GET_UNALIGN_CTL(addr) \ ({ \ - put_user(((task)->thread.flags & PARISC_UAC_MASK) \ + put_user((current->thread.flags & PARISC_UAC_MASK) \ >> PARISC_UAC_SHIFT, (int __user *) (addr)); \ }) diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index e1cd7ec..b8d9306 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -413,11 +413,11 @@ extern int set_fpexc_mode(unsigned int val); extern int get_endian(unsigned long adr); extern int set_endian(unsigned int val); -#define GET_UNALIGN_CTL(tsk, adr) get_unalign_ctl((tsk), (adr)) -#define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val)) +#define GET_UNALIGN_CTL(adr) get_unalign_ctl((adr)) +#define SET_UNALIGN_CTL(val) set_unalign_ctl((val)) -extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr); -extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val); +extern int get_unalign_ctl(unsigned long adr); +extern int set_unalign_ctl(unsigned int val); extern void load_fp_state(struct thread_fp_state *fp); extern void store_fp_state(struct thread_fp_state *fp); diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 0fcb2f5..17708b7 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -2020,15 +2020,15 @@ int get_endian(unsigned long adr) return put_user(val, (unsigned int __user *)adr); } -int set_unalign_ctl(struct task_struct *tsk, unsigned int val) +int set_unalign_ctl(unsigned int val) { - tsk->thread.align_ctl = val; + current->thread.align_ctl = val; return 0; } -int get_unalign_ctl(struct task_struct *tsk, unsigned long adr) +int get_unalign_ctl(unsigned long adr) { - return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); + return put_user(current->thread.align_ctl, (unsigned int __user *)adr); } static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h index 6fbf8c8..ce3d9f6 100644 --- a/arch/sh/include/asm/processor.h +++ b/arch/sh/include/asm/processor.h @@ -117,11 +117,11 @@ extern void free_thread_xstate(struct task_struct *); extern struct kmem_cache *task_xstate_cachep; /* arch/sh/mm/alignment.c */ -extern int get_unalign_ctl(struct task_struct *, unsigned long addr); -extern int set_unalign_ctl(struct task_struct *, unsigned int val); +extern int get_unalign_ctl(unsigned long addr); +extern int set_unalign_ctl(unsigned int val); -#define GET_UNALIGN_CTL(tsk, addr) get_unalign_ctl((tsk), (addr)) -#define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val)) +#define GET_UNALIGN_CTL(addr) get_unalign_ctl((addr)) +#define SET_UNALIGN_CTL(val) set_unalign_ctl((val)) /* arch/sh/mm/init.c */ extern unsigned int mem_init_done; diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c index ec2b253..bad2a31 100644 --- a/arch/sh/mm/alignment.c +++ b/arch/sh/mm/alignment.c @@ -80,16 +80,16 @@ unsigned int unaligned_user_action(void) return action; } -int get_unalign_ctl(struct task_struct *tsk, unsigned long addr) +int get_unalign_ctl(unsigned long addr) { - return put_user(tsk->thread.flags & SH_THREAD_UAC_MASK, + return put_user(current->thread.flags & SH_THREAD_UAC_MASK, (unsigned int __user *)addr); } -int set_unalign_ctl(struct task_struct *tsk, unsigned int val) +int set_unalign_ctl(unsigned int val) { - tsk->thread.flags = (tsk->thread.flags & ~SH_THREAD_UAC_MASK) | - (val & SH_THREAD_UAC_MASK); + current->thread.flags = (current->thread.flags & ~SH_THREAD_UAC_MASK) | + (val & SH_THREAD_UAC_MASK); return 0; } diff --git a/kernel/sys.c b/kernel/sys.c index 8111c0d..47cf999 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -72,10 +72,10 @@ #include "uid16.h" #ifndef SET_UNALIGN_CTL -# define SET_UNALIGN_CTL(a, b) (-EINVAL) +# define SET_UNALIGN_CTL(a) (-EINVAL) #endif #ifndef GET_UNALIGN_CTL -# define GET_UNALIGN_CTL(a, b) (-EINVAL) +# define GET_UNALIGN_CTL(a) (-EINVAL) #endif /* @@ -2235,10 +2235,10 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, break; case PR_SET_UNALIGN: - error = SET_UNALIGN_CTL(me, arg2); + error = SET_UNALIGN_CTL(arg2); break; case PR_GET_UNALIGN: - error = GET_UNALIGN_CTL(me, arg2); + error = GET_UNALIGN_CTL(arg2); break; case PR_GET_TIMING: error = PR_TIMING_STATISTICAL;