Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp901531pxb; Tue, 1 Feb 2022 12:47:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9+aGKa0GJv77IeAmQXbbGfJ91tu0Rdrv3+a4PcEHl3kfyf+9K073YMKZvssRh0es+7XSx X-Received: by 2002:a62:b618:: with SMTP id j24mr26683858pff.69.1643748456232; Tue, 01 Feb 2022 12:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748456; cv=none; d=google.com; s=arc-20160816; b=n6B+zkerjH8E5pxp1Pa3IT40hAzQ+2Gpmijeb8ROZg7suijvyC4DUEpLTfqUSk1/RS zLZK3yGRX6o9mopbyN8BKsQwHo+j4/+AvvKW7doF8CgaKpcCb1IpA0Wzqx3vuf87x4Kn RldkNO5TD1tXMDrs0Se1ki33K0BMkS+8NTQePAsh5C7ENG1G9KQabMNXcS4e4YFM7Qh3 N5Qr5Ld5EqJmWlWAaoqcW8bUO4w6FibpGsK9LxABq5EeaDMjc01lClVJqj6XSHX77Uk4 giWvtIW0CG0u4aShTuWRDIDuuVAarajG2g7OgmDL/tdR1cw5KrND9U+PmL+SBjrao1CD B93g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=Ds8R3GSigiUw2IgW13ARTuvm0IRnihZnstqqUfXlK7Q=; b=SKX9D1yTBWg8nSDEy7nYN9AXgWS4CvBLW2maEa9IcHsYilWBScubO1c312+j4sK6Ej AKEc9H6BhfqWI1Aei68BL8m9n2b+gpk34y3jTqmqcvRo535jdA3zMtG3DCRjJ3wrvgDX dyTJ2mrJABn0CbujeOuJhneLMUwQJ2zVU9rgzBqLOnT0753zglFz4+evLKq/lu+kC4hX /FpB7ucq1Lfvbzzq6+//6Tpyc0Orf+4uhvapxiHKfokh6xlZR1gtVzJvgTHs3B+QGMSB biE+mYlJSFEc41Z5SWNQBukw3sE9E67f5pduavKsbysLxsCjbIEiCeEON/fu3S2Wh7Wi jHgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si15337675plr.611.2022.02.01.12.47.24; Tue, 01 Feb 2022 12:47:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357841AbiAaSr5 (ORCPT + 99 others); Mon, 31 Jan 2022 13:47:57 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:53356 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357870AbiAaSrV (ORCPT ); Mon, 31 Jan 2022 13:47:21 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]:50520) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nEbhx-006cNW-6f; Mon, 31 Jan 2022 11:47:21 -0700 Received: from ip68-110-24-146.om.om.cox.net ([68.110.24.146]:56388 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nEbhw-00Exkv-4G; Mon, 31 Jan 2022 11:47:20 -0700 From: "Eric W. Biederman" To: Jann Horn Cc: Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Viro , Denys Vlasenko , Kees Cook , Vlastimil Babka , "Liam R . Howlett" References: <20220131153740.2396974-1-willy@infradead.org> <871r0nriy4.fsf@email.froward.int.ebiederm.org> <877dafq3bw.fsf@email.froward.int.ebiederm.org> <87bkzroica.fsf_-_@email.froward.int.ebiederm.org> Date: Mon, 31 Jan 2022 12:47:13 -0600 In-Reply-To: <87bkzroica.fsf_-_@email.froward.int.ebiederm.org> (Eric W. Biederman's message of "Mon, 31 Jan 2022 12:44:53 -0600") Message-ID: <87o83rn3ny.fsf_-_@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1nEbhw-00Exkv-4G;;;mid=<87o83rn3ny.fsf_-_@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.110.24.146;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19S/e7oyEfO8SwfZT/2oAjoeauEQ0xvO5A= X-SA-Exim-Connect-IP: 68.110.24.146 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa07.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_SCC_BODY_TEXT_LINE,T_TooManySym_01,XMNoVowels, XMSubLong autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4999] * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * -0.0 T_SCC_BODY_TEXT_LINE No description available. * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Jann Horn X-Spam-Relay-Country: X-Spam-Timing: total 494 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 11 (2.2%), b_tie_ro: 9 (1.9%), parse: 1.20 (0.2%), extract_message_metadata: 15 (3.0%), get_uri_detail_list: 2.4 (0.5%), tests_pri_-1000: 14 (2.8%), tests_pri_-950: 1.26 (0.3%), tests_pri_-900: 1.02 (0.2%), tests_pri_-90: 112 (22.7%), check_bayes: 111 (22.4%), b_tokenize: 10 (1.9%), b_tok_get_all: 8 (1.6%), b_comp_prob: 2.7 (0.5%), b_tok_touch_all: 87 (17.7%), b_finish: 0.86 (0.2%), tests_pri_0: 324 (65.7%), check_dkim_signature: 0.56 (0.1%), check_dkim_adsp: 2.7 (0.6%), poll_dns_idle: 1.00 (0.2%), tests_pri_10: 2.4 (0.5%), tests_pri_500: 9 (1.8%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 4/5] coredump/elf: Pass coredump_params into fill_note_info X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of individually passing cprm->siginfo and cprm->regs into fill_note_info pass all of struct coredump_params. This is preparation to allow fill_files_note to use the existing vma snapshot. Signed-off-by: "Eric W. Biederman" --- fs/binfmt_elf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 4822b04154e1..272032b1f9a2 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1800,7 +1800,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, static int fill_note_info(struct elfhdr *elf, int phdrs, struct elf_note_info *info, - const kernel_siginfo_t *siginfo, struct pt_regs *regs) + struct coredump_params *cprm) { struct task_struct *dump_task = current; const struct user_regset_view *view = task_user_regset_view(dump_task); @@ -1872,7 +1872,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, * Now fill in each thread's information. */ for (t = info->thread; t != NULL; t = t->next) - if (!fill_thread_core_info(t, view, siginfo->si_signo, &info->size)) + if (!fill_thread_core_info(t, view, cprm->siginfo->si_signo, &info->size)) return 0; /* @@ -1881,7 +1881,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, fill_psinfo(psinfo, dump_task->group_leader, dump_task->mm); info->size += notesize(&info->psinfo); - fill_siginfo_note(&info->signote, &info->csigdata, siginfo); + fill_siginfo_note(&info->signote, &info->csigdata, cprm->siginfo); info->size += notesize(&info->signote); fill_auxv_note(&info->auxv, current->mm); @@ -2029,7 +2029,7 @@ static int elf_note_info_init(struct elf_note_info *info) static int fill_note_info(struct elfhdr *elf, int phdrs, struct elf_note_info *info, - const kernel_siginfo_t *siginfo, struct pt_regs *regs) + struct coredump_params *cprm) { struct core_thread *ct; struct elf_thread_status *ets; @@ -2050,13 +2050,13 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, list_for_each_entry(ets, &info->thread_list, list) { int sz; - sz = elf_dump_thread_status(siginfo->si_signo, ets); + 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, siginfo->si_signo); - elf_core_copy_regs(&info->prstatus->pr_reg, regs); + fill_prstatus(&info->prstatus->common, current, cprm->siginfo->si_signo); + elf_core_copy_regs(&info->prstatus->pr_reg, cprm->regs); /* Set up header */ fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); @@ -2072,7 +2072,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, fill_note(info->notes + 1, "CORE", NT_PRPSINFO, sizeof(*info->psinfo), info->psinfo); - fill_siginfo_note(info->notes + 2, &info->csigdata, siginfo); + fill_siginfo_note(info->notes + 2, &info->csigdata, cprm->siginfo); fill_auxv_note(info->notes + 3, current->mm); info->numnote = 4; @@ -2082,8 +2082,8 @@ 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, regs, - info->fpu); + info->prstatus->pr_fpvalid = + elf_core_copy_task_fpregs(current, cprm->regs, info->fpu); if (info->prstatus->pr_fpvalid) fill_note(info->notes + info->numnote++, "CORE", NT_PRFPREG, sizeof(*info->fpu), info->fpu); @@ -2196,7 +2196,7 @@ static int elf_core_dump(struct coredump_params *cprm) * Collect all the non-memory information about the process for the * notes. This also sets up the file header. */ - if (!fill_note_info(&elf, e_phnum, &info, cprm->siginfo, cprm->regs)) + if (!fill_note_info(&elf, e_phnum, &info, cprm)) goto end_coredump; has_dumped = 1; -- 2.29.2