[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241116072804.GA3387508@ZenIV>
Date: Sat, 16 Nov 2024 07:28:04 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Nir Lichtman <nir@...htman.org>
Cc: ebiederm@...ssion.com, kees@...nel.org, brauner@...nel.org,
jack@...e.cz, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v2] exec: make printable macro more concise
On Sat, Nov 16, 2024 at 06:12:58AM +0000, Nir Lichtman wrote:
> -#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
> +#define printable(c) (isprint(c) || isspace(c))
cat >a.c <<'EOF'
#include <ctype.h>
#include <stdio.h>
#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
int main()
{
for (int i = 0; i < 255; i++)
if (printable(i) != (isspace(i) || isprint(i)))
printf("%02x\n", i);
return 0;
}
EOF
cc a.c
LANG=C ./a.out
and watch the output. Now, whether that logics makes sense is a separate story;
that's before my time (1.3.60), so...
AFAICS, it's a filter for autoloading a binfmt module by way of an alias;
we do _not_ want to step on a random text file (back then #! had been
handled directly, prior to that area; by the time when it was made a module,
everyone probably forgot about the entire mess - that was in 2013).
So it picked the 3rd and 4th bytes of the binary and tries to modprobe
binfmt-<number>. Ho-hum... AFAICS, there hadn't been such aliases
in any binfmt module back then (or now, for that matter), so it would
have to come from userland config...
OK, 1.3.61 is when fs/binfmt_aout.c got separated from fs/exec.c and became
modular, so that's almost certainly what it had been about. Setups with
modular aout support wanting to autoload it when finally hitting an
aout binary...
These days aout support is gone. And while that stuff might have been
useful once upon a time (e.g. for binfmt_java, back when it existed),
but these days anything of that sort would be handled by binfmt_misc-based
setups.
ISTR seeing a bunch of stale binfmt_aout aliases of that form way back,
but e.g. Debian had gotten rid of those quite a while ago...
<after a bit more software coproarchaeology>
Looks like module-init-tools used to put (completely useless by that time,
due to the printf format change from %hd to %04x) aliases for binfmt_aout
into /etc/modprobe.d/aliases.conf:
alias binfmt-204 binfmt_aout
alias binfmt-263 binfmt_aout
alias binfmt-264 binfmt_aout
alias binfmt-267 binfmt_aout
alias binfmt-387 binfmt_aout
until 2011, when it had been put out of its misery.
Anyway, looks like nothing had been using that other than for aout,
aout32 and java. All of those are gone, so... is there any point
keeping that crap around?
Linus, could we simply bury that request_module("binfmt-%04x",...) in
search_binary_handler(), along with 'retry' logics in there? What
could possibly use it?
Powered by blists - more mailing lists