From nobody Thu Dec 18 13:45:52 2025 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 7854B2309A5 for ; Wed, 15 Jan 2025 05:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736920153; cv=none; b=oAZ5qUMFauxyYlieDJQnj6+nrBnRnFGLuB3Q7gn+AWhBopwuYwiC4916f1NpMbdxHLRZi59ZpEzWCKYCID77opudUWgMZXXfBtKsE4iPgFugv9q/GC2EKcu1cuz/STH5ZiYlSL3X8c0KXRyuZ9DeD68xBf+f41LigldaORamx7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736920153; c=relaxed/simple; bh=JF3FfcrCfNzsuJEQqs2GHPMkdzmPYzsry0avRsoHtk4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OKr81a1WorOkxsHnKSvacI9w+urbWiOD20dcsgx3tCEmdp8mYfhVULjZVHDKoK7mElzjCRPz00mMIFhUQFrG6PzMpXbzHuOwMtZAZFocS9ASt4iFIEMQ9DypHqtZVay9gJXbmcusGt3X8D1qYajByD5tbC0nPJzjcZmaGDX4jHI= 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=wESmEgiD; arc=none smtp.client-ip=209.85.214.172 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="wESmEgiD" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-21644aca3a0so138939625ad.3 for ; Tue, 14 Jan 2025 21:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736920151; x=1737524951; 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=gqxfn2Bh8pqSgpWAhYuCaH8o2BUeXgVOaRACTrcmMAY=; b=wESmEgiD7hn3U+PaL+I6rdb9VBHeGpO4JRPnv2iDRb73IF9jAXhpbMm8LaNrr5I6Hm bqgPKCYlmNLSUoROqYDaw6OxrmMW5i5AcIpupg9E4We5Lw1/0J77DfjKKeo9Bvb2rtbl yH7iSQvW0u5JojIPkkqsGHlisHu7brFQ8neFgArhax1xuX6IP++qTvYPSp3k7FLsaLvC D+lvoAevauVTfEEZFCgp8Y0IxClAEXEzfrqGZWD//mqsXAsegAxyfnyqF8c37Sw6199o NvVkq7qVQZ4TJ1bzxgHWwfI7w7IOmamdXwFKHqblntOM4bcdXvshfMkrT+HUbw0HiF0k +jXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736920151; x=1737524951; 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=gqxfn2Bh8pqSgpWAhYuCaH8o2BUeXgVOaRACTrcmMAY=; b=ZwpzhAp43oBMBk57r7J9oylTbaD9AkaSIZib+e/+l7FYHJRtAGwvUgRoC8UhbCa5eF ldJVz0+9bIhKfpo0AbSWJbu5T4aU+0SdYZiLdGXnWzqatxySf6pb4VImDF0+2/3pYbLA R1ppKISvLJLa2/9RWv3AzImGzMz9RPu+nxNKgEcZBEOa6+wAlijH3Zlq5qY8i82rlZuV vTU3y1AoRVNudwdk6rHeXJ0SYYfS7tsF3VlOTIWMJ1zpAO4P4I703OD661ptkxezvqSt jODMMHJXXiYWhZV4LqpIJZcgY9JSFS8qTffEKSi8nDwt97d1+RJMqFPRHHsmIIa3+n9z HHUg== X-Forwarded-Encrypted: i=1; AJvYcCXHwP/j2QGgZHbCJZpUfiB088555u21E7cS+F2Gh6rUC+K9RP+rOossHAHVBgsEGr6scw0Lvz5nd8DyYy4=@vger.kernel.org X-Gm-Message-State: AOJu0YxOObXb4/l1xuRUPbYN8mD4+UzeHf///a30Lrx8IqrGwnAzH5EB 7GgD4NgUq+I0Km6o0mciriTzL0Usy+NxYeEoc9Lc7GLdkfwlvi3w1oiq8B+rOm0= X-Gm-Gg: ASbGnctYWfop7flD6IP0/cdJkVFtsz30X13hIxbxJX3UakJViV1Ey3pTt0/4YCGGJgI T5iwoHWSp7kqSqGcCqOyC8I2DCYlHRSnDZNc7L12WPNRSRQcoSGv8Erh3CXHaFEuWUbynVd6E5i Iv5c43Hun5SQ4S/OVqJ1QlYYD2Yvr/m86baEZoZ3Cm/QbNl+10QQtaAAhGmSRdxafhKprbQ9J4N C4dGJguPNuBu1EqeXN+Ne9723soaB/s9xbWXIgqMKtXnDrey+GE0DYezRE= X-Google-Smtp-Source: AGHT+IGEE8Fm6k+e43goXL9XR3kNG0Qk7QvIMeGK5viYe25EF4qO0xqHuY9x+AzGWdKmvE+R7dTOXQ== X-Received: by 2002:a05:6a21:1087:b0:1e1:b727:181a with SMTP id adf61e73a8af0-1e88cfd3cb1mr47297876637.24.1736920150754; Tue, 14 Jan 2025 21:49:10 -0800 (PST) Received: from localhost ([157.82.203.37]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-72d406a94b8sm8295174b3a.167.2025.01.14.21.49.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jan 2025 21:49:10 -0800 (PST) From: Akihiko Odaki Date: Wed, 15 Jan 2025 14:48:02 +0900 Subject: [PATCH v5 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: <20250115-elf-v5-5-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 , 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 Reviewed-by: Dave Martin --- 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