]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ctf: avoid command-line length limits by passing .o filenames via a file
authorNick Alcock <nick.alcock@oracle.com>
Thu, 29 Aug 2013 14:15:35 +0000 (15:15 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:09 +0000 (15:29 +0100)
commit07a68eb7f4eacedf0187058acbeb75f03cfaf76c
treebc42bd0d41f88917996d19c6495ca127abb406de
parent239525dbfc1e1f0c28ad6a6178350baf7e35aaaa
ctf: avoid command-line length limits by passing .o filenames via a file

Historically, dwarf2ctf took the names of all object files it was to run over on
the command line.  This can lead to very long command lines, but since the kernel
now supports lines of almost unlimited length (up to RLIMIT_STACK / 4, which is
much longer than the names of all .c files in the kernel tree added together for
any reasonable stack size), this seemed safe.

It turns out not to be, because GNU Make sometimes passes command lines through
the shell even when it doesn't need to, and GNU Bash does not yet know that the
kernel has a very long command-line length limit and protests if it is
> ARG_MAX, which is much shorter.  We were trying to prevent the dwarf2ctf
command line being passed to the shell, but there is no documented way to do so
in GNU Make and clearly simply avoiding shell metacharacters is not always
enough.

So, instead, write out the list of object files to a file in the .ctf directory
and have dwarf2ctf read it in.  This takes some trickery in Makefile.modpost to
arrange to invoke a separate shell to add each filename to the filelist, but
it's not too complicated.  (To minimize the possibility of disruption, we
duplicate the code already used for reading blacklists in dwarf2ctf.  This
should be unified later.)

Orabug: 17363469
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
scripts/Makefile.modpost
scripts/dwarf2ctf/dwarf2ctf.c