#include <linux/buildid.h>
#include <linux/cache.h>
#include <linux/elf.h>
#include <linux/kernel.h>
#include <linux/pagemap.h>
#include <linux/secretmem.h>
#define BUILD_ID …
#define MAX_PHDR_CNT …
struct freader { … };
static void freader_init_from_file(struct freader *r, void *buf, u32 buf_sz,
struct file *file, bool may_fault)
{ … }
static void freader_init_from_mem(struct freader *r, const char *data, u64 data_sz)
{ … }
static void freader_put_folio(struct freader *r)
{ … }
static int freader_get_folio(struct freader *r, loff_t file_off)
{ … }
static const void *freader_fetch(struct freader *r, loff_t file_off, size_t sz)
{ … }
static void freader_cleanup(struct freader *r)
{ … }
static int parse_build_id(struct freader *r, unsigned char *build_id, __u32 *size,
loff_t note_off, Elf32_Word note_size)
{ … }
static int get_build_id_32(struct freader *r, unsigned char *build_id, __u32 *size)
{ … }
static int get_build_id_64(struct freader *r, unsigned char *build_id, __u32 *size)
{ … }
#define MAX_FREADER_BUF_SZ …
static int __build_id_parse(struct vm_area_struct *vma, unsigned char *build_id,
__u32 *size, bool may_fault)
{ … }
int build_id_parse_nofault(struct vm_area_struct *vma, unsigned char *build_id, __u32 *size)
{ … }
int build_id_parse(struct vm_area_struct *vma, unsigned char *build_id, __u32 *size)
{ … }
int build_id_parse_buf(const void *buf, unsigned char *build_id, u32 buf_size)
{ … }
#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) || IS_ENABLED(CONFIG_VMCORE_INFO)
unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX] __ro_after_init;
void __init init_vmlinux_build_id(void)
{ … }
#endif