git: 327ada0b0ec0 - main - imgact_elf: Add const to the header_supported callback arguments

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 04 Mar 2024 19:55:24 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=327ada0b0ec0044cea016f7e8333a5a3754eb8af

commit 327ada0b0ec0044cea016f7e8333a5a3754eb8af
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2024-03-04 19:52:21 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-03-04 19:52:21 +0000

    imgact_elf: Add const to the header_supported callback arguments
    
    This callback shouldn't be modifying any of the arguments.
    
    Reviewed by:    imp, kib, emaste, jhb
    Obtained from:  CheriBSD
    Differential Revision:  https://reviews.freebsd.org/D44193
---
 sys/amd64/amd64/elf_machdep.c       |  4 ++--
 sys/arm/arm/elf_machdep.c           |  8 ++++----
 sys/arm64/arm64/elf32_machdep.c     |  8 ++++----
 sys/powerpc/powerpc/elf64_machdep.c | 16 ++++++++--------
 sys/sys/imgact_elf.h                |  4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c
index a66faf3d347e..0e6c8d310dfd 100644
--- a/sys/amd64/amd64/elf_machdep.c
+++ b/sys/amd64/amd64/elf_machdep.c
@@ -165,8 +165,8 @@ amd64_lower_shared_page(struct sysentvec *sv)
 }
 
 static bool
-freebsd_brand_info_la57_img_compat(struct image_params *imgp,
-    int32_t *osrel __unused, uint32_t *fctl0)
+freebsd_brand_info_la57_img_compat(const struct image_params *imgp,
+    const int32_t *osrel __unused, const uint32_t *fctl0)
 {
 	if ((imgp->proc->p_md.md_flags & P_MD_LA57) != 0)
 		return (true);
diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c
index 7c91dfe3babc..e1003b71543a 100644
--- a/sys/arm/arm/elf_machdep.c
+++ b/sys/arm/arm/elf_machdep.c
@@ -54,8 +54,8 @@
 #include "opt_global.h"         /* for OPT_KDTRACE_HOOKS */
 #include "opt_stack.h"          /* for OPT_STACK */
 
-static bool elf32_arm_abi_supported(struct image_params *, int32_t *,
-    uint32_t *);
+static bool elf32_arm_abi_supported(const struct image_params *,
+    const int32_t *, const uint32_t *);
 
 u_long elf_hwcap;
 u_long elf_hwcap2;
@@ -121,8 +121,8 @@ SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
 	&freebsd_brand_info);
 
 static bool
-elf32_arm_abi_supported(struct image_params *imgp, int32_t *osrel __unused,
-    uint32_t *fctl0 __unused)
+elf32_arm_abi_supported(const struct image_params *imgp,
+    const int32_t *osrel __unused, const uint32_t *fctl0 __unused)
 {
 	const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
 
diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
index de0ee9607ad1..fd2a2690b7a1 100644
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -76,8 +76,8 @@ static void freebsd32_setregs(struct thread *td, struct image_params *imgp,
     u_long stack);
 static void freebsd32_set_syscall_retval(struct thread *, int);
 
-static bool elf32_arm_abi_supported(struct image_params *, int32_t *,
-    uint32_t *);
+static bool elf32_arm_abi_supported(const struct image_params *,
+    const int32_t *, const uint32_t *);
 static void elf32_fixlimit(struct rlimit *rl, int which);
 
 extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
@@ -167,8 +167,8 @@ register_elf32_brand(void *arg)
 SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, register_elf32_brand, NULL);
 
 static bool
-elf32_arm_abi_supported(struct image_params *imgp, int32_t *osrel __unused,
-    uint32_t *fctl0 __unused)
+elf32_arm_abi_supported(const struct image_params *imgp,
+    const int32_t *osrel __unused, const uint32_t *fctl0 __unused)
 {
 	const Elf32_Ehdr *hdr;
 
diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c
index 6edfd965b7ec..b780a2ed82fc 100644
--- a/sys/powerpc/powerpc/elf64_machdep.c
+++ b/sys/powerpc/powerpc/elf64_machdep.c
@@ -145,10 +145,10 @@ struct sysentvec elf64_freebsd_sysvec_v2 = {
 	.sv_regset_end  = SET_LIMIT(__elfN(regset)),
 };
 
-static bool ppc64_elfv1_header_match(struct image_params *params,
-    int32_t *, uint32_t *);
-static bool ppc64_elfv2_header_match(struct image_params *params,
-    int32_t *, uint32_t *);
+static bool ppc64_elfv1_header_match(const struct image_params *params,
+    const int32_t *, const uint32_t *);
+static bool ppc64_elfv2_header_match(const struct image_params *params,
+    const int32_t *, const uint32_t *);
 
 static Elf64_Brandinfo freebsd_brand_info_elfv1 = {
 	.brand		= ELFOSABI_FREEBSD,
@@ -221,8 +221,8 @@ ppc64_init_sysvecs(void *arg)
 SYSINIT(elf64_sysvec, SI_SUB_EXEC, SI_ORDER_ANY, ppc64_init_sysvecs, NULL);
 
 static bool
-ppc64_elfv1_header_match(struct image_params *params, int32_t *osrel __unused,
-    uint32_t *fctl0 __unused)
+ppc64_elfv1_header_match(const struct image_params *params,
+    const int32_t *osrel __unused, const uint32_t *fctl0 __unused)
 {
 	const Elf64_Ehdr *hdr = (const Elf64_Ehdr *)params->image_header;
 	int abi = (hdr->e_flags & 3);
@@ -231,8 +231,8 @@ ppc64_elfv1_header_match(struct image_params *params, int32_t *osrel __unused,
 }
 
 static bool
-ppc64_elfv2_header_match(struct image_params *params, int32_t *osrel __unused,
-    uint32_t *fctl0 __unused)
+ppc64_elfv2_header_match(const struct image_params *params,
+    const int32_t *osrel __unused, const uint32_t *fctl0 __unused)
 {
 	const Elf64_Ehdr *hdr = (const Elf64_Ehdr *)params->image_header;
 	int abi = (hdr->e_flags & 3);
diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h
index 51e149476a28..3ddb438e14fc 100644
--- a/sys/sys/imgact_elf.h
+++ b/sys/sys/imgact_elf.h
@@ -86,8 +86,8 @@ typedef struct {
 	const char *interp_newpath;
 	int flags;
 	Elf_Brandnote *brand_note;
-	bool		(*header_supported)(struct image_params *,
-	    int32_t *, uint32_t *);
+	bool		(*header_supported)(const struct image_params *,
+	    const int32_t *, const uint32_t *);
 		/* High 8 bits of flags is private to the ABI */
 #define	BI_CAN_EXEC_DYN		0x0001
 #define	BI_BRAND_NOTE		0x0002	/* May have note.ABI-tag section. */