From: Al Viro <viro@zeniv.linux.org.uk>
To: Nir Lichtman <nir@lichtman.org>
Cc: ebiederm@xmission.com, kees@kernel.org, brauner@kernel.org,
jack@suse.cz, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v2] exec: make printable macro more concise
Date: Sat, 16 Nov 2024 07:28:04 +0000 [thread overview]
Message-ID: <20241116072804.GA3387508@ZenIV> (raw)
In-Reply-To: <20241116061258.GA216473@lichtman.org>
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?
next prev parent reply other threads:[~2024-11-16 7:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-16 6:12 [PATCH v2] exec: make printable macro more concise Nir Lichtman
2024-11-16 7:28 ` Al Viro [this message]
2024-11-16 16:49 ` Linus Torvalds
2024-11-16 17:23 ` Nir Lichtman
2024-11-16 22:06 ` Al Viro
2024-11-16 22:38 ` Nir Lichtman
2024-11-16 21:48 ` Al Viro
2024-11-18 11:46 ` Rasmus Villemoes
2024-11-18 17:07 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241116072804.GA3387508@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=jack@suse.cz \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nir@lichtman.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox