From nobody Thu Feb 12 23:02:47 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACCCE1C9B7A for ; Sat, 4 Jan 2025 14:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736001551; cv=none; b=eGH7WosI/O254KHi9KzWLcmk9Yhap3yQs3WnL1A/5zwJBi4p1gk6v8LkIldFqoqLvjrhiOECAKX00FX5b9I1b7BEc2UnnErNUmUGjyjJKq7qNQ4pwbqh/BzVyTuYh+aN8OvilW+ICfJ4qrQD4PoH9Gq631ZGAnW4gCUVbguGM9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736001551; c=relaxed/simple; bh=wCQpl7cAn/vCUbH0Vn+YujxXIXBJJFXyKJRaUtyuXrM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o2FNZzBGjyd/LbMjJUay92G/zKADJ655k80svlI+hvYLpHmdhaxvIAu9rUN0VGplxK2XjHgQUS0WLCyPrG8K+Rj1p2JhWosxBavD6WLtsQ/GFczCA4Ve5TXKqPWUsLm/r8Ghp2xK1Cf0JIkAJYdIVElnM3fROH9PLLbZCGLvLR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com; spf=pass smtp.mailfrom=daynix.com; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b=Pv3nLWhB; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=daynix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="Pv3nLWhB" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2166651f752so214487715ad.3 for ; Sat, 04 Jan 2025 06:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736001549; x=1736606349; darn=vger.kernel.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=SYIrxPsAVLm9525H8KmJlUUcKlEHI39WEeyICf7u0AY=; b=Pv3nLWhBe3mqTr/LfUcL72rzoWqsQ4Qs9vRkKkQ1qRIqLUa3KU75VqwJYjQ62jt9sH tA2TSAciVDlbzbss/JU2LbeODM1Wb/itAUzqKb2xZEN/4EhbdFQ1wpof2tDLWTnl5oHI o9rzZbQCmv+LVyuf1vFAdNfmm932DIRh42ypGMWCnb2f4DmHiYeBRJLfUBiGXLt66D6F sxmOr7GQvqrKaxkR7W20wqMDPODyPpowbWHpYngzoINqpmvHi1nwBw5M+TQB+nVDJF0U NtRIE2nY4pIZkr3LZLdA8AgK1eOk2uWhFWPfJypt/GyU6Cdsg9NFsEmAZIrYDoQO3lgu 9aoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736001549; x=1736606349; 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=SYIrxPsAVLm9525H8KmJlUUcKlEHI39WEeyICf7u0AY=; b=W8EiA0uZATgBKIMxeyqT0kfRcGYgy2BCxbTZ25cDh/EnY/t9MXTkr1A9ZfTwYOLpmb CxiUl52KDW4PGTBNGw/Ue2fJ72236NpESErwuEqNdOUNiVQWQ90urEggEleoOdEhSlm9 OXuYKNUmCwtxgkfAQBxnj0NZ0GS6BjTr1aNgI2t3viGBuAyVcffyHVa6EUHWzgMDPEYl J6jQAvuO8tiGwKyjebytEHpkH199OpjMVE2ychzlkNNKEGvRKIwm/z0CPuVPJCGQkO6g Zkpx3kqMXkg984l9sR1mYWAEymn0ODZfNxWuolMdzokl0am102phYlT4pM6GEBiEBqKF D7dw== X-Forwarded-Encrypted: i=1; AJvYcCV7S3hl0bxogDgUVwh92RN3ThGYvwvDXu5aqHDTBsVHHlHqT4p3QCskDiW6tXM2rQ4/Pwcaba26ePO5lvg=@vger.kernel.org X-Gm-Message-State: AOJu0Yy++WgHlr8pne6WUyAIWuIVJ72Ra/0WAQEgwWnn0TNGDButndWn /oMyWiqLkzN/GLu372vEv13Jhaxs3CIWxfcOE8k0lrETJ5i9AzAuoYyUvyMiHlU= X-Gm-Gg: ASbGncuihGXh6t+ukN0E7xB9FT0L2jirURoS6d+6KszjJPB6JEVgcsJM9WFlGXC4VWR 6nuX42FdGSw5kijw8GdOVr48FacXbigKHqf+sEczXkk1htf5qiHSJW/VXOpcZ0T8lt0HNa+w+L1 FWqPTFzmlHwUlF7ttJ79pCGD/PJdxuY7PRMWPBJ7neZRbKXfkYCnSyJaPRV5BfLRo5SLXxort8H OO9nEdLFLBYERA+J6XnBQrrXJGjz4/Ydr7I5YSNDmUQYJXDxEA8MfIT5URC9vU= X-Google-Smtp-Source: AGHT+IEy84cJ3h5ytJvCxSHHyFyZN9d/gzxb3RlphGjioGS1LvEPzNOYZA2OsynrQSHDV4AjG+98tg== X-Received: by 2002:a17:902:db0f:b0:215:4362:bc76 with SMTP id d9443c01a7336-219e6f29827mr814402335ad.54.1736001548953; Sat, 04 Jan 2025 06:39:08 -0800 (PST) Received: from localhost ([2400:4050:b783:b00:4952:3c52:120a:27e9]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-219dc963103sm262510765ad.52.2025.01.04.06.39.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Jan 2025 06:39:08 -0800 (PST) From: Akihiko Odaki Date: Sat, 04 Jan 2025 23:38:37 +0900 Subject: [PATCH v2 4/5] crash: Use note name macros Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250104-elf-v2-4-77dc2e06db4e@daynix.com> References: <20250104-elf-v2-0-77dc2e06db4e@daynix.com> In-Reply-To: <20250104-elf-v2-0-77dc2e06db4e@daynix.com> To: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Dave Martin , Baoquan He , Vivek Goyal , Dave Young Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kexec@lists.infradead.org, devel@daynix.com, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Use note name macros to match with the userspace's expectation. Signed-off-by: Akihiko Odaki --- 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" =20 -#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, =20 *phdrs_len =3D *nphdr * sizeof(struct elf_phdr); *notes_len =3D (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, st= ruct iov_iter *iter) goto out; } =20 - 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 @@ =20 #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) =20 /* 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 =3D current->pid; elf_core_copy_regs(&prstatus.pr_reg, regs); - buf =3D append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS, + buf =3D append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS, &prstatus, sizeof(prstatus)); final_note(buf); } --=20 2.47.1