From patchwork Sat Jan 11 05:48:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13935791 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 90F2FE7719D for ; Sat, 11 Jan 2025 05:49:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 078BC8D0003; Sat, 11 Jan 2025 00:49:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 028A58D0001; Sat, 11 Jan 2025 00:49:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E32548D0003; Sat, 11 Jan 2025 00:49:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C2DEF8D0001 for ; Sat, 11 Jan 2025 00:49:26 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 86679AF352 for ; Sat, 11 Jan 2025 05:49:26 +0000 (UTC) X-FDA: 82994093532.30.805E11E Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf03.hostedemail.com (Postfix) with ESMTP id AA9C020005 for ; Sat, 11 Jan 2025 05:49:24 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=uWTmSnQw; spf=pass (imf03.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.214.182 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=1736574564; 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=d5w0df8A0RGvduNGo/n7gECMAUl7ttjM0kfw51R7kHo=; b=sf5Mtwzx/Rsn5S8KGuxWCnV9W5kaTWrFDRgBE1ESuTolUYPPfrSqSKp/mXZIY5U+3VnvmR UT3OtBr0w+4oW634S/2JYeajcglXEUEh4AU4PJTtFs4a3vRIdLQfGI0VdR4pGgXHqRsuZa dUoED4We2NUKUy97pbbqlX5hjW2Manc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=uWTmSnQw; spf=pass (imf03.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736574564; a=rsa-sha256; cv=none; b=k6Jc1ENhaMNDlV/SxBkA4MgqHMD0gzq/5KwEX5CwOKIDzYTx3LvpI7FrJIAmftlZ770Xvs ihSpUMxmC8WF8iDn8ob7b30woYe2UQ7fyMpPkWjJ/8X/KB8tlsJo9Ka/FQbpitgFN18mk2 j2wRtUMdUoLbmB1O1sw9IUrNgYKleQ4= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2164b1f05caso47690115ad.3 for ; Fri, 10 Jan 2025 21:49:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736574563; x=1737179363; 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=d5w0df8A0RGvduNGo/n7gECMAUl7ttjM0kfw51R7kHo=; b=uWTmSnQwdsF57WWY5DVWNHLysM5vxL3hHFYwcd0xGywvCzbV21L442x4yKlKTJBb4x ZOQqbk91JRKsTfYCOZUNwB1u4eLjQTt024qaAQzHCiWgFX3dzEeVqAZrijlQJ9QSL/mB GesSYGwOARIxwbcuJcS9QtBFd4CzT7LvLHmtPpwbM7pkQKdJQhoqC/eP/4UT/um6AhHS 1EWODmjgX7vZynTNxWVsEh7jC0Ook82ORUH6LOlNAhAJ/GvOIgoR8W0OQAA1kVSkXw5x JY2YcFK6ELR/n1rjMpn0I8Is45POFfkCnoL4wblft2x3JuHpueW4EEGFsKd6hcbLlK6W qZGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736574563; x=1737179363; 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=d5w0df8A0RGvduNGo/n7gECMAUl7ttjM0kfw51R7kHo=; b=TrWiykW1MIPHobvLj2EYic9p/10eEs6AYZ83BwRoaxu+oOU9rxepwNQjoKBEGsmr0s /W5xV0ZM0eC7h6pdHlWfpkKlpRLeX56PRZ0PNFvxh+MPniqKN2hZ+o9XJmLHMr8ZtNnS JVze27yab0GAGpmGWK656QE1euY6bDuHmHdDK+q37QHvS04ZmAuxgR/6amnQWzEkkK4O HQJ3N+wtBwifvLj8+Tih/FSye55O07BiVga7yvHjTPaKJMv+Dzgnr9DPBbwtHSZ63es7 2hd706lhqhttKxDYmBpWjYh19DJF3LDR6fz2OG65IJs99Q9PIZXsYjyBFzeP/3LEA0Y3 XSnw== X-Gm-Message-State: AOJu0YwlxP/t7XqbMRgsF/loiZV/+VSy6VxmXEkSZF0+PaZDBH9ACGnT HR/RYWwdOuSQ7s8nAu17BzqCAmLiCmUzCpJCyKTvMUGIVdOlq055vftRhb/LKUk= X-Gm-Gg: ASbGnct3bw1IZnBB1XMxa6NcwAr/YdJBMq1IigfvCDm519yH6wgOCX7QiMErZRhHR7/ gFgRCtVXXx47kERzu+aTTqyW+/iAYKI+xsYwXCVdyEcvsB3N85AKzXVnfwtAveLoskB5z69iXYy rKFHT58/sqVSvKThQR2/096pNx6t3RuAXtDk3NCwOPnFwZ/v+eLebEb+/MJP5K3V9+Nr2PNI++s MrTR04wv+3W6sVTBT3MwBy9Hvv+Z7gs1VcGaYiFZSUiNFjv9yf3mlClIhw= X-Google-Smtp-Source: AGHT+IEOaK6BOPAe/MUGiXyl+EyGiYmhbaq4qeXiFxMDU90Px7X9OtnxNRV5Ifu8FHX6K2PPpo86xQ== X-Received: by 2002:a17:902:d4cf:b0:216:3466:7414 with SMTP id d9443c01a7336-21a83fcaafdmr208931985ad.44.1736574563492; Fri, 10 Jan 2025 21:49:23 -0800 (PST) Received: from localhost ([157.82.203.37]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-21a9f22d0fcsm21166295ad.161.2025.01.10.21.49.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 21:49:23 -0800 (PST) From: Akihiko Odaki Date: Sat, 11 Jan 2025 14:48:47 +0900 Subject: [PATCH v4 4/6] crash: Use note name macros MIME-Version: 1.0 Message-Id: <20250111-elf-v4-4-b3841fa0dcd9@daynix.com> References: <20250111-elf-v4-0-b3841fa0dcd9@daynix.com> In-Reply-To: <20250111-elf-v4-0-b3841fa0dcd9@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: AA9C020005 X-Rspamd-Server: rspam12 X-Stat-Signature: xu7dast9bxg9t5wayrtynigwqxyurhp1 X-Rspam-User: X-HE-Tag: 1736574564-390115 X-HE-Meta: U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LzbaEsq75lBpfsrc7P6z8cL0lyvIPzNUOxO5KgwaqwFoNuevM0ssvuT4sj64GkFlk05MNUSUBCWAdmpi7jFm1CEyIdEvbk1nwmeuTS2VeqhvL0pBzDrbQ3roCjKgDttu5yW04V7gfnPsM37jNTuWZfcMcpJmH8ARHHcJOJXkntTBkC/yw5qrC8SfCf5FHiV31EPJZ+tpi1jWkVMY9NLQg6Pf7MedIq8njRHmBIs3NEuqth57OFYoDwLCYNriZrShvKWS7rEU1c= 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 --- 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); }