Revert "ANDROID: kallsyms: strip hashes from static functions with ThinLTO and CFI"

This reverts commit dd447e0f04 as the LTO
feature causes merge issues with 5.8-rc1.  So remove it for now and
allow the developer to add the latest version of the patches later on.

Cc: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Idb31c3db0d358b250b241d5c04e8bafd9cd3d2d5
This commit is contained in:
Greg Kroah-Hartman
2020-06-24 07:34:39 +02:00
parent 536adca27b
commit c5a5355e10

View File

@@ -270,24 +270,6 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
!!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
}
#if defined(CONFIG_CFI_CLANG) && defined(CONFIG_THINLTO)
/*
* LLVM appends a hash to static function names when ThinLTO and CFI are
* both enabled, which causes confusion and potentially breaks user space
* tools, so we will strip the postfix from expanded symbol names.
*/
static inline void cleanup_symbol_name(char *s)
{
char *res;
res = strrchr(s, '$');
if (res)
*res = '\0';
}
#else
static inline void cleanup_symbol_name(char *s) {}
#endif
/*
* Lookup an address
* - modname is set to NULL if it's in the kernel.
@@ -314,9 +296,7 @@ const char *kallsyms_lookup(unsigned long addr,
namebuf, KSYM_NAME_LEN);
if (modname)
*modname = NULL;
ret = namebuf;
goto found;
return namebuf;
}
/* See if it's in a module or a BPF JITed image. */
@@ -329,16 +309,11 @@ const char *kallsyms_lookup(unsigned long addr,
if (!ret)
ret = ftrace_mod_address_lookup(addr, symbolsize,
offset, modname, namebuf);
found:
cleanup_symbol_name(namebuf);
return ret;
}
int lookup_symbol_name(unsigned long addr, char *symname)
{
int res;
symname[0] = '\0';
symname[KSYM_NAME_LEN - 1] = '\0';
@@ -349,23 +324,15 @@ int lookup_symbol_name(unsigned long addr, char *symname)
/* Grab name */
kallsyms_expand_symbol(get_symbol_offset(pos),
symname, KSYM_NAME_LEN);
goto found;
return 0;
}
/* See if it's in a module. */
res = lookup_module_symbol_name(addr, symname);
if (res)
return res;
found:
cleanup_symbol_name(symname);
return 0;
return lookup_module_symbol_name(addr, symname);
}
int lookup_symbol_attrs(unsigned long addr, unsigned long *size,
unsigned long *offset, char *modname, char *name)
{
int res;
name[0] = '\0';
name[KSYM_NAME_LEN - 1] = '\0';
@@ -377,16 +344,10 @@ int lookup_symbol_attrs(unsigned long addr, unsigned long *size,
kallsyms_expand_symbol(get_symbol_offset(pos),
name, KSYM_NAME_LEN);
modname[0] = '\0';
goto found;
return 0;
}
/* See if it's in a module. */
res = lookup_module_symbol_attrs(addr, size, offset, modname, name);
if (res)
return res;
found:
cleanup_symbol_name(name);
return 0;
return lookup_module_symbol_attrs(addr, size, offset, modname, name);
}
/* Look up a kernel symbol and return it in a text buffer. */