From nobody Sun Feb 8 17:22:01 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 A1AC617AE1D for ; Sat, 11 Jan 2025 05:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736574572; cv=none; b=E0koGsaTBKrgTRmdeqWLh4rNFJEGZBPFVkmL9PLTM5/JLAYmKP4NGEyvwDAv4bonjmz1coLYrsUn0jpZ7bE06AWOP2/eOqFrVjh0pGa+MF8VzOrT6sBZztXMXe8Koie+NuKLjcOgWS3l6nPzP08u50Qsl8lz2Yq+0L+cT44qhvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736574572; c=relaxed/simple; bh=mHSW1WEkXDkBWrq6qMSxAX18x10mEd9VCZKfNzeGoSg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L5qK4/VdttJduyFfFqFVPzfhdCoVbYbx46lFNiOyj9iG1z84ey8kBxBudKSLXZk3jWd9MKTOMtnkK/qY1wY26Eim68q8eR7l47jS7Xkrll2kp1NO+gfkZL6J+TvDx6KCIvvJmGLqQANaeZ0no7RGYqAmjLVrITjKSNgs9h4RCk8= 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=zTF1Faat; arc=none smtp.client-ip=209.85.214.179 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="zTF1Faat" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2164b1f05caso47690945ad.3 for ; Fri, 10 Jan 2025 21:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736574570; x=1737179370; 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=2jKrk3bVYPr7k5YkzhCVfFSlyEMyT0et7JHsh9IpwE8=; b=zTF1FaatlcDPd48iIBxUVAheWSPySalD706hxrZTAvkdn5zyRhKV1wX1tpMPC8NVHZ GTS8M7nR6i8VYG/CDw+T2O++wU1UVjI91Wx0I84/l2ChZjj/FHup027bN3BYPx/AHoJA CLTVTMiSDinnphuCDN+HnWMnEatUC6hWJU8C0QVB9dE6nsjZXzkT9y+hes3AP9Swo5r4 XGBw5+3q5tLfp85w0pmstssmvNVhony0RWva9oatBLknZwobuNkDHQQFlj7/t3Ry+Mur 7r4wJIcLw0mW7BG3VjkcrwMf/utrCXxqKNoTUYr45hmAnNG5Q1FNuXu/O4HkqDjkHMfL g4PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736574570; x=1737179370; 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=2jKrk3bVYPr7k5YkzhCVfFSlyEMyT0et7JHsh9IpwE8=; b=IUQzT/X4dZTEJpPCAqFmkj+Qhog+E+K5Ckn8cSvGlHdo2srFKO7bScC15vPolmLZV+ fzIUrL3i1EhSYyGSqrAwgQlpbN4PLowEnnmI59ibhVkHAvlHA3T/IsubgHXaRSzqmlKD UQp9JNMjzc1SQmacDXEdacsBtL81ipMAlgqcZfO5GxUe2T3BEE5xI+hDx5pCfl1CHu5A oClirE86XCuvmF0P/cwQ5KeM32LH7JLQaMFbrnv0QuR1ugpneRDo09c2pT5kXWA5sR5B 1iQcF5vyUNIGGs/30i6Qz+FbiT3J5+leljI5X5h5mfVh+OlC3/7gFeh1kdpdFJa0FFi4 YMhg== X-Forwarded-Encrypted: i=1; AJvYcCVz6zcnDX7zPTIvpxzbNK/dlB6Kf7S41Kd2vvKRfs2d+RvWuFYrwlfejWD0aoMQBl9e04eXUXB1UVWDzRo=@vger.kernel.org X-Gm-Message-State: AOJu0YxZgKGcvTGVxpRMbks5Cw0ZEIcDr/TIYJYeZk84eA1zys+FGGMi lw5Wk2UM97pwZCZdrNEcI1gyiZWrUyO5KDGhCL8oze+LYYuUJiBVpHiQN8EP8pM= X-Gm-Gg: ASbGncs17IX5srHyzN8ErydgyfiWiEfQ0MGQy0chkm4NxLqhqaM2yk4HRpx05AMN/s7 dyOOWs/yPSe1d6voXH5uywWkwc70o7chHwS5+rLV9Xq1RGO8jTBFSdVNvqXsb0DBl7Me3HbZKdP vL+mZCvdZVwc8kh5kgBbXlntlPer8lVcTfSLDoF5UwUI6Esd01h1MFLJWWt5pNhxwSkpOn50n6J IC+RwQyYtoKdgIlsxHoiWmGOVmDpXy2KNfzc6jUHXUjrNJ400IfZu2RYfs= X-Google-Smtp-Source: AGHT+IF/DO7Xc25oCNYWji4iMt60P0/C5k2sp2lZQdBF9bk3Ar0+kFGVzpELgHH1uV8P5GY4v7KRrA== X-Received: by 2002:a17:902:e84f:b0:216:410d:4c53 with SMTP id d9443c01a7336-21a83fc6db1mr183636355ad.41.1736574570100; Fri, 10 Jan 2025 21:49:30 -0800 (PST) Received: from localhost ([157.82.203.37]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-21a9f217d56sm21372405ad.141.2025.01.10.21.49.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 21:49:29 -0800 (PST) From: Akihiko Odaki Date: Sat, 11 Jan 2025 14:48:48 +0900 Subject: [PATCH v4 5/6] s390/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: <20250111-elf-v4-5-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 , Heiko Carstens X-Mailer: b4 0.14-dev-fd6e3 Use note name macros to match with the userspace's expectation. Signed-off-by: Akihiko Odaki Acked-by: Heiko Carstens --- arch/s390/kernel/crash_dump.c | 62 ++++++++++++++++-----------------------= ---- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index cd0c93a8fb8b..022f4f198edf 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -248,15 +248,6 @@ bool is_kdump_kernel(void) } EXPORT_SYMBOL_GPL(is_kdump_kernel); =20 -static const char *nt_name(Elf64_Word type) -{ - const char *name =3D "LINUX"; - - if (type =3D=3D NT_PRPSINFO || type =3D=3D NT_PRSTATUS || type =3D=3D NT_= PRFPREG) - name =3D KEXEC_CORE_NOTE_NAME; - return name; -} - /* * Initialize ELF note */ @@ -281,10 +272,8 @@ static void *nt_init_name(void *buf, Elf64_Word type, = void *desc, int d_len, return PTR_ADD(buf, len); } =20 -static inline void *nt_init(void *buf, Elf64_Word type, void *desc, int d_= len) -{ - return nt_init_name(buf, type, desc, d_len, nt_name(type)); -} +#define nt_init(buf, type, desc) \ + nt_init_name(buf, NT_ ## type, &(desc), sizeof(desc), NN_ ## type) =20 /* * Calculate the size of ELF note @@ -300,10 +289,7 @@ static size_t nt_size_name(int d_len, const char *name) return size; } =20 -static inline size_t nt_size(Elf64_Word type, int d_len) -{ - return nt_size_name(d_len, nt_name(type)); -} +#define nt_size(type, desc) nt_size_name(sizeof(desc), NN_ ## type) =20 /* * Fill ELF notes for one CPU with save area registers @@ -324,18 +310,16 @@ static void *fill_cpu_elf_notes(void *ptr, int cpu, s= truct save_area *sa) memcpy(&nt_fpregset.fpc, &sa->fpc, sizeof(sa->fpc)); memcpy(&nt_fpregset.fprs, &sa->fprs, sizeof(sa->fprs)); /* Create ELF notes for the CPU */ - ptr =3D nt_init(ptr, NT_PRSTATUS, &nt_prstatus, sizeof(nt_prstatus)); - ptr =3D nt_init(ptr, NT_PRFPREG, &nt_fpregset, sizeof(nt_fpregset)); - ptr =3D nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer)); - ptr =3D nt_init(ptr, NT_S390_TODCMP, &sa->todcmp, sizeof(sa->todcmp)); - ptr =3D nt_init(ptr, NT_S390_TODPREG, &sa->todpreg, sizeof(sa->todpreg)); - ptr =3D nt_init(ptr, NT_S390_CTRS, &sa->ctrs, sizeof(sa->ctrs)); - ptr =3D nt_init(ptr, NT_S390_PREFIX, &sa->prefix, sizeof(sa->prefix)); + ptr =3D nt_init(ptr, PRSTATUS, nt_prstatus); + ptr =3D nt_init(ptr, PRFPREG, nt_fpregset); + ptr =3D nt_init(ptr, S390_TIMER, sa->timer); + ptr =3D nt_init(ptr, S390_TODCMP, sa->todcmp); + ptr =3D nt_init(ptr, S390_TODPREG, sa->todpreg); + ptr =3D nt_init(ptr, S390_CTRS, sa->ctrs); + ptr =3D nt_init(ptr, S390_PREFIX, sa->prefix); if (cpu_has_vx()) { - ptr =3D nt_init(ptr, NT_S390_VXRS_HIGH, - &sa->vxrs_high, sizeof(sa->vxrs_high)); - ptr =3D nt_init(ptr, NT_S390_VXRS_LOW, - &sa->vxrs_low, sizeof(sa->vxrs_low)); + ptr =3D nt_init(ptr, S390_VXRS_HIGH, sa->vxrs_high); + ptr =3D nt_init(ptr, S390_VXRS_LOW, sa->vxrs_low); } return ptr; } @@ -348,16 +332,16 @@ static size_t get_cpu_elf_notes_size(void) struct save_area *sa =3D NULL; size_t size; =20 - size =3D nt_size(NT_PRSTATUS, sizeof(struct elf_prstatus)); - size +=3D nt_size(NT_PRFPREG, sizeof(elf_fpregset_t)); - size +=3D nt_size(NT_S390_TIMER, sizeof(sa->timer)); - size +=3D nt_size(NT_S390_TODCMP, sizeof(sa->todcmp)); - size +=3D nt_size(NT_S390_TODPREG, sizeof(sa->todpreg)); - size +=3D nt_size(NT_S390_CTRS, sizeof(sa->ctrs)); - size +=3D nt_size(NT_S390_PREFIX, sizeof(sa->prefix)); + size =3D nt_size(PRSTATUS, struct elf_prstatus); + size +=3D nt_size(PRFPREG, elf_fpregset_t); + size +=3D nt_size(S390_TIMER, sa->timer); + size +=3D nt_size(S390_TODCMP, sa->todcmp); + size +=3D nt_size(S390_TODPREG, sa->todpreg); + size +=3D nt_size(S390_CTRS, sa->ctrs); + size +=3D nt_size(S390_PREFIX, sa->prefix); if (cpu_has_vx()) { - size +=3D nt_size(NT_S390_VXRS_HIGH, sizeof(sa->vxrs_high)); - size +=3D nt_size(NT_S390_VXRS_LOW, sizeof(sa->vxrs_low)); + size +=3D nt_size(S390_VXRS_HIGH, sa->vxrs_high); + size +=3D nt_size(S390_VXRS_LOW, sa->vxrs_low); } =20 return size; @@ -373,7 +357,7 @@ static void *nt_prpsinfo(void *ptr) memset(&prpsinfo, 0, sizeof(prpsinfo)); prpsinfo.pr_sname =3D 'R'; strcpy(prpsinfo.pr_fname, "vmlinux"); - return nt_init(ptr, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo)); + return nt_init(ptr, PRPSINFO, prpsinfo); } =20 /* @@ -589,7 +573,7 @@ static size_t get_elfcorehdr_size(int phdr_count) /* PT_NOTES */ size +=3D sizeof(Elf64_Phdr); /* nt_prpsinfo */ - size +=3D nt_size(NT_PRPSINFO, sizeof(struct elf_prpsinfo)); + size +=3D nt_size(PRPSINFO, struct elf_prpsinfo); /* regsets */ size +=3D get_cpu_cnt() * get_cpu_elf_notes_size(); /* nt_vmcoreinfo */ --=20 2.47.1