ANDROID: kallsyms: increase KSYM_NAME_LEN
Clang generates __typeid__ symbols that are longer than 128 characters when CFI is enabled. Increase KSYM_NAME_LEN to accommodate for this. Bug: 148470764 Bug: 154088315 Change-Id: I3be253b844d48948ae85b912c432d7234ff33c48 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
parent
5b7b575d8a
commit
95ab0b827c
@ -24,12 +24,12 @@ void arch_klp_init_object_loaded(struct klp_patch *patch,
|
|||||||
objname = obj->name ? obj->name : "vmlinux";
|
objname = obj->name ? obj->name : "vmlinux";
|
||||||
|
|
||||||
/* See livepatch core code for BUILD_BUG_ON() explanation */
|
/* See livepatch core code for BUILD_BUG_ON() explanation */
|
||||||
BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 128);
|
BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 192);
|
||||||
|
|
||||||
for (s = info->sechdrs; s < info->sechdrs + info->hdr.e_shnum; s++) {
|
for (s = info->sechdrs; s < info->sechdrs + info->hdr.e_shnum; s++) {
|
||||||
/* Apply per-object .klp.arch sections */
|
/* Apply per-object .klp.arch sections */
|
||||||
cnt = sscanf(info->secstrings + s->sh_name,
|
cnt = sscanf(info->secstrings + s->sh_name,
|
||||||
".klp.arch.%55[^.].%127s",
|
".klp.arch.%55[^.].%191s",
|
||||||
sec_objname, secname);
|
sec_objname, secname);
|
||||||
if (cnt != 2)
|
if (cnt != 2)
|
||||||
continue;
|
continue;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
|
|
||||||
#define KSYM_NAME_LEN 128
|
#define KSYM_NAME_LEN 192
|
||||||
#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
|
#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
|
||||||
2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
|
2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ static int klp_resolve_symbols(Elf_Shdr *relasec, struct module *pmod)
|
|||||||
* we use the smallest/strictest upper bound possible (56, based on
|
* we use the smallest/strictest upper bound possible (56, based on
|
||||||
* the current definition of MODULE_NAME_LEN) to prevent overflows.
|
* the current definition of MODULE_NAME_LEN) to prevent overflows.
|
||||||
*/
|
*/
|
||||||
BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 128);
|
BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 192);
|
||||||
|
|
||||||
relas = (Elf_Rela *) relasec->sh_addr;
|
relas = (Elf_Rela *) relasec->sh_addr;
|
||||||
/* For each rela in this klp relocation section */
|
/* For each rela in this klp relocation section */
|
||||||
@ -224,7 +224,7 @@ static int klp_resolve_symbols(Elf_Shdr *relasec, struct module *pmod)
|
|||||||
|
|
||||||
/* Format: .klp.sym.objname.symname,sympos */
|
/* Format: .klp.sym.objname.symname,sympos */
|
||||||
cnt = sscanf(strtab + sym->st_name,
|
cnt = sscanf(strtab + sym->st_name,
|
||||||
".klp.sym.%55[^.].%127[^,],%lu",
|
".klp.sym.%55[^.].%191[^,],%lu",
|
||||||
objname, symname, &sympos);
|
objname, symname, &sympos);
|
||||||
if (cnt != 3) {
|
if (cnt != 3) {
|
||||||
pr_err("symbol %s has an incorrectly formatted name\n",
|
pr_err("symbol %s has an incorrectly formatted name\n",
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KSYM_NAME_LEN 128
|
#define KSYM_NAME_LEN 192
|
||||||
|
|
||||||
struct sym_entry {
|
struct sym_entry {
|
||||||
unsigned long long addr;
|
unsigned long long addr;
|
||||||
|
Loading…
Reference in New Issue
Block a user