Re: linux-next: Tree for Mar 19

Miguel Ojeda
2021-03-20T11:17:16Z

On Sat, Mar 20, 2021 at 7:07 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Sorry for that, and thanks a lot for taking a look. For the Rust
> support I had to increase a few limits, mainly the symbol length. Let
> me check and I'll report back.

Reproduced on s390. However, under defconfig, one also needs to revert
kernel/livepatch/core.c to avoid triggering the assert, i.e.:

diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index a33f3dcde593..eed280fae433 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -18,7 +18,7 @@
#endif

/* Chosen so that structs with an unsigned long line up. */
-#define MAX_PARAM_PREFIX_LEN (256 - sizeof(unsigned long))
+#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))

#define __MODULE_INFO(tag, name, info) \
static const char __UNIQUE_ID(name)[] \
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 080ebb94d012..1e1699cc3fd6 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -213,7 +213,7 @@ static int klp_resolve_symbols(Elf64_Shdr
*sechdrs, const char *strtab,
* we use the smallest/strictest upper bound possible (248, based on
* the current definition of MODULE_NAME_LEN) to prevent overflows.
*/
- BUILD_BUG_ON(MODULE_NAME_LEN < 248 || KSYM_NAME_LEN != 512);
+ BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 512);

relas = (Elf_Rela *) relasec->sh_addr;
/* For each rela in this klp relocation section */
@@ -227,7 +227,7 @@ static int klp_resolve_symbols(Elf64_Shdr
*sechdrs, const char *strtab,

/* Format: .klp.sym.sym_objname.sym_name,sympos */
cnt = sscanf(strtab + sym->st_name,
- ".klp.sym.%247[^.].%511[^,],%lu",
+ ".klp.sym.%55[^.].%511[^,],%lu",
sym_objname, sym_name, &sympos);
if (cnt != 3) {
pr_err("symbol %s has an incorrectly formatted name\n",

Cheers,
Miguel