Thomas Gleixner | b4d0d23 | 2019-05-20 19:08:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Rusty Russell | 106a4ee | 2012-09-26 10:09:40 +0100 | [diff] [blame] | 2 | /* Module internals |
| 3 | * |
| 4 | * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. |
| 5 | * Written by David Howells (dhowells@redhat.com) |
Rusty Russell | 106a4ee | 2012-09-26 10:09:40 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
Jessica Yu | f314dfe | 2018-06-29 16:37:08 +0200 | [diff] [blame] | 8 | #include <linux/elf.h> |
| 9 | #include <asm/module.h> |
| 10 | |
| 11 | struct load_info { |
| 12 | const char *name; |
| 13 | /* pointer to module in temporary copy, freed at end of load_module() */ |
| 14 | struct module *mod; |
| 15 | Elf_Ehdr *hdr; |
| 16 | unsigned long len; |
| 17 | Elf_Shdr *sechdrs; |
| 18 | char *secstrings, *strtab; |
Eugene Loh | 1c7651f | 2019-02-25 11:59:58 -0800 | [diff] [blame] | 19 | unsigned long symoffs, stroffs, init_typeoffs, core_typeoffs; |
Jessica Yu | f314dfe | 2018-06-29 16:37:08 +0200 | [diff] [blame] | 20 | struct _ddebug *debug; |
| 21 | unsigned int num_debug; |
| 22 | bool sig_ok; |
| 23 | #ifdef CONFIG_KALLSYMS |
| 24 | unsigned long mod_kallsyms_init_off; |
| 25 | #endif |
Dmitry Torokhov | b1ae6dc | 2022-01-05 13:55:12 -0800 | [diff] [blame] | 26 | #ifdef CONFIG_MODULE_DECOMPRESS |
| 27 | struct page **pages; |
| 28 | unsigned int max_pages; |
| 29 | unsigned int used_pages; |
| 30 | #endif |
Jessica Yu | f314dfe | 2018-06-29 16:37:08 +0200 | [diff] [blame] | 31 | struct { |
| 32 | unsigned int sym, str, mod, vers, info, pcpu; |
| 33 | } index; |
| 34 | }; |
| 35 | |
| 36 | extern int mod_verify_sig(const void *mod, struct load_info *info); |
Dmitry Torokhov | b1ae6dc | 2022-01-05 13:55:12 -0800 | [diff] [blame] | 37 | |
| 38 | #ifdef CONFIG_MODULE_DECOMPRESS |
| 39 | int module_decompress(struct load_info *info, const void *buf, size_t size); |
| 40 | void module_decompress_cleanup(struct load_info *info); |
| 41 | #else |
| 42 | static inline int module_decompress(struct load_info *info, |
| 43 | const void *buf, size_t size) |
| 44 | { |
| 45 | return -EOPNOTSUPP; |
| 46 | } |
| 47 | static inline void module_decompress_cleanup(struct load_info *info) |
| 48 | { |
| 49 | } |
| 50 | #endif |