mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Markus Wichmann <nullplan@gmx.net>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] [RFC] trap on invalid printf formats
Date: Thu, 22 Jun 2023 10:45:50 -0400	[thread overview]
Message-ID: <20230622144550.GN4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <ZJRcSlsnukcVuXqW@voyager>

On Thu, Jun 22, 2023 at 04:35:54PM +0200, Markus Wichmann wrote:
> Am Wed, Jun 21, 2023 at 05:37:49PM -0400 schrieb Rich Felker:
> > Inspired by a new instance of some bitrotted software using %Lu
> > instead of %llu, attached is a draft patch to catch such errors rather
> > than silently leaving missing output.
> >
> 
> Ah, it's the old dichotomy: For developers, this is nice, since it
> catches bad behavior in a way that is impossible to ignore. For users,
> this is horrible, since it crashes bad applications, maybe just before
> they could save their data. And making the behavior selectable is
> probably not sensible.
> 
> As I count myself among the former group, I do support this move. But
> then, I do not run a distro, and the only computer I am responsible for
> is my own.

Even for users, I'm not so sure of that. The distinction is
potentially between crashing while writing out a new file containing
corrupted data before rename()ing it over the old file, and silently
succeeding then rename()ing the corrupted file over the old file.

(Note that this is only silent if you don't check for errors, but if
anyone using invalid formats were checking for errors, it seems these
errors would necessarily have been reported. Unless they just check
ferror() at the end, and we're not setting the FILE error flag on
format string errors...which we probably should do if we don't switch
to trapping.)

FWIW I don't think there are a lot of these cases left in the wild at
all, but I'm not sure. it might be nice to do some distro-wide testing
with this patch applied (which is what I had in mind posting it) and
see if any problems are caught before really considering whether to
pursue upstreaming it.

Rich

  reply	other threads:[~2023-06-22 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 21:37 Rich Felker
2023-06-21 22:10 ` enh
2023-06-22 14:35 ` Markus Wichmann
2023-06-22 14:45   ` Rich Felker [this message]
2023-06-22 23:37     ` Alex Xu (Hello71)
2023-06-22 23:51       ` Rich Felker

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=20230622144550.GN4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=nullplan@gmx.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).