From patchwork Wed Oct 19 08:55:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 5350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp296182wrs; Wed, 19 Oct 2022 05:27:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5j3uLDBYUf2FrxF4EO5emQPS+0Gge3oxysUBfALqgg9zbXmku4mUlpJC9FndSfrk2z9CAA X-Received: by 2002:a62:5202:0:b0:562:d28e:f715 with SMTP id g2-20020a625202000000b00562d28ef715mr8405497pfb.26.1666182426998; Wed, 19 Oct 2022 05:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182426; cv=none; d=google.com; s=arc-20160816; b=JzoDpUgUaHPUA08T2My5gX5R+L6W+I6/eTgNA/7akFlpwShJ2+OUtfVNS4RTZwaR6f V9DotW/0EPdAvAtg1uAebjKNOFZcAGVwpW/G73W0AlCJCFNp72XygZeBKpG7t1RpYyQQ +ikDx9k5FgCAGXLZ4bBnba/mzdTJqbc0R7uvgmFmefH+xC6/FgjNU0/3wiq2Us3k0A8L J++hFFxWvQPPp9DCYcNyfJv7jVFP5akxD9pbBUCSjcsc5di1Qi33qc93kOrMZN6Mckr5 hmfMH2lk94B+9CqFXygRV7fwsufxnZYWkN/Bgja7/ORNz7jI3sDKcKh2kyKzONLwrZWH Zscw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=OQ5DMmbfHzNYcXPZAhtE/eVm3dkudM99QWV4vaM1NtA=; b=V0PvYmr8U7e1OcJiPEep9J7B5FY3d1VHA5bGJM4Db0u55i/LYOSRU+gWgGzR7O0Fxy uT2148p9O6H6Wv2IHpxwYX55UZ3mxx6qoz9p5pgCmg144WYtOEdEMJPR6kamUjx8dwhS zT3KzAoNEIrXMiocn+P5q/HbfQyE/pUlnrEb9l7VQX5W2aThvejXxWQpxn6IdIB7UEkR OA5USdrFV/tzfBlTMgvuSdJJDr5l4bqNib8eBwb209wUn1CClk2wAwQIVTdmJQ0M4OQo O9lvq+PThZ+UrkHIC2MW/FL2pl0MCV9eUjedAg9iTuncuJsCNYX4uDm/vR9psn8chxEw OkzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QylOY3gz; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a170902c94d00b0017bcea4e6b6si19413271pla.234.2022.10.19.05.26.43; Wed, 19 Oct 2022 05:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QylOY3gz; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232828AbiJSMPT (ORCPT + 99 others); Wed, 19 Oct 2022 08:15:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233158AbiJSMOS (ORCPT ); Wed, 19 Oct 2022 08:14:18 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B741C2EA1; Wed, 19 Oct 2022 04:50:57 -0700 (PDT) Date: Wed, 19 Oct 2022 08:55:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666169751; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OQ5DMmbfHzNYcXPZAhtE/eVm3dkudM99QWV4vaM1NtA=; b=QylOY3gzUnX4OaR5VsL7q8WNt4TkjzzCjH/0nGHs5XTMHFVpFj8tEFfKo0u291vLDxww2z 6dd0y5pcnjNztySpMhaJB1et58/AWRxRvh2hTnQd0l4ZDsD5vMAJjSQSHkw28ZRuEXUtDd O7hF/jyr8Leth99LuTmDbNR2aHDgfjigMl2aRfmvDxlek10sogxo0WW0aGSaHe3V6Jja38 BYyBziZ80W20stuBLM3eCNL2kXDZiX4OKvgYiwuhgRx962fZbs0VtX4CwUfldYo6RxkUU4 Kn1LGnifVLM0Vjm2Ujom/m7UWBApgCo67nAkiQ+8t7qJIpI8cB/OPjtPYQdOWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666169751; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OQ5DMmbfHzNYcXPZAhtE/eVm3dkudM99QWV4vaM1NtA=; b=jG6um6GjEY6NS35mSe0Yc5e6epXDaYYZFk56h5Lj38TV6lelWNeM4FcDRVRVOyjad8N/2f hLupGzUIXNt7YUBw== From: "tip-bot2 for Brian Gerst" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/misc] x86/signal: Remove sig parameter from frame setup functions Cc: Brian Gerst , Borislav Petkov , "Eric W. Biederman" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220606203802.158958-2-brgerst@gmail.com> References: <20220606203802.158958-2-brgerst@gmail.com> MIME-Version: 1.0 Message-ID: <166616975030.401.1631367477728769611.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118904231952988?= X-GMAIL-MSGID: =?utf-8?q?1747118904231952988?= The following commit has been merged into the x86/misc branch of tip: Commit-ID: 8bb2d28e2b92ef220e82369ff31a22f39831cf2f Gitweb: https://git.kernel.org/tip/8bb2d28e2b92ef220e82369ff31a22f39831cf2f Author: Brian Gerst AuthorDate: Mon, 06 Jun 2022 16:37:55 -04:00 Committer: Borislav Petkov CommitterDate: Wed, 19 Oct 2022 09:58:48 +02:00 x86/signal: Remove sig parameter from frame setup functions Passing the signal number as a separate parameter is unnecessary, since it is always ksig->sig. Signed-off-by: Brian Gerst Signed-off-by: Borislav Petkov Acked-by: "Eric W. Biederman" Link: https://lore.kernel.org/r/20220606203802.158958-2-brgerst@gmail.com Signed-off-by: Borislav Petkov --- arch/x86/ia32/ia32_signal.c | 12 ++++++------ arch/x86/include/asm/fpu/signal.h | 4 ++-- arch/x86/kernel/signal.c | 23 +++++++++++------------ 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index c9c3859..390347a 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c @@ -230,7 +230,7 @@ static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, return (void __user *) sp; } -int ia32_setup_frame(int sig, struct ksignal *ksig, +int ia32_setup_frame(struct ksignal *ksig, compat_sigset_t *set, struct pt_regs *regs) { struct sigframe_ia32 __user *frame; @@ -264,7 +264,7 @@ int ia32_setup_frame(int sig, struct ksignal *ksig, if (!user_access_begin(frame, sizeof(*frame))) return -EFAULT; - unsafe_put_user(sig, &frame->sig, Efault); + unsafe_put_user(ksig->sig, &frame->sig, Efault); unsafe_put_sigcontext32(&frame->sc, fp, regs, set, Efault); unsafe_put_user(set->sig[1], &frame->extramask[0], Efault); unsafe_put_user(ptr_to_compat(restorer), &frame->pretcode, Efault); @@ -280,7 +280,7 @@ int ia32_setup_frame(int sig, struct ksignal *ksig, regs->ip = (unsigned long) ksig->ka.sa.sa_handler; /* Make -mregparm=3 work */ - regs->ax = sig; + regs->ax = ksig->sig; regs->dx = 0; regs->cx = 0; @@ -296,7 +296,7 @@ Efault: return -EFAULT; } -int ia32_setup_rt_frame(int sig, struct ksignal *ksig, +int ia32_setup_rt_frame(struct ksignal *ksig, compat_sigset_t *set, struct pt_regs *regs) { struct rt_sigframe_ia32 __user *frame; @@ -321,7 +321,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig, if (!user_access_begin(frame, sizeof(*frame))) return -EFAULT; - unsafe_put_user(sig, &frame->sig, Efault); + unsafe_put_user(ksig->sig, &frame->sig, Efault); unsafe_put_user(ptr_to_compat(&frame->info), &frame->pinfo, Efault); unsafe_put_user(ptr_to_compat(&frame->uc), &frame->puc, Efault); @@ -357,7 +357,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig, regs->ip = (unsigned long) ksig->ka.sa.sa_handler; /* Make -mregparm=3 work */ - regs->ax = sig; + regs->ax = ksig->sig; regs->dx = (unsigned long) &frame->info; regs->cx = (unsigned long) &frame->uc; diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h index e1c9df9..08826ad 100644 --- a/arch/x86/include/asm/fpu/signal.h +++ b/arch/x86/include/asm/fpu/signal.h @@ -14,9 +14,9 @@ # include # include struct ksignal; -int ia32_setup_rt_frame(int sig, struct ksignal *ksig, +int ia32_setup_rt_frame(struct ksignal *ksig, compat_sigset_t *set, struct pt_regs *regs); -int ia32_setup_frame(int sig, struct ksignal *ksig, +int ia32_setup_frame(struct ksignal *ksig, compat_sigset_t *set, struct pt_regs *regs); #else # define user_i387_ia32_struct user_i387_struct diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 9c7265b..40b1373 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c @@ -324,7 +324,7 @@ static const struct { }; static int -__setup_frame(int sig, struct ksignal *ksig, sigset_t *set, +__setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { struct sigframe __user *frame; @@ -336,7 +336,7 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set, if (!user_access_begin(frame, sizeof(*frame))) return -EFAULT; - unsafe_put_user(sig, &frame->sig, Efault); + unsafe_put_user(ksig->sig, &frame->sig, Efault); unsafe_put_sigcontext(&frame->sc, fp, regs, set, Efault); unsafe_put_user(set->sig[1], &frame->extramask[0], Efault); if (current->mm->context.vdso) @@ -363,7 +363,7 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set, /* Set up registers for signal handler */ regs->sp = (unsigned long)frame; regs->ip = (unsigned long)ksig->ka.sa.sa_handler; - regs->ax = (unsigned long)sig; + regs->ax = (unsigned long)ksig->sig; regs->dx = 0; regs->cx = 0; @@ -379,7 +379,7 @@ Efault: return -EFAULT; } -static int __setup_rt_frame(int sig, struct ksignal *ksig, +static int __setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { struct rt_sigframe __user *frame; @@ -391,7 +391,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, if (!user_access_begin(frame, sizeof(*frame))) return -EFAULT; - unsafe_put_user(sig, &frame->sig, Efault); + unsafe_put_user(ksig->sig, &frame->sig, Efault); unsafe_put_user(&frame->info, &frame->pinfo, Efault); unsafe_put_user(&frame->uc, &frame->puc, Efault); @@ -428,7 +428,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, /* Set up registers for signal handler */ regs->sp = (unsigned long)frame; regs->ip = (unsigned long)ksig->ka.sa.sa_handler; - regs->ax = (unsigned long)sig; + regs->ax = (unsigned long)ksig->sig; regs->dx = (unsigned long)&frame->info; regs->cx = (unsigned long)&frame->uc; @@ -458,7 +458,7 @@ static unsigned long frame_uc_flags(struct pt_regs *regs) return flags; } -static int __setup_rt_frame(int sig, struct ksignal *ksig, +static int __setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { struct rt_sigframe __user *frame; @@ -493,7 +493,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, } /* Set up registers for signal handler */ - regs->di = sig; + regs->di = ksig->sig; /* In case the signal handler was declared without prototypes */ regs->ax = 0; @@ -763,7 +763,6 @@ static inline int is_x32_frame(struct ksignal *ksig) static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs) { - int usig = ksig->sig; sigset_t *set = sigmask_to_save(); compat_sigset_t *cset = (compat_sigset_t *) set; @@ -773,13 +772,13 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs) /* Set up the stack frame */ if (is_ia32_frame(ksig)) { if (ksig->ka.sa.sa_flags & SA_SIGINFO) - return ia32_setup_rt_frame(usig, ksig, cset, regs); + return ia32_setup_rt_frame(ksig, cset, regs); else - return ia32_setup_frame(usig, ksig, cset, regs); + return ia32_setup_frame(ksig, cset, regs); } else if (is_x32_frame(ksig)) { return x32_setup_rt_frame(ksig, cset, regs); } else { - return __setup_rt_frame(ksig->sig, ksig, set, regs); + return __setup_rt_frame(ksig, set, regs); } }