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:
Sami Tolvanen 2020-02-20 14:47:59 -08:00
parent 5b7b575d8a
commit 95ab0b827c
4 changed files with 6 additions and 6 deletions

View File

@ -24,12 +24,12 @@ void arch_klp_init_object_loaded(struct klp_patch *patch,
objname = obj->name ? obj->name : "vmlinux";
/* 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++) {
/* Apply per-object .klp.arch sections */
cnt = sscanf(info->secstrings + s->sh_name,
".klp.arch.%55[^.].%127s",
".klp.arch.%55[^.].%191s",
sec_objname, secname);
if (cnt != 2)
continue;

View File

@ -14,7 +14,7 @@
#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) + \
2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)

View File

@ -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
* 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;
/* 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 */
cnt = sscanf(strtab + sym->st_name,
".klp.sym.%55[^.].%127[^,],%lu",
".klp.sym.%55[^.].%191[^,],%lu",
objname, symname, &sympos);
if (cnt != 3) {
pr_err("symbol %s has an incorrectly formatted name\n",

View File

@ -28,7 +28,7 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
#define KSYM_NAME_LEN 128
#define KSYM_NAME_LEN 192
struct sym_entry {
unsigned long long addr;