git: 403c7ef8e853 - stable/14 - imgact_elf: Export __elfN(parse_notes)

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 19 Feb 2024 16:45:19 UTC
The branch stable/14 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=403c7ef8e853544227fc18d41fed6a019d26cc52

commit 403c7ef8e853544227fc18d41fed6a019d26cc52
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-11-01 15:18:12 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-19 13:12:51 +0000

    imgact_elf: Export __elfN(parse_notes)
    
    This is useful to check if a note is present and contains an expected
    value, e.g. to read NT_GNU_PROPERTY_TYPE_0 on arm64 to see if we should
    enable BTI.
    
    Reviewed by:    kib, markj
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D42439
    
    (cherry picked from commit a04633cef81e3b29da4eb214331bd472fc2e9238)
---
 sys/kern/imgact_elf.c | 2 +-
 sys/sys/imgact_elf.h  | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 0b22e113b3d7..23ddf3ac717a 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2704,7 +2704,7 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep)
 }
 
 #define	MAX_NOTES_LOOP	4096
-static bool
+bool
 __elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote,
     const char *note_vendor, const Elf_Phdr *pnote,
     bool (*cb)(const Elf_Note *, void *, bool *), void *cb_arg)
diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h
index 7210fc2187a9..51e149476a28 100644
--- a/sys/sys/imgact_elf.h
+++ b/sys/sys/imgact_elf.h
@@ -123,6 +123,9 @@ void	__elfN(prepare_notes)(struct thread *, struct note_info_list *,
 void	__elfN(size_segments)(struct thread *, struct sseg_closure *, int);
 size_t	__elfN(register_note)(struct thread *, struct note_info_list *,
 	    int, outfunc_t, void *);
+bool	__elfN(parse_notes)(struct image_params *, Elf_Note *, const char *,
+	    const Elf_Phdr *, bool (*)(const Elf_Note *, void *, bool *),
+	    void *);
 
 /* Machine specific function to dump per-thread information. */
 void	__elfN(dump_thread)(struct thread *, void *, size_t *);