From patchwork Sat Oct 29 23:18:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1548362wru; Sat, 29 Oct 2022 16:19:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MDUVQ8sr8C72zxwue+ewgzz0zfX9xByTEC5WvGiTB4Xq2RJHM5uzZyUR1YhUidIWcAFIh X-Received: by 2002:a17:906:847b:b0:7a6:2ad9:298 with SMTP id hx27-20020a170906847b00b007a62ad90298mr5577483ejc.90.1667085585092; Sat, 29 Oct 2022 16:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085585; cv=none; d=google.com; s=arc-20160816; b=ONV73Pe9ztoTL90yNMHoGiLu9ZcCb9Pn9rNrJg/lHxuI9ZwiWvdCX0Ci0TLyhJ7XBv uXggTmBFnxhtuvhe7RVVCQILXYpYeiIvlyGLz8+TjcxBmFcJFsO5bGMUN7IJorNHwZ7y Lj0OO+P+w60S5H49Wv7F+77cD/5SNn2YIUXAeThXx42fLBqkaRyA8HD3qTD2PrscN2cQ f+2jIM4uwAxYuYPHP5IJYQBGLj5bZ4zarPUJZF6Hg5KZKL2RXv5VcADgYZyYFVztlf3V 73MrN0ihRfIY4lNxGjDU3u/lD1u0MX49drJ5VYemHmmm5mWGEgX8aHCMKAKDej0EGZdB RLPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=72jtzsfdBJvTgzNVU9mb5qNZZ75BLtKRZFZfbeGDBNg=; b=FLAX4AtiWjPS/bbY4NGChYt5EpmigxUjj2/Shu6UK6hOA0luNr729pd/HA79UBWUD8 9iDX3pKz0gxIVfVSAJdPmEmKH3JxynbKjs5erM8CCwFR21OhIju7ujCABH8mqHHlGjwo MlTWo+U4aHMxCGXNc8DCRy4htDNEoXx24tDwShPBVgQIpTNZTXCGRa8jpw5altfG/6HF J24bHQ9VdN59p33/al8GlsKPkfRwkl/8dG+ErMioaK7p1Y5EZZJPUSMk09kE60B7trKY b1rYJz2b6WazKPv4gULfOlJEz3Qae7OgIJa8gqG9OE4joqEvVeBXhHJzID8OvVpjwV3x +DuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=v8sMHHOM; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a170906974b00b00782933fe436si3112366ejy.965.2022.10.29.16.19.21; Sat, 29 Oct 2022 16:19:45 -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=@linux.org.uk header.s=zeniv-20220401 header.b=v8sMHHOM; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbiJ2XSz (ORCPT + 99 others); Sat, 29 Oct 2022 19:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiJ2XSx (ORCPT ); Sat, 29 Oct 2022 19:18:53 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A5B2F007; Sat, 29 Oct 2022 16:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=72jtzsfdBJvTgzNVU9mb5qNZZ75BLtKRZFZfbeGDBNg=; b=v8sMHHOMqaV+I7Og/bqdh3MjKC yJj9+SjgCHJGUS3+VwuR2Arofn5pLFRdNIH1hQWb1TihodaHKsqGaab0tIZLpGzTOEUvWXfXDSPtP dQPIydfpCRYbiVK131Z0N+yloDx83EK4YQIGLxF63KUhPSgJQK6z4zSHxpesShjTZ0oB+2nwP7Pfp 7Bm6YBXQX9GYvPGHYW3r7aiFai+kxtB23bZcEcztkpLPiEqPN/7XpljTGkYVDHcpmfg7nbhd0W5kG ofnmJZEv/yaOHzRYZOOgN3DmjVLSIor8PJmGrPUBEz4HSTpattmDyNkD40ThLPC0jwX2KbxIw74wn whjJ8mQw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6I-00FOKS-3D; Sat, 29 Oct 2022 23:18:51 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 01/10] kill signal_pt_regs() Date: Sun, 30 Oct 2022 00:18:41 +0100 Message-Id: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748065934483353500?= X-GMAIL-MSGID: =?utf-8?q?1748065934483353500?= Once upon at it was used on hot paths, but that had not been true since 2013. IOW, there's no point for arch-optimized equivalent of task_pt_regs(current) - remaining two users are not worth bothering with. Signed-off-by: Al Viro --- arch/alpha/include/asm/ptrace.h | 1 - fs/coredump.c | 2 +- include/linux/ptrace.h | 9 --------- kernel/signal.c | 2 +- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h index df5f317ab3fc..3557ce64ed21 100644 --- a/arch/alpha/include/asm/ptrace.h +++ b/arch/alpha/include/asm/ptrace.h @@ -16,7 +16,6 @@ #define current_pt_regs() \ ((struct pt_regs *) ((char *)current_thread_info() + 2*PAGE_SIZE) - 1) -#define signal_pt_regs current_pt_regs #define force_successful_syscall_return() (current_pt_regs()->r0 = 0) diff --git a/fs/coredump.c b/fs/coredump.c index 7bad7785e8e6..b4ec1bf889f9 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -525,7 +525,7 @@ void do_coredump(const kernel_siginfo_t *siginfo) static atomic_t core_dump_count = ATOMIC_INIT(0); struct coredump_params cprm = { .siginfo = siginfo, - .regs = signal_pt_regs(), + .regs = task_pt_regs(current), .limit = rlimit(RLIMIT_CORE), /* * We must use the same mm->flags while dumping core to avoid diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index c952c5ba8fab..eaaef3ffec22 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -389,15 +389,6 @@ static inline void user_single_step_report(struct pt_regs *regs) #define current_pt_regs() task_pt_regs(current) #endif -/* - * unlike current_pt_regs(), this one is equal to task_pt_regs(current) - * on *all* architectures; the only reason to have a per-arch definition - * is optimisation. - */ -#ifndef signal_pt_regs -#define signal_pt_regs() task_pt_regs(current) -#endif - #ifndef current_user_stack_pointer #define current_user_stack_pointer() user_stack_pointer(current_pt_regs()) #endif diff --git a/kernel/signal.c b/kernel/signal.c index d140672185a4..848d5c282d35 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1255,7 +1255,7 @@ int send_signal_locked(int sig, struct kernel_siginfo *info, static void print_fatal_signal(int signr) { - struct pt_regs *regs = signal_pt_regs(); + struct pt_regs *regs = task_pt_regs(current); pr_info("potentially unexpected fatal signal %d.\n", signr); #if defined(__i386__) && !defined(__arch_um__) From patchwork Sat Oct 29 23:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549096wru; Sat, 29 Oct 2022 16:21:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4z+hcoatRUb6jdGvePQ/Rlhteh5QZ2TCe8uQ2CiblAJIMxB9Xag6ddl0+4Kh8eQQe8Nh/4 X-Received: by 2002:a05:6402:1052:b0:459:2c49:1aed with SMTP id e18-20020a056402105200b004592c491aedmr6180214edu.212.1667085708715; Sat, 29 Oct 2022 16:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085708; cv=none; d=google.com; s=arc-20160816; b=ooovV81cZaBOgBdzF/yTsNib0JYnZ0vm/N94OmDV5GPaBkqTA4vEXX0SwxzkwPL/vC gzmDd/tTE76Ncgyu2uTb1N1uDeVW8W7HSsCibjvFfLYPRBbaWQVEPxya8P/+tsd/z5xo ugB+ZAkHf9L0UG1/TmZgS4wHpMVu/fV2LhhIbOgQUb2Pcv+A0Q8wyQCUSWRQB6MNXmXz 1zqkyS724gQbridpcHtYEC1VTn1MjUbMnhTNxrHyxmbCrNweKZLn+3XisBAMCwxSZ0l0 gr0ruZJqJ81RV+rNgV/r53QyJH9tQ9E5SN0oZPkhcmXveimc4an2WFrYUgGeGOAlPAKq diHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=es2LQZ+nRVoUgaLb53NmGXxokQxrFnpTsmJfGV37wCY=; b=BnsXczU0jJ0SjNYKxPOJy8ODQ2miVlmqmskGfkQ3WRECmp2JDMZaEKmk/27tepuYIJ LEbkY6kxlPRj6ozXsOOY2L2YiplQNOb7xjPRBabpOzQUD7n8HX7yDv8zNVeX6O3ZG907 RJdEhPrBVSRPK6d3JswVSi8n//0GOKzPxjq485RnPTQmo3I0tlLz+yYnA8fd/UT1zy3f aZ/lSL/rOXD/QijEubwDSHhLuhcqLZP8Ek8g2teQFswRFtilJFF+pRJ++8jGYEjxaFMp SSc0TDHoADwHemHHkpy+SAGat9J/O1rgRF631yPbFswO7fG1euY2bvoSyBevkiRZg5e8 9WOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=LnEzB0aR; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd13-20020a056402388d00b00460e1cc2d76si2760614edb.72.2022.10.29.16.21.24; Sat, 29 Oct 2022 16:21:48 -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=@linux.org.uk header.s=zeniv-20220401 header.b=LnEzB0aR; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229833AbiJ2XTA (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiJ2XSx (ORCPT ); Sat, 29 Oct 2022 19:18:53 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB632F008; Sat, 29 Oct 2022 16:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=es2LQZ+nRVoUgaLb53NmGXxokQxrFnpTsmJfGV37wCY=; b=LnEzB0aRSO3AFBfNlPrL2rJ1cr 6gOEM/JPvtzfSLMg6/4R6jEUvDcdFkmaXLOLIj6/aQtv/G3DNeOQAYgaHhO3F4LkwtfLrIKCc6FWp 4PsGQh/iBm67PGTxXoDMd1VRCf4gWpsIrU32doBkYpjdb8PIIpiEv6gyGmy32dNeDHuS8mDaJMrAE VWEuGgwh5JxAI5r0wYV8h4Brza3AXQFfP7zQXL09QeCyFW1Spzxng5v/vqwPtgepk3Jk803JnDZ4w 4ItyQp2E873GmkZ3ES4oGCZwHz7S5YCdL6jpKMS53dGxvPk/Kj97AHTSlGSuCVZwyX0aXsb5HLw6z 7BD+z8oA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6J-00FOKV-0p; Sat, 29 Oct 2022 23:18:51 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 02/10] kill coredump_params->regs Date: Sun, 30 Oct 2022 00:18:42 +0100 Message-Id: <20221029231850.3668437-2-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066064088413430?= X-GMAIL-MSGID: =?utf-8?q?1748066064088413430?= it's always task_pt_regs(current) Signed-off-by: Al Viro --- fs/binfmt_elf.c | 4 ++-- fs/coredump.c | 1 - include/linux/coredump.h | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 63c7ebb0da89..002fd713ac11 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -2082,7 +2082,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, /* now collect the dump for the current */ memset(info->prstatus, 0, sizeof(*info->prstatus)); fill_prstatus(&info->prstatus->common, current, cprm->siginfo->si_signo); - elf_core_copy_regs(&info->prstatus->pr_reg, cprm->regs); + elf_core_copy_regs(&info->prstatus->pr_reg, task_pt_regs(current)); /* Set up header */ fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); @@ -2109,7 +2109,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, /* Try to dump the FPU. */ info->prstatus->pr_fpvalid = - elf_core_copy_task_fpregs(current, cprm->regs, info->fpu); + elf_core_copy_task_fpregs(current, task_pt_regs(current), info->fpu); if (info->prstatus->pr_fpvalid) fill_note(info->notes + info->numnote++, "CORE", NT_PRFPREG, sizeof(*info->fpu), info->fpu); diff --git a/fs/coredump.c b/fs/coredump.c index b4ec1bf889f9..1a474de1e52b 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -525,7 +525,6 @@ void do_coredump(const kernel_siginfo_t *siginfo) static atomic_t core_dump_count = ATOMIC_INIT(0); struct coredump_params cprm = { .siginfo = siginfo, - .regs = task_pt_regs(current), .limit = rlimit(RLIMIT_CORE), /* * We must use the same mm->flags while dumping core to avoid diff --git a/include/linux/coredump.h b/include/linux/coredump.h index 08a1d3e7e46d..a0655d7c149c 100644 --- a/include/linux/coredump.h +++ b/include/linux/coredump.h @@ -18,7 +18,6 @@ struct core_vma_metadata { struct coredump_params { const kernel_siginfo_t *siginfo; - struct pt_regs *regs; struct file *file; unsigned long limit; unsigned long mm_flags; From patchwork Sat Oct 29 23:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1548568wru; Sat, 29 Oct 2022 16:20:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Zqr6QEZ2Tn2VadDnCvirCyEfT5t5chrrmvgAsx1vSmbJ0Af9Eagcp8iTlAYNh06UZBw9i X-Received: by 2002:a17:906:33d8:b0:7ad:a195:ce51 with SMTP id w24-20020a17090633d800b007ada195ce51mr5674649eja.365.1667085619087; Sat, 29 Oct 2022 16:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085619; cv=none; d=google.com; s=arc-20160816; b=1ETzXr/Yi4Adou39ZRhcZEaKIAjPvuXAgKWFuhzKWnc1F1TQ55scornqFrfXKZHUFV q+iQXqKyOR0CJS7j5ysulF1+Kkcjzaw8P9wy+ijbTqs2npVxflBoGdjcDpmKloGtXzqp a4dNCy1dSxzIArQwaW52vfEKTwbUgt5HHOSTGd1V3ehIMnuW86FNF/Vi8aLaL3SjwTa3 lmSohk/KVCHS58O1kCWw2Brdkq089ncsXFLwwtTJJaMpPqDReDNpQ/WgZx/wWxdhWG7I RZ6uR1UG0Geb+6d2r6Q8C7l5yLSAhvbrB1CBq4jyFUoiH+BKU8j9ODdbtT+QHWxL+M9p RAhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LtCMl0coz3ZXBwuQZGamm/+d4rImPuW8bqG03cn45bs=; b=S8W1jTHApO6FxUouNQbZAlg6WEu7gLTNIF6HhbYHxpWQqZIatqVGqts7Q0kAH6kO6i qSQ+8AjCdP8NsiaxGQ2jzOqqpQS2BqVlDcLIROOst/+MQBVf/CoeFrEFDwtKkYpT52tp 1WJNPrVYmuqh8vgcmZiBnUGAn39424Mwh4YSaL7berFG9CksqKW5XNBta+6PoKk5ffzp RFeCcDLklza9hhc5D8acREKZ4sizBWrC5nrt32ghIgeMqVevztFMtqFwZ05MpbajO10O ErV+7ihpl4ot0bwQ4U3A8drsIqRrNQxCqE/6gYWguD9K6CXleAfm8z9UcPOg+96J+fAQ qapg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=FCouf6HO; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a056402278800b00462e23be64fsi3374043ede.578.2022.10.29.16.19.55; Sat, 29 Oct 2022 16:20:19 -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=@linux.org.uk header.s=zeniv-20220401 header.b=FCouf6HO; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229441AbiJ2XS6 (ORCPT + 99 others); Sat, 29 Oct 2022 19:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiJ2XSx (ORCPT ); Sat, 29 Oct 2022 19:18:53 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5BEA2F009; Sat, 29 Oct 2022 16:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=LtCMl0coz3ZXBwuQZGamm/+d4rImPuW8bqG03cn45bs=; b=FCouf6HOx24I4JqBvfnQr3QcdO tD+iJyXjEnDyb508Tw9isA32KpLCv0WOb+ufmsE5oIMaf+c+WS8relTu3PVcqkcjo2X5F1EZ49SJp ebTIw/jYNxMy9v6VcAagQDXdvghQ5sYhnwVlamNZef1OvUqO2YObwFIOL6WqV36P7FarOhHWM5aYu 6zaXidyY2Lz3BvtwM4ryo/QC962yJlh843x9RkmPKok63TbJvF1R9cOEOuKtVjPYmvuy2OxECfagu SoBw720NBnY00CR5sMJvfLwXH+FY7rPtbetQQwUgGLkVf8z+dPZ54MsHiLiMPxvUwP20Dec5/syPU qK+nOT+g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6J-00FOKa-1G; Sat, 29 Oct 2022 23:18:51 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 03/10] kill extern of vsyscall32_sysctl Date: Sun, 30 Oct 2022 00:18:43 +0100 Message-Id: <20221029231850.3668437-3-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748065970164230945?= X-GMAIL-MSGID: =?utf-8?q?1748065970164230945?= it's been dead for years. Signed-off-by: Al Viro --- arch/x86/include/asm/elf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index cb0ff1055ab1..289aa3ca4a05 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -226,7 +226,6 @@ do { \ /* I'm not sure if we can use '-' here */ #define ELF_PLATFORM ("x86_64") extern void set_personality_64bit(void); -extern unsigned int sysctl_vsyscall32; extern int force_personality32; #endif /* !CONFIG_X86_32 */ From patchwork Sat Oct 29 23:18:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549248wru; Sat, 29 Oct 2022 16:22:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zdqYHLLGjnFpn4iviAvXqXX/B46wb+1QUBkUHM1Qi6w+Lh3612uZ8htQRxY8g76LT3Y6l X-Received: by 2002:a17:906:6a1a:b0:7a1:a9e5:7869 with SMTP id qw26-20020a1709066a1a00b007a1a9e57869mr5909550ejc.708.1667085734350; Sat, 29 Oct 2022 16:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085734; cv=none; d=google.com; s=arc-20160816; b=iG7LJslRNkxiNBecvAaglHeVaCp2BGuCcfdBVpQzqndthVYcPfnPaMhhQzbgdyOXJY yVCyzBpLe/qhmsJ5KE54FXEd8ogOSpUtxoc9gliv6lyU5MLBV8N6rpjkWYD4sKFL9Jog +LMAlqb90l/Gn0qFbSVMBTHjCLw2C3WneqKc9trpDTTVJNcM+80usaZxr8xJxdKmd0Ks bzLnTpiA2eYoy/h2iLlN3iWidQ1bn6S0QAsAYWC1SAUolh18fBL3wR2gGIm8PSVVRXr2 XaWhtuy6xSiE5tbeth349xCV6o49/cMrL+DtKAcRp8Q4szKX/xiN8z1kzcQ0+WCPRIBD wCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3I7amQwucLsr9EK3PRzzcIjUWVNxHOmGAMTyGQic/xs=; b=Gq0Y3vC9RIdjdgezdqHqiBfgvuilXIZHDGXfGRRg7+I1DHMbo0yIBIxBkraW0jNqFt RTIe2toZDLcQM4A8208DB5L2CKzIMDIl6OAodFPuvtCex4PeB5EXZNIdC8hBvIXqNffN EZMk0I4381/E043NihqA2t1t317XbDEv618mlYdONGQvxZBuUslxS6wZH5heTU64DccO BCzs4njWOs5YLK1J909dhOJtsF0jPMkcWMVASnFYeIhix6DkWnRePoBzvC+2jJRjzuch ZGkDa8UOFXKMZZZMOkePfpqqocx/oQ/oO1AYyFYF/RtmSA0q77q5QSxShJ/OUVhWRvbB k2aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=OK9IgIJT; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di16-20020a170906731000b0078db89f0959si3349605ejc.867.2022.10.29.16.21.50; Sat, 29 Oct 2022 16:22:14 -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=@linux.org.uk header.s=zeniv-20220401 header.b=OK9IgIJT; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbiJ2XTH (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiJ2XSy (ORCPT ); Sat, 29 Oct 2022 19:18:54 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CBD42F00C; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=3I7amQwucLsr9EK3PRzzcIjUWVNxHOmGAMTyGQic/xs=; b=OK9IgIJTUA5Bn/JLGr/q/PnE7b qfPBRQZDcdEMgRa9OV2zbtFoK7zCO9Oa0JgGALwa7IwlbgTcl36O+QAYgRfXSKJMLwfweAe7IZC0b dntraq7P0590C3HCK+HAxyVHp61x0lVHrNe9j/BM0TOuIS9kFolmTQWMKCCtaxvWdm4kY6e3k1cB4 cc4CQmbYSaQJAw3wakeRVehctJN37Ah9l9UjtX7VtNQoQqND/2UxvrCJr2Mjr5XKyq1YaY1x+1Dgu rvGtOBql67edIbabKP2bm6leLuHnuyyEdMNY9/SiO1qYVAznUXAqBvkTbI8U7ZR5WCcIQXoMM4mKW VwhoKUxA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6J-00FOKe-1p; Sat, 29 Oct 2022 23:18:51 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 04/10] [elf][regset] clean fill_note_info() a bit Date: Sun, 30 Oct 2022 00:18:44 +0100 Message-Id: <20221029231850.3668437-4-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066090830239575?= X-GMAIL-MSGID: =?utf-8?q?1748066090830239575?= *info is already initialized... Signed-off-by: Al Viro --- fs/binfmt_elf.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 002fd713ac11..4190dafd2ec4 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1833,24 +1833,17 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, struct elf_thread_core_info *t; struct elf_prpsinfo *psinfo; struct core_thread *ct; - unsigned int i; - - info->size = 0; - info->thread = NULL; psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL); - if (psinfo == NULL) { - info->psinfo.data = NULL; /* So we don't free this wrongly */ + if (!psinfo) return 0; - } - fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); /* * Figure out how many notes we're going to need for each thread. */ info->thread_notes = 0; - for (i = 0; i < view->n; ++i) + for (int i = 0; i < view->n; ++i) if (view->regsets[i].core_note_type != 0) ++info->thread_notes; From patchwork Sat Oct 29 23:18:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549130wru; Sat, 29 Oct 2022 16:21:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jDRKMds9mqjKMchiXTShW8DtwOSu84QcGgBHODDoal9DjBW7OsJZHALEdhSqfw5WlH3Eq X-Received: by 2002:a17:906:cc48:b0:7a8:4a3b:11f7 with SMTP id mm8-20020a170906cc4800b007a84a3b11f7mr5880316ejb.388.1667085713893; Sat, 29 Oct 2022 16:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085713; cv=none; d=google.com; s=arc-20160816; b=OwuEEwQpTVjHhrIktFmTjCRG4RUMZbAMZo4TEqGRlhTmbaMf0arbtWIMQI0VoXjcxx 5H7TQyWetIZBKFuiSaPjlgiqfWFzK79P2pfr1PU7mJYgMjyYjDD1Do8EJqTWeIfm3X8y 4n42gyaL/C1u/znKSqqRRtUly9RCJqHpa8cHHofaOJ9PqC4SUTwwQGmojhxTG0nKhBT8 Hhubbp1GY4gEkDwHpK/RCtL93gE5g7R0hcdbv2UoXCvHbCB+Js8YieOZlKI1ssuYhjvX 7S9bAXzCi4Z8akILA2YqdMWeBCmI12I/9N0/ASGiKXs60BvPehFKZKA2fVxMcRdKqU1g DJpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MQOuXgEd4uijladGhvf42ViTnATMp5s51KNIKFeH+uw=; b=PuDE9ULgHAQ5AnxltR9TUKKnifd6Q4lK6C+ym+xfXpeCnq7/gvzGBVjYCZ+8RTNm07 dHim15/PwuHxHaYDKO4dr1nSRS0dWjsFV8bEsUpwOhV4xSkk6B2V7oRHDDWHY1tsaDV/ z6kJ3hm2JnaJBTScLhv9L/k7gyPWd5IVmL5cunIhuDDOq00VwE5xk9/55iariUuRpqyi mc4jYAZW3fgwsiW0LF32YBC5Z8wCglSuQTl/AXajdu9b7fglfuP+nlOBj90lOKNjAZn2 SkiZUJM/TCZ5uZnph7xQrNl46ojnY1UkfRRUd8YZzH5rohuRxyxgdG3BlQ71avjRCwop oXJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=uRfPySHb; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa14-20020a1709076d0e00b00781f51771b6si2949735ejc.900.2022.10.29.16.21.29; Sat, 29 Oct 2022 16:21:53 -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=@linux.org.uk header.s=zeniv-20220401 header.b=uRfPySHb; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbiJ2XTF (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbiJ2XSx (ORCPT ); Sat, 29 Oct 2022 19:18:53 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B5BB2F00D; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=MQOuXgEd4uijladGhvf42ViTnATMp5s51KNIKFeH+uw=; b=uRfPySHb4xVQmQ1rA28MZQ3S9b d/25b4ehxWwsFjmU1ZCeQjljNYhdwuJHQmFqFrPVtCdCkmC5Fv1xMg/fGw6NXGfi92bewhpfVFSxN UHtTN332gAocwbX5+sQkAHscJNBQX7Bw8KFizNBcbC+IENqCVMwwaET1nSOyv+FYfjBrWO++VTbLi EFyOu0fMD0G9/BvcEJ6vZQRtWAnHV7oEF9qn+MI8SqAoifjYC/ZEHLM5ceWYwZ8YqNIqJyYdXHLYZ BPu9H+MnQT9xWs2mhqAX52f04PlTWl+vSFMfOLH2byDL25q+4k3wxe03HfksQ6T/ctXA7jK6NG10G vYysDuwQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6J-00FOKj-2W; Sat, 29 Oct 2022 23:18:51 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 05/10] [elf][regset] simplify thread list handling in fill_note_info() Date: Sun, 30 Oct 2022 00:18:45 +0100 Message-Id: <20221029231850.3668437-5-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066069207344828?= X-GMAIL-MSGID: =?utf-8?q?1748066069207344828?= fill_note_info() iterates through the list of threads collected in mm->core_state->dumper, allocating a struct elf_thread_core_info instance for each and linking those into a list. We need the entry corresponding to current to be first in the resulting list, so the logics for list insertion is if it's for current or list is empty insert in the head else insert after the first element However, in mm->core_state->dumper the entry for current is guaranteed to be the first one. Which means that both parts of condition will be true on the first iteration and neither will be true on all subsequent ones. Taking the first iteration out of the loop simplifies things nicely... Signed-off-by: Al Viro --- fs/binfmt_elf.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 4190dafd2ec4..e990075fb43d 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1866,7 +1866,14 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, /* * Allocate a structure for each thread. */ - for (ct = &dump_task->signal->core_state->dumper; ct; ct = ct->next) { + info->thread = kzalloc(offsetof(struct elf_thread_core_info, + notes[info->thread_notes]), + GFP_KERNEL); + if (unlikely(!info->thread)) + return 0; + + info->thread->task = dump_task; + for (ct = dump_task->signal->core_state->dumper.next; ct; ct = ct->next) { t = kzalloc(offsetof(struct elf_thread_core_info, notes[info->thread_notes]), GFP_KERNEL); @@ -1874,17 +1881,8 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, return 0; t->task = ct->task; - if (ct->task == dump_task || !info->thread) { - t->next = info->thread; - info->thread = t; - } else { - /* - * Make sure to keep the original task at - * the head of the list. - */ - t->next = info->thread->next; - info->thread->next = t; - } + t->next = info->thread->next; + info->thread->next = t; } /* From patchwork Sat Oct 29 23:18:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549097wru; Sat, 29 Oct 2022 16:21:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ydZXUR98Z3MoXTKJqeXe5YvXnka7Y+xrNgctVMpkf+evo26c6qK3rjO67XAaVChql3dkr X-Received: by 2002:a17:907:3f13:b0:799:6aef:9837 with SMTP id hq19-20020a1709073f1300b007996aef9837mr5793776ejc.296.1667085708724; Sat, 29 Oct 2022 16:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085708; cv=none; d=google.com; s=arc-20160816; b=I0/9JF5xHytVV66dMEGMQMEJPKc63ZXfSSkfK4YfsgS+NrO0Aq4nCHnJ7AgF/Ybvpd Phs4v55X4TS718EUWDeE8V0rvB1/yI4Me0Wsk/DPDX3t0sTmYgOCU1pUNPyBkgHJRogS jpdzgn4pB12PQkBF/cE3i9F1M3rtL0dSkXdACDbhNmdYKt28AhexTx87cFKR0IigsqTA xqAizh1Abo61IVUlPOYl2eX5e5++qflQFuP6tsYgCM88S1vLPMfJVbeECLyTjca1y2d4 /C3Ke/EEjc12i6ez0W3pv2YE69H0O+YscfX842WFGI8Ys5qBiHSDeSLPJSmmhsjPGvBZ MjTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XABRwD0Dyw5mFhzCOmG2KtL+WfkI3Jd1NdqWLQIk8Ko=; b=o5S2FmhIGWCa4btshkCzCzEirj8UQz/FXlUIZP7sQQnPxG26UJ1oDcVqlbeVO+GjDt BNlsHkdEh5uTNA6G4w2IG4ALjB+WM4ZuuSqduj29PzHNj7YTln5SW1za//dFOzH0m0L6 JpaLM9s+uFINaQhpyvV4KQB6rIaAzoiBxk/P68gQ3wXGurNbcEa0UjlqwuBYGJoMGYwP dmgmcmojuNmL9ZEgGFR/AlfmP8UTPRyn4N8yAG/r0uTp8lSXwYvZAhHU6Fm/VT5i2sxJ suno6xb3YjWyjiN6tsf7jDNkInBTpJI+mlSFls3fzNai9gjd1X92hipPlAbtvVBMEM4t dWag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=gCeN+XLa; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw17-20020a170906fcb100b0078db3762061si2093162ejb.439.2022.10.29.16.21.24; Sat, 29 Oct 2022 16:21:48 -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=@linux.org.uk header.s=zeniv-20220401 header.b=gCeN+XLa; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbiJ2XTC (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbiJ2XSx (ORCPT ); Sat, 29 Oct 2022 19:18:53 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52FC82F011; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=XABRwD0Dyw5mFhzCOmG2KtL+WfkI3Jd1NdqWLQIk8Ko=; b=gCeN+XLatIOia5i1hSzX2biUtQ U4pkgdXmEQN7z/32uyZ9hwU5EWGO6vdvU1eJR03k1kp1CIcFURJI+WFUa35vrTCeCucpE4UFKn4Jj s0ZWSa0bObs0950PZt/lc79l01FrCBw1Z3IxBlzD9dGi5viKVPGNQNATquzexFpTPW/cjw24MVd+H hjOYOslREJc5soNIAnLiFXMm9qLaIrRIY7kSvAM4relve0JL08SqK6uYGgZEfI3+xcrW0tW3QKgGo lVyKeHCIB1uFnIdmU2j1YMi2i6qD+dh5atOPslS2YBk3cyOYGTqcXOgEQEMeGD5LRBv+9VkBbirfw OT9MapqA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6J-00FOKo-39; Sat, 29 Oct 2022 23:18:52 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 06/10] elf_core_copy_task_regs(): task_pt_regs is defined everywhere Date: Sun, 30 Oct 2022 00:18:46 +0100 Message-Id: <20221029231850.3668437-6-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066063922888018?= X-GMAIL-MSGID: =?utf-8?q?1748066063922888018?= Had been since 2011 for all live architectures, ever since 2013 for all architectures, period. Signed-off-by: Al Viro --- include/linux/elfcore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 346a8b56cdc8..fcf58e16d1e3 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h @@ -88,7 +88,7 @@ static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* { #if defined (ELF_CORE_COPY_TASK_REGS) return ELF_CORE_COPY_TASK_REGS(t, elfregs); -#elif defined (task_pt_regs) +#else elf_core_copy_regs(elfregs, task_pt_regs(t)); #endif return 0; From patchwork Sat Oct 29 23:18:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549259wru; Sat, 29 Oct 2022 16:22:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7aYPycuTpbcX2JRp3BUbuC3xAsQ/oCbBsL+wR61GhS0hoKVYafnYJRUzwEOU97lxJjro99 X-Received: by 2002:aa7:da0a:0:b0:461:135e:7298 with SMTP id r10-20020aa7da0a000000b00461135e7298mr6176735eds.242.1667085735084; Sat, 29 Oct 2022 16:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085735; cv=none; d=google.com; s=arc-20160816; b=tN6wCa5Ba3x9LyGqwxJQ8herLUJT/IjT/weHcy3Aq3TKQ2fcHzg+2rUUhbeGDtBFkE F5iXVPg3AtRKcSiqt0FjlS2cJSci6uC884I4jqUd1MTqQdhhwKsxqUgx3SEzzX3xZN82 te+Hn5nMOS3LJJ2eClp7G0A6SJTB8usBNUD+DJkiPFX6bOYQXIlzeRj3vlAJpTQL/+ER LqQi0a3H8LXnSWaPgXstKJCj6uk9SovaDZi/8y9j4tlwboskMsT9ZmG5ae/BHhULd+W3 2DjFzpbyJGoCX0+sdQ0eUpsR5VPFN0vTiDlHKQKjFx0/6rC9e/Li9UWxSSJopljnBnsV 87nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PY6K0u6K9Ph9XRzxm95fUlkPKQwm8X+pvKXLRTI6xiA=; b=tkKEhTqDgOGalZXPPGLeSbNJCZWjAGuuQuMEODmFpvCllsNNa7kq4itBPNlpMudXSQ O92QsQ4jsblfU/M/V4DMvZgKZFKaR4irc02Rt5XTTokz4HpEDw7fneOL/IPzMKRrSnad A4IzrC8YYtmln9BXPTGqTbHSP3+1Uei4U9MXmsO5/Cxz8JMuYgdhk/ClzWQOZIzymXUz ReSOrMpOSKUZ0I+sg2U+D/hNtK06X5XU7dYczvXQOX/HYy6cKgC95Uruoizgsgg3QP89 u7w3Nls1qejo18Rfo2ZZWekaKa+9dHMCLPRRzeFYFXQEQGas6ZNa6RogOap577SHsRM9 rlyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=BcXy8Fxu; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc15-20020a170907168f00b0078e11cbb722si3605554ejc.92.2022.10.29.16.21.51; Sat, 29 Oct 2022 16:22:15 -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=@linux.org.uk header.s=zeniv-20220401 header.b=BcXy8Fxu; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbiJ2XTN (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiJ2XSy (ORCPT ); Sat, 29 Oct 2022 19:18:54 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5732F017; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=PY6K0u6K9Ph9XRzxm95fUlkPKQwm8X+pvKXLRTI6xiA=; b=BcXy8FxurNa6IK04pLSW0RBqOi 4AhXdIB6xLnpCzUv+wuv/9O3HFbsxCRhepGijOCy1L4lAZ6Fw2XLnEWUjCmsyPRAJDRYXpQ8aWzmH LLnzjClcXCdE4BnEO0/01zczVnNzREvIygtOSn1rk/MNRfdU92tWV9BXWgdm4bDsj5zCwN2AQCrel qqmmquOPlgzt33rz/++A+e6N1ugsT/GDAZZtnYAwoEDaJylRKMow4q0FGW2U9Wze9AjeBU9C8DEUS vc/FWZ51tSYc70O7XDLJ+BPzTfH5Ta+DeDuw4AUv1BOdk7R+TRXqd1dVGNF3Bm0qWH+UZKme40Thn gRLBDPpA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6K-00FOKt-0K; Sat, 29 Oct 2022 23:18:52 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 07/10] [elf][non-regset] uninline elf_core_copy_task_fpregs() (and lose pt_regs argument) Date: Sun, 30 Oct 2022 00:18:47 +0100 Message-Id: <20221029231850.3668437-7-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066091871512780?= X-GMAIL-MSGID: =?utf-8?q?1748066091871512780?= Don't bother with pointless macros - we are not sharing it with aout coredumps anymore. Just convert the underlying functions to the same arguments (nobody uses regs, actually) and call them elf_core_copy_task_fpregs(). And unexport the entire bunch, while we are at it. Signed-off-by: Al Viro Acked-by: Geert Uytterhoeven # m68k --- arch/alpha/include/asm/elf.h | 6 ------ arch/alpha/kernel/process.c | 8 +++----- arch/csky/kernel/process.c | 3 +-- arch/m68k/kernel/process.c | 3 +-- arch/microblaze/kernel/process.c | 2 +- arch/um/kernel/process.c | 2 +- arch/x86/um/asm/elf.h | 4 ---- fs/binfmt_elf.c | 5 ++--- include/linux/elfcore.h | 11 +---------- 9 files changed, 10 insertions(+), 34 deletions(-) diff --git a/arch/alpha/include/asm/elf.h b/arch/alpha/include/asm/elf.h index 8049997fa372..e6da23f1da83 100644 --- a/arch/alpha/include/asm/elf.h +++ b/arch/alpha/include/asm/elf.h @@ -120,12 +120,6 @@ extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task); #define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \ dump_elf_task(*(DEST), TASK) -/* Similar, but for the FP registers. */ - -extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task); -#define ELF_CORE_COPY_FPREGS(TASK, DEST) \ - dump_elf_task_fp(*(DEST), TASK) - /* This yields a mask that user programs can use to figure out what instruction set this CPU supports. This is trivial on Alpha, but not so on other machines. */ diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index dbf1bc5e2ad2..65fdae9e48f3 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -333,14 +333,12 @@ dump_elf_task(elf_greg_t *dest, struct task_struct *task) } EXPORT_SYMBOL(dump_elf_task); -int -dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task) +int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu) { - struct switch_stack *sw = (struct switch_stack *)task_pt_regs(task) - 1; - memcpy(dest, sw->fp, 32 * 8); + struct switch_stack *sw = (struct switch_stack *)task_pt_regs(t) - 1; + memcpy(fpu, sw->fp, 32 * 8); return 1; } -EXPORT_SYMBOL(dump_elf_task_fp); /* * Return saved PC of a blocked thread. This assumes the frame diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c index eedddb155669..99767587db17 100644 --- a/arch/csky/kernel/process.c +++ b/arch/csky/kernel/process.c @@ -69,12 +69,11 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) } /* Fill in the fpu structure for a core dump. */ -int dump_fpu(struct pt_regs *regs, struct user_fp *fpu) +int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu) { memcpy(fpu, ¤t->thread.user_fp, sizeof(*fpu)); return 1; } -EXPORT_SYMBOL(dump_fpu); int dump_task_regs(struct task_struct *tsk, elf_gregset_t *pr_regs) { diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 2cb4a61bcfac..38ea940bccea 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -213,7 +213,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) } /* Fill in the fpu structure for a core dump. */ -int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) +int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu) { if (FPU_IS_EMU) { int i; @@ -262,7 +262,6 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) return 1; } -EXPORT_SYMBOL(dump_fpu); unsigned long __get_wchan(struct task_struct *p) { diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c index 3c6241bcaea8..1f802aab2b96 100644 --- a/arch/microblaze/kernel/process.c +++ b/arch/microblaze/kernel/process.c @@ -133,7 +133,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp) /* * Set up a thread for executing a new program */ -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs) +int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu) { return 0; /* MicroBlaze has no separate FPU registers */ } diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 010bc422a09d..8058f2ccca67 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -393,7 +393,7 @@ unsigned long __get_wchan(struct task_struct *p) return 0; } -int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu) +int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu) { int cpu = current_thread_info()->cpu; diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h index dcaf3b38a9e0..6523eb7c3bd1 100644 --- a/arch/x86/um/asm/elf.h +++ b/arch/x86/um/asm/elf.h @@ -201,10 +201,6 @@ typedef struct user_i387_struct elf_fpregset_t; struct task_struct; -extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu); - -#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) - #define ELF_EXEC_PAGESIZE 4096 #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index e990075fb43d..c3c5bd48361e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -2001,8 +2001,7 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t) t->num_notes++; sz += notesize(&t->notes[0]); - if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, NULL, - &t->fpu))) { + if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, &t->fpu))) { fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu), &(t->fpu)); t->num_notes++; @@ -2100,7 +2099,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, /* Try to dump the FPU. */ info->prstatus->pr_fpvalid = - elf_core_copy_task_fpregs(current, task_pt_regs(current), info->fpu); + elf_core_copy_task_fpregs(current, info->fpu); if (info->prstatus->pr_fpvalid) fill_note(info->notes + info->numnote++, "CORE", NT_PRFPREG, sizeof(*info->fpu), info->fpu); diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index fcf58e16d1e3..9ec81290e3c8 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h @@ -94,16 +94,7 @@ static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* return 0; } -extern int dump_fpu (struct pt_regs *, elf_fpregset_t *); - -static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_regs *regs, elf_fpregset_t *fpu) -{ -#ifdef ELF_CORE_COPY_FPREGS - return ELF_CORE_COPY_FPREGS(t, fpu); -#else - return dump_fpu(regs, fpu); -#endif -} +int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu); #ifdef CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS /* From patchwork Sat Oct 29 23:18:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1548846wru; Sat, 29 Oct 2022 16:21:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EfaChzzQKwMK2QhFH2Rg0q4mlyEPZbaVt/tY787MXFRSlRnRrfzyJSgi3VFLS5+aezcCn X-Received: by 2002:a17:906:58c7:b0:722:f4bf:cb75 with SMTP id e7-20020a17090658c700b00722f4bfcb75mr5610541ejs.450.1667085664167; Sat, 29 Oct 2022 16:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085664; cv=none; d=google.com; s=arc-20160816; b=nN7FicEx6ttLCD3pvFHmN+Z0CG38SCWbaPJJa9hAu3aTI5PMO/BcGI1SqbYp7Aw/CP 8MmNoy1JehpwvqyA8rdMgIBqxSWfSbs+H6yuW6KWQ4ab+D3GG8otnD8GqT2KHm62qF67 9b/ZD/InSwwSv1hafn3yHBVAEn2oF2I6fExRaMFl7pqf64ij8zrDZXBq0J9hWCPjr/6C gm/iZ54Y50DYBM/mPQIco9cHc9SYFcfnCuO6TbbLlpnEm53SDAvi4r69EOcHVvRexBEG gQS4WOvOob3fG/yi35MGIVkq0fXkKtBBDhtoqe05ra7nk3w0WwXfATWRwn8FCL8cMHVb 89og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=klpACccFtoarUhZmGjA/78+30p+ai2lgnRxPOatV6uo=; b=qldSATkT0lsMROR2r9W3H51v+tSE5gPKVwudAIqv4OjZ/mDBa51cDXf77hXyNCzbY9 z98bs1NIz2yJmo8SzbunPfS2/4KRG7fyByxfOuLLVDS+7cd3jc4iSxeho/7ZTAcG/JHz i4flapf52960vhp/H8UyVfAKgaV3lQdzv9qBnIOg7MU2PM0HBcofbHv42mRFmGOHG4Ia TXLx/GkmS+XivSAAqZeYjwJiPR/oAR4J3LjblVlOom12R6otl6L3WtAZg3A63MVPq0Ji X0FliaGZ621zExCZTd0lk+UVLF5843bkayoIiGaCk/j9Va3/OUkjq4IPkxHXpXqjIAeB ETBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=rZhwOnmM; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a056402350c00b0045d5b83114esi3213164edd.112.2022.10.29.16.20.39; Sat, 29 Oct 2022 16:21:04 -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=@linux.org.uk header.s=zeniv-20220401 header.b=rZhwOnmM; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbiJ2XTK (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbiJ2XSy (ORCPT ); Sat, 29 Oct 2022 19:18:54 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA9B12F01F; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=klpACccFtoarUhZmGjA/78+30p+ai2lgnRxPOatV6uo=; b=rZhwOnmMLug/lcPeuhHrVrEYmp 50zfxE7UVHGkpfocNwlK7CjfvaoUP4jeHuwuWOcGyNT40TNVNf4pJ6nw31a4Yt8Kaj28U7GG+z5Dy 56zhCCvjMDKjq9JgOyM8Znfoj358ljkrBoK9JyDobOH5okIEruLMVUQtXrwHRCG2cxYBspdRFF+70 P4P3tT7HDvjtZx9kBDGQq4AiI+TxN0TTe5mG41APl+pY7WXF3TV4wq3pTpKt6exHsFWK9fzvXfnlc IYt+wx0L3zPhECGW+l+WOpJDFrmrU8egD7eVlxyhRYZCcf6N59klzXvOSTVTzMJSU0gbRbX8V9xCv cAYwHAkw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6K-00FOKz-0i; Sat, 29 Oct 2022 23:18:52 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 08/10] [elf][non-regset] use elf_core_copy_task_regs() for dumper as well Date: Sun, 30 Oct 2022 00:18:48 +0100 Message-Id: <20221029231850.3668437-8-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066017441117647?= X-GMAIL-MSGID: =?utf-8?q?1748066017441117647?= elf_core_copy_regs() is equivalent to elf_core_copy_task_regs() of current on all architectures. Signed-off-by: Al Viro --- fs/binfmt_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c3c5bd48361e..cb95e842c50f 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -2072,7 +2072,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, /* now collect the dump for the current */ memset(info->prstatus, 0, sizeof(*info->prstatus)); fill_prstatus(&info->prstatus->common, current, cprm->siginfo->si_signo); - elf_core_copy_regs(&info->prstatus->pr_reg, task_pt_regs(current)); + elf_core_copy_task_regs(current, &info->prstatus->pr_reg); /* Set up header */ fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); From patchwork Sat Oct 29 23:18:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549339wru; Sat, 29 Oct 2022 16:22:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FQkXJUywV6DrglcBrPwuOSaRRsahpbj/kjN6iAFSiupfvSRh1KAhXhfBdoYcLA6R/nuTW X-Received: by 2002:a63:2402:0:b0:460:99af:331c with SMTP id k2-20020a632402000000b0046099af331cmr5669364pgk.460.1667085746357; Sat, 29 Oct 2022 16:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085746; cv=none; d=google.com; s=arc-20160816; b=VAXo4kUU8rUFAhYCJ5btPMJnwsdOxn+U0HIFsCFWhaXEuH0LD+hUB8bDWAESBg86q2 /f39gfX4MFxxGwoRhOVJ4nL1tuCFt8NXbH+1+azuajiFcsuT3xoUbTUzA4Ud9JcEcW/t zCqBZ9cy/beaMmNa1edGmYhJyYfOt8QnLargZWZ/VMhoYzKWHtGrxIPiGCwixSm8FN3u GIrUvfrU5UFEYzvMe0rZOCyaMNRpR7Cj8kZxOL2aZOu5U87DCIZi4nqevaL0GZmDh6+x tSOFVeWqSUHbKnbSRuVe4KDuFDHpifS3klaaonwExfejnzZGYT+OkvBo2nrJeZBnzlDr 9V7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xI+3eNRMEcjT5yLalmW9Eq0QkXwupoDkPKtfFg3luGc=; b=OJXn3vm2tLH+oe84Tk+wwQc+DewR1UvwXim8GxVW21nqXMgAEfarP3kY6mQXJjz7hH SRsBCVB05WfFHA3Wtj8g1jiVDK4YrKLyahwQepBDs2P5m4osOR4kM0KsQDgB4AZSAjkY 6sazF9zZ4Ij5Ma+ExO66lbY2jOBpATg+gflRPjDVLvfalEdzy8I7HOHukQAXGftKA6GM GVJilDkxXOyIpk6QoYuIdk8HUnqIiE5LD5WY+nCpgEpXGYgEhJ4GPVgssTWCvmkFCtOt qRjHaFr1QXj/pV/+lZGUkSrhYaBUNGCdY4IAQkWJhsTGAx7SAiKCReEWzVCetTR1lgGD r0aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=gKFfTYlU; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a17090a8d0f00b002136a8424f3si3041895pjo.184.2022.10.29.16.22.13; Sat, 29 Oct 2022 16:22:26 -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=@linux.org.uk header.s=zeniv-20220401 header.b=gKFfTYlU; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbiJ2XTT (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbiJ2XSz (ORCPT ); Sat, 29 Oct 2022 19:18:55 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED2142F020; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=xI+3eNRMEcjT5yLalmW9Eq0QkXwupoDkPKtfFg3luGc=; b=gKFfTYlU51KF5YtQEtQ0dEFQTA +xcas8ghNfqRamQ2+3u17/YMNNAlTFxK6D9ZF4w3eLrf0UR+/447ZYCfj5Tqfq3IAU9JTApjr5DyJ fedu4EN+Zcgy940D/yJry5yEIG6NZt+LTIv7HolMtvScKay/B7hTV9EzAUpejFaOfg2VqAIV6DbHq 1041LPD1JJEsZwpJm2DB+2XJGNaBqinqHQzGNH2Yh0JOlMj83/p/ocXnWYw29S7qRd/o1lJ+tvrMs 9QdJnGL/jYl7YU5MkIT+0QnPpfNDgJqUKLZomEesRy1sNdP6owaBM+DXcp//swhi/JzagI0Q19J9x HIKkieoQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6K-00FOL4-1b; Sat, 29 Oct 2022 23:18:52 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 09/10] [elf] unify regset and non-regset cases Date: Sun, 30 Oct 2022 00:18:49 +0100 Message-Id: <20221029231850.3668437-9-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066103626935433?= X-GMAIL-MSGID: =?utf-8?q?1748066103626935433?= The only real difference is in filling per-thread notes - getting the values of registers. And this is the only part that is worth an ifdef - we don't need to duplicate the logics regarding gathering threads, filling other notes, etc. It would've been hard to do back when regset-based variant had been introduced, mostly due to sharing bits and pieces of helpers with aout coredumps. As the result, too much had been duplicated and the copies had drifted away since then. Now it can be done cleanly... Signed-off-by: Al Viro --- fs/binfmt_elf.c | 230 ++++++++---------------------------------------- 1 file changed, 38 insertions(+), 192 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index cb95e842c50f..3758a617c9d8 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1723,7 +1723,6 @@ static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm return 0; } -#ifdef CORE_DUMP_USE_REGSET #include struct elf_thread_core_info { @@ -1744,6 +1743,7 @@ struct elf_note_info { int thread_notes; }; +#ifdef CORE_DUMP_USE_REGSET /* * When a regset has a writeback hook, we call it on each thread before * dumping user memory. On register window machines, this makes sure the @@ -1823,13 +1823,41 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, return 1; } +#else +static int fill_thread_core_info(struct elf_thread_core_info *t, + const struct user_regset_view *view, + long signr, struct elf_note_info *info) +{ + struct task_struct *p = t->task; + elf_fpregset_t *fpu; + + fill_prstatus(&t->prstatus.common, p, signr); + elf_core_copy_task_regs(p, &t->prstatus.pr_reg); + + fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus), + &(t->prstatus)); + info->size += notesize(&t->notes[0]); + + fpu = kzalloc(sizeof(elf_fpregset_t), GFP_KERNEL); + if (!fpu || !elf_core_copy_task_fpregs(p, fpu)) { + kfree(fpu); + return 1; + } + + t->prstatus.pr_fpvalid = 1; + fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(*fpu), fpu); + info->size += notesize(&t->notes[1]); + + return 1; +} +#endif static int fill_note_info(struct elfhdr *elf, int phdrs, struct elf_note_info *info, struct coredump_params *cprm) { struct task_struct *dump_task = current; - const struct user_regset_view *view = task_user_regset_view(dump_task); + const struct user_regset_view *view; struct elf_thread_core_info *t; struct elf_prpsinfo *psinfo; struct core_thread *ct; @@ -1839,6 +1867,9 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, return 0; fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); +#ifdef CORE_DUMP_USE_REGSET + view = task_user_regset_view(dump_task); + /* * Figure out how many notes we're going to need for each thread. */ @@ -1862,6 +1893,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, */ fill_elf_header(elf, phdrs, view->e_machine, view->e_flags); +#else + view = NULL; + info->thread_notes = 2; + fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); +#endif /* * Allocate a structure for each thread. @@ -1969,196 +2005,6 @@ static void free_note_info(struct elf_note_info *info) kvfree(info->files.data); } -#else - -/* Here is the structure in which status of each thread is captured. */ -struct elf_thread_status -{ - struct list_head list; - struct elf_prstatus prstatus; /* NT_PRSTATUS */ - elf_fpregset_t fpu; /* NT_PRFPREG */ - struct task_struct *thread; - struct memelfnote notes[3]; - int num_notes; -}; - -/* - * In order to add the specific thread information for the elf file format, - * we need to keep a linked list of every threads pr_status and then create - * a single section for them in the final core file. - */ -static int elf_dump_thread_status(long signr, struct elf_thread_status *t) -{ - int sz = 0; - struct task_struct *p = t->thread; - t->num_notes = 0; - - fill_prstatus(&t->prstatus.common, p, signr); - elf_core_copy_task_regs(p, &t->prstatus.pr_reg); - - fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus), - &(t->prstatus)); - t->num_notes++; - sz += notesize(&t->notes[0]); - - if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, &t->fpu))) { - fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu), - &(t->fpu)); - t->num_notes++; - sz += notesize(&t->notes[1]); - } - return sz; -} - -struct elf_note_info { - struct memelfnote *notes; - struct memelfnote *notes_files; - struct elf_prstatus *prstatus; /* NT_PRSTATUS */ - struct elf_prpsinfo *psinfo; /* NT_PRPSINFO */ - struct list_head thread_list; - elf_fpregset_t *fpu; - user_siginfo_t csigdata; - int thread_status_size; - int numnote; -}; - -static int elf_note_info_init(struct elf_note_info *info) -{ - memset(info, 0, sizeof(*info)); - INIT_LIST_HEAD(&info->thread_list); - - /* Allocate space for ELF notes */ - info->notes = kmalloc_array(8, sizeof(struct memelfnote), GFP_KERNEL); - if (!info->notes) - return 0; - info->psinfo = kmalloc(sizeof(*info->psinfo), GFP_KERNEL); - if (!info->psinfo) - return 0; - info->prstatus = kmalloc(sizeof(*info->prstatus), GFP_KERNEL); - if (!info->prstatus) - return 0; - info->fpu = kmalloc(sizeof(*info->fpu), GFP_KERNEL); - if (!info->fpu) - return 0; - return 1; -} - -static int fill_note_info(struct elfhdr *elf, int phdrs, - struct elf_note_info *info, - struct coredump_params *cprm) -{ - struct core_thread *ct; - struct elf_thread_status *ets; - - if (!elf_note_info_init(info)) - return 0; - - for (ct = current->signal->core_state->dumper.next; - ct; ct = ct->next) { - ets = kzalloc(sizeof(*ets), GFP_KERNEL); - if (!ets) - return 0; - - ets->thread = ct->task; - list_add(&ets->list, &info->thread_list); - } - - list_for_each_entry(ets, &info->thread_list, list) { - int sz; - - sz = elf_dump_thread_status(cprm->siginfo->si_signo, ets); - info->thread_status_size += sz; - } - /* now collect the dump for the current */ - memset(info->prstatus, 0, sizeof(*info->prstatus)); - fill_prstatus(&info->prstatus->common, current, cprm->siginfo->si_signo); - elf_core_copy_task_regs(current, &info->prstatus->pr_reg); - - /* Set up header */ - fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); - - /* - * Set up the notes in similar form to SVR4 core dumps made - * with info from their /proc. - */ - - fill_note(info->notes + 0, "CORE", NT_PRSTATUS, - sizeof(*info->prstatus), info->prstatus); - fill_psinfo(info->psinfo, current->group_leader, current->mm); - fill_note(info->notes + 1, "CORE", NT_PRPSINFO, - sizeof(*info->psinfo), info->psinfo); - - fill_siginfo_note(info->notes + 2, &info->csigdata, cprm->siginfo); - fill_auxv_note(info->notes + 3, current->mm); - info->numnote = 4; - - if (fill_files_note(info->notes + info->numnote, cprm) == 0) { - info->notes_files = info->notes + info->numnote; - info->numnote++; - } - - /* Try to dump the FPU. */ - info->prstatus->pr_fpvalid = - elf_core_copy_task_fpregs(current, info->fpu); - if (info->prstatus->pr_fpvalid) - fill_note(info->notes + info->numnote++, - "CORE", NT_PRFPREG, sizeof(*info->fpu), info->fpu); - return 1; -} - -static size_t get_note_info_size(struct elf_note_info *info) -{ - int sz = 0; - int i; - - for (i = 0; i < info->numnote; i++) - sz += notesize(info->notes + i); - - sz += info->thread_status_size; - - return sz; -} - -static int write_note_info(struct elf_note_info *info, - struct coredump_params *cprm) -{ - struct elf_thread_status *ets; - int i; - - for (i = 0; i < info->numnote; i++) - if (!writenote(info->notes + i, cprm)) - return 0; - - /* write out the thread status notes section */ - list_for_each_entry(ets, &info->thread_list, list) { - for (i = 0; i < ets->num_notes; i++) - if (!writenote(&ets->notes[i], cprm)) - return 0; - } - - return 1; -} - -static void free_note_info(struct elf_note_info *info) -{ - while (!list_empty(&info->thread_list)) { - struct list_head *tmp = info->thread_list.next; - list_del(tmp); - kfree(list_entry(tmp, struct elf_thread_status, list)); - } - - /* Free data possibly allocated by fill_files_note(): */ - if (info->notes_files) - kvfree(info->notes_files->data); - - kfree(info->prstatus); - kfree(info->psinfo); - kfree(info->notes); - kfree(info->fpu); -} - -#endif - static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum, elf_addr_t e_shoff, int segs) { From patchwork Sat Oct 29 23:18:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1549471wru; Sat, 29 Oct 2022 16:22:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5n4XSh04ZkWktTojWPxB+WJSM6xvkebop9nAtUW5fG7BhSqD+gEBWnJtteq5Y7f/uACkeo X-Received: by 2002:a17:903:41cb:b0:183:1648:be0f with SMTP id u11-20020a17090341cb00b001831648be0fmr6577874ple.18.1667085768391; Sat, 29 Oct 2022 16:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667085768; cv=none; d=google.com; s=arc-20160816; b=ow0ZuzVkIxKblpaTZ9EBaBe4h5Xdt4ZXpp0IqAkvEgz/ofw36HZQNhHVGY30MCRtjq KSzmI/lyqWIt00SYLweN3TCx92yz5tRuiJ17OHKqap+Al1bjOIxR/JYpq+VZ6ul7W6iH f7m5BNWlk484TSD8CYk/XcC+hw3jOxuQhym5XQARquN0X+X1OvP5Tb8mXFcWNqCdDesP IBN8Dq76HztwwkbM8UOLBOeZd4kmIccObmYj+fBG33tbC9oKd0nZBL6XeiaVg9MytSQb LbX5cNxOktD9+e8zgUk3U7BA7ZV2XWpSMwonMjMEWXpBlcBelFQsDAwa1etbjF7ErTFo UG/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WhbUv9HBxQIPXWwFYMtnUUjJ/kZ/8c6XmqS5a0sNtkc=; b=L1q1imOkO7Z5zXNbrh5jLZgVUM0gPUfe1gspIGfmZuCxhZcDO/3bW1WoChjxQ55Z/V /4xY1WOxZKH165D/RVkKheclqrCjqVc+recL22AER1pCOH4ZyNLkTQYvhNIS3Y0C6URd NEMoWrAtHEbM+yHA5B8JhQJNsOVCQI0SdKe78XeRhHRxuNkusnQPSieoLYz2jXvV3qtC XrvuZqRh1Bdfs2CQEeM1DZMMpmForo3X1VXdcDeZ88qSW9z6VdsGyxVPSjed1X3CQHsJ GBZLXU8bSJC2VEZXWN40XsGPNOZu3g3GbySYbiDFCEAPGHHBsBrhC+Dabsjq761OhQU6 VkOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=rQCFH1SC; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170902f68c00b00186a185131dsi4035693plg.444.2022.10.29.16.22.35; Sat, 29 Oct 2022 16:22:48 -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=@linux.org.uk header.s=zeniv-20220401 header.b=rQCFH1SC; 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=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbiJ2XTQ (ORCPT + 99 others); Sat, 29 Oct 2022 19:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbiJ2XSy (ORCPT ); Sat, 29 Oct 2022 19:18:54 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EE572F007; Sat, 29 Oct 2022 16:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=WhbUv9HBxQIPXWwFYMtnUUjJ/kZ/8c6XmqS5a0sNtkc=; b=rQCFH1SCYQTChP+jdlWCMmd6Jm YH+4xQ4FeuldtfDjL2HIdNvtPTyRdo1XiVCFq1gNbQLKk1T4n9NyhPrGXaOKI6NmqOs56ggr/Ew5M vUCugji4OPCXfpKVd8efw36D+akpEiseI5l0DV+ixe/R7cCDenDVHX9LVa+1hzLtIlQout2DCSIgN yA2Qn7Wcjyoze3YtV+5VzBBFUBiwrQNcgZEPsmKpcMaAULPDzH/u2a09Lgf/MOqC4r5ij1qNQQH6e cVdwLBh/sxmd0B2rsbEJo/fSItkPq7GYIQ+fgBRvlid2kbFPfGarfxWKceOVrOB69HtzCVicw+SUC L3j1NgKA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6K-00FOLB-2F; Sat, 29 Oct 2022 23:18:52 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 10/10] [elf] get rid of get_note_info_size() Date: Sun, 30 Oct 2022 00:18:50 +0100 Message-Id: <20221029231850.3668437-10-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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?1748066126594224304?= X-GMAIL-MSGID: =?utf-8?q?1748066126594224304?= it's trivial now... Signed-off-by: Al Viro --- fs/binfmt_elf.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 3758a617c9d8..65d2d2ba4d9e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1946,11 +1946,6 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, return 1; } -static size_t get_note_info_size(struct elf_note_info *info) -{ - return info->size; -} - /* * Write all the notes for each thread. When writing the first thread, the * process-wide notes are interleaved after the first thread-specific note. @@ -2068,7 +2063,7 @@ static int elf_core_dump(struct coredump_params *cprm) /* Write notes phdr entry */ { - size_t sz = get_note_info_size(&info); + size_t sz = info.size; /* For cell spufs */ sz += elf_coredump_extra_notes_size();