Re: [PATCH v3 01/20] kbuild: do not allocate .modinfo in vmlinux
From: Lorenzo Stoakes (ARM)
Date: Thu Sep 17 2026 - 15:18:34 EST
On Thu, Sep 17, 2026 at 09:52:32AM -0700, Kees Cook wrote:
> On Thu, Sep 17, 2026 at 05:06:11PM +0100, Lorenzo Stoakes (ARM) wrote:
> > -# .modinfo in vmlinux.unstripped is aligned to 8 bytes for compatibility with
> > -# tools that expect vmlinux to have sufficiently aligned sections but the
> > -# additional bytes used for padding .modinfo to satisfy this requirement break
> > -# certain versions of kmod with
> > -#
> > -# depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname prefix
> > -#
> > -# Strip the trailing padding bytes after extracting .modinfo to comply with
> > -# what kmod expects to parse.
>
> This comment still seems useful here (afaict the stripping is still
> happening with the "sed"). Maybe better to leave it, or future readers
> are left wondering what the sed is for?
Ack will restore!
>
> > quiet_cmd_modules_builtin_modinfo = GEN $@
> > - cmd_modules_builtin_modinfo = $(cmd_objcopy); \
> > - sed -i 's/\x00\+$$/\x00/g' $@; \
> > - chmod -x $@
> > -
> > -OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
> > + cmd_modules_builtin_modinfo = $(OBJCOPY) -O binary -j .modinfo --dump-section .modinfo=$@ $< $@.tmp; \
> > + rm -f $@.tmp; \
> > + sed -i 's/\x00\+$$/\x00/g' $@
>
> Otherwise, looks good. With the comment back (or rewritten):
>
> Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
Thanks!
>
> -Kees
>
> --
> Kees Cook
--
Cheers, Lorenzo