From patchwork Wed Jan 15 05:48:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13939852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B50C02183 for ; Wed, 15 Jan 2025 05:49:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA6EB280006; Wed, 15 Jan 2025 00:49:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D57D6280005; Wed, 15 Jan 2025 00:49:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF80B280006; Wed, 15 Jan 2025 00:49:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A0D77280005 for ; Wed, 15 Jan 2025 00:49:07 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 54D04140830 for ; Wed, 15 Jan 2025 05:49:07 +0000 (UTC) X-FDA: 83008607934.23.B2BC3CB Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf19.hostedemail.com (Postfix) with ESMTP id 756031A0004 for ; Wed, 15 Jan 2025 05:49:05 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b="QzZK/PE/"; spf=pass (imf19.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736920145; h=from:from:sender: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:dkim-signature; bh=D7R1Z0m4AmDiEDGrwLKGXNpW3g69MQHysWRaDTZFxP4=; b=z/JEhptfs6gucfPDcIaLhQumiypwJcf4z7ZJ78V3c8lSrQs+I4bF9lOjQ8DuajmJgoHDwa NzZuNQlY90/xjcbSeVozSdc9RWsSu2ojsxNTqNaNeOu6HspT4gh3II2+dUKLnRb0xjI9tD 2PHZKF2DogwPGqQk5NACWGmih4u1FiU= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b="QzZK/PE/"; spf=pass (imf19.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736920145; a=rsa-sha256; cv=none; b=26l9nAt8N1g16D6nGxNQ6VHD54K+kl+6qQWjElnfStq+AN+t4EuhFTJOBm1QVrMAged/c7 /FGc9Oz+DYxOKZrBCBaZXcX7WMCEDUxL+6K/bwGE+D9GNGgdbmj5CRaV1vxtnXkHbwWwmt 5tjNgklpxXxMZHQAo8/78cy/KhLIX4M= Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2efe25558ddso7916962a91.2 for ; Tue, 14 Jan 2025 21:49:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736920144; x=1737524944; darn=kvack.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=D7R1Z0m4AmDiEDGrwLKGXNpW3g69MQHysWRaDTZFxP4=; b=QzZK/PE/1vswnDT0LloSg5r8xWTFNuYF6DAttzEs+WhU03/g2r1eClUqshQLPlxbIK TK0OrpLrZDHfuSLMkmDCDZK36kA2ALi4YVMkoAGJ6RAsm2WaGFpUgRzG+iawQgF4hUj6 3blfqfmNm8YPIA0H+9FUnIj2BbMQBwINU+He25o6mwSM7PraAoiQUYgjdiH/ELTdaSbS /v4SlHz7C7rnemc48nQOTA1+PsG4yXoNxz/WLLWZbDMWYfVazwSBA//dR5KMi9J74Nmj nfEk0CbgfytH7rexfRY/TCNLyB9Ud0LnCykIOPGCuGkgfR5lLQ/iUllufEiudD8gYqAF CdFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736920144; x=1737524944; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D7R1Z0m4AmDiEDGrwLKGXNpW3g69MQHysWRaDTZFxP4=; b=MCZhR/jbeqdzL8U9eihs2oeGZ4KKMi9M/HSoG93Li4Vj9wUkKQ2+yALM0XPPrnlkzk 9uZfdYYhyG1iF7zxucP0qE9svmRdc/44fnAGKKx7f4sBt7pkP8zHxZTOVM6yXLe7O4JU 8UYCTe+7i3bGKd3tfZ/bcRq3cNZPvU+ZX3hqqPWN5CXqxeaN80Sq0XkwCdqALaPCigC1 KHwtOu4plX/qIKs+M38x+KviVx1QilyfrZ9guRlQ2KkNrHxgLsbL0UoSC4yNkoykDUnD fhJtwKuOdBJd3/P4xVrSfu1YnkSPFUiS4dUnjOOt5+LcCx24EfcTy7fjzZJXIN0sR3xa XLOA== X-Gm-Message-State: AOJu0Yz6/NNWkD7sIr8e2UunqtqxCAy701O6uw+IhDjdWl92S2RxvT5J 1bMazY8HrfN2B1quX2zEVSgeTm7ccs4PNBJfsJ4+oEYQmj4duZA+h+mXtr9q7BA= X-Gm-Gg: ASbGncup97qJDRKbnRQR6/+gIdPZjjgkI24CLQvx+AUsCFQrj2l/PLRxknZoaabfDur hjxs9hBHY1RP+f5cSV7FYK+j3YS1EBWK+qgDZLA6N15oY8NicJhdDliQOqyWdSIQzz95yyB1LlM SlrnDytPB333xL451J+ZX9AEIJ5AGQVfszfPfww99W2i3znS2aR367ZXf+v6FgudxIVj++yHpDl dfLZs5mqvN/kpKWkpkzhhD3P2eQYQiMcHs5sLmXbK+4XNDlQjLtOoD2Vs0= X-Google-Smtp-Source: AGHT+IF72SLq1My1g7dtb+6XlMl4Y+R7t/efbYmDZTCYwSHPEhtpwytSLWotlhp9pmcuYRJ5nSVCuw== X-Received: by 2002:a17:90a:dfcc:b0:2ee:ad18:b30d with SMTP id 98e67ed59e1d1-2f548e98f31mr36439035a91.6.1736920144269; Tue, 14 Jan 2025 21:49:04 -0800 (PST) Received: from localhost ([157.82.203.37]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2f7085261dcsm1516002a91.0.2025.01.14.21.48.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jan 2025 21:49:03 -0800 (PST) From: Akihiko Odaki Date: Wed, 15 Jan 2025 14:48:01 +0900 Subject: [PATCH v5 4/6] crash: Use note name macros MIME-Version: 1.0 Message-Id: <20250115-elf-v5-4-0f9e55bbb2fc@daynix.com> References: <20250115-elf-v5-0-0f9e55bbb2fc@daynix.com> In-Reply-To: <20250115-elf-v5-0-0f9e55bbb2fc@daynix.com> To: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Dave Martin , Baoquan He , Vivek Goyal , Dave Young , LEROY Christophe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kexec@lists.infradead.org, binutils@sourceware.org, devel@daynix.com, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 X-Rspamd-Queue-Id: 756031A0004 X-Rspamd-Server: rspam12 X-Stat-Signature: te93ek9r3fcb6o8zauy8mjttz8c5kjrx X-Rspam-User: X-HE-Tag: 1736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6gqGl/HAaiZX1UoFBhP1ws/DWLf3O9chJwjZP7dNh6VL9Pi5LQA69UqOT6CyDfadhS6xblHsqeCnXD7NunY7lQVO6Pm0YvQEOmIBTiyMQMzONq0Srw4abdzxDKbkpMTUh6vcRdoVekxVlh4wFMjz1mHQQrzC54UBMu3U4fIFJ7aQGUapaS0WC4TEw9A5srBo11YOJMoYxzSL9Vrvshy1UzLn6NBbAjgFElv+jcIPd4IrbcI57tbuAeJRe69lvt2aJiLRFA+G/OfiDvNyJ9mRNJ+Fhz6UuBAqm1APenxV2fsTX4eAz0p0KnRYUe9fmPR8eG40IHVX8zPeeTha0V1Ocnz9K4a+hY0Ifs4j305Cxdbz0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use note name macros to match with the userspace's expectation. Signed-off-by: Akihiko Odaki Acked-by: Baoquan He Reviewed-by: Dave Martin --- fs/proc/kcore.c | 12 ++++++------ include/linux/vmcore_info.h | 2 +- kernel/crash_core.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index e376f48c4b8b..e5612313b8b4 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -34,8 +34,6 @@ #include #include "internal.h" -#define CORE_STR "CORE" - #ifndef ELF_CORE_EFLAGS #define ELF_CORE_EFLAGS 0 #endif @@ -119,7 +117,9 @@ static size_t get_kcore_size(int *nphdr, size_t *phdrs_len, size_t *notes_len, *phdrs_len = *nphdr * sizeof(struct elf_phdr); *notes_len = (4 * sizeof(struct elf_note) + - 3 * ALIGN(sizeof(CORE_STR), 4) + + ALIGN(sizeof(NN_PRSTATUS), 4) + + ALIGN(sizeof(NN_PRPSINFO), 4) + + ALIGN(sizeof(NN_TASKSTRUCT), 4) + VMCOREINFO_NOTE_NAME_BYTES + ALIGN(sizeof(struct elf_prstatus), 4) + ALIGN(sizeof(struct elf_prpsinfo), 4) + @@ -444,11 +444,11 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter) goto out; } - append_kcore_note(notes, &i, CORE_STR, NT_PRSTATUS, &prstatus, + append_kcore_note(notes, &i, NN_PRSTATUS, NT_PRSTATUS, &prstatus, sizeof(prstatus)); - append_kcore_note(notes, &i, CORE_STR, NT_PRPSINFO, &prpsinfo, + append_kcore_note(notes, &i, NN_PRPSINFO, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo)); - append_kcore_note(notes, &i, CORE_STR, NT_TASKSTRUCT, current, + append_kcore_note(notes, &i, NN_TASKSTRUCT, NT_TASKSTRUCT, current, arch_task_struct_size); /* * vmcoreinfo_size is mostly constant after init time, but it diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h index e1dec1a6a749..1672801fd98c 100644 --- a/include/linux/vmcore_info.h +++ b/include/linux/vmcore_info.h @@ -8,7 +8,7 @@ #define CRASH_CORE_NOTE_NAME "CORE" #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4) -#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4) +#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4) #define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4) /* diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 078fe5bc5a74..335b8425dd4b 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -436,7 +436,7 @@ void crash_save_cpu(struct pt_regs *regs, int cpu) memset(&prstatus, 0, sizeof(prstatus)); prstatus.common.pr_pid = current->pid; elf_core_copy_regs(&prstatus.pr_reg, regs); - buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS, + buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS, &prstatus, sizeof(prstatus)); final_note(buf); }