Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95ab0b82 authored by Sami Tolvanen's avatar Sami Tolvanen
Browse files

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: default avatarSami Tolvanen <samitolvanen@google.com>
parent 5b7b575d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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)

+2 −2
Original line number Diff line number Diff line
@@ -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",
+1 −1
Original line number Diff line number Diff line
@@ -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;