Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Andrey Albershteyn <aalbersh@redhat.com>,
	"A. Wilcox" <AWilcox@wilcox-tech.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2] xfs_scrub: fix strerror_r usage yet again
Date: Sun, 28 Sep 2025 23:34:59 -0700	[thread overview]
Message-ID: <aNook1_KNirZRYY0@infradead.org> (raw)
In-Reply-To: <20250925200406.GZ8096@frogsfrogsfrogs>

On Thu, Sep 25, 2025 at 01:04:06PM -0700, Darrick J. Wong wrote:
> Then looking through the glibc repository, that 28aff047818e commit
> comes from:
> 
> https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=28aff047818eb1726394296d27b9c7885340bead;hp=9deec7c8bab24659e78172dd850f4ca37c57940c
> 
> which turns strerror into strerror_l.  This commit only appears in glibc
> 2.32, which appeared in August 2020.  That version first appears in
> Debian 12 and RHEL 9, which are still fairly new.  musl apparently has
> had strerror call strerror_l since at least 2011.
> 
> Has strerror() been designated as thread-safe at a POSIX level, or is
> this just an implementation quirk of these two C libraries?  strerror
> definitely wasn't thread-safe on glibc when I wrote this program.

No POSIX gurantee (and I don't think that matters for xfs_scrub),
but glibc before wasn't exactly thread unsafe before.  It just simply
leaked the error buffer when it had to print "unknown erorr.." for
errors now known to it.


      parent reply	other threads:[~2025-09-29  6:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 16:14 [PATCH v2] xfs_scrub: fix strerror_r usage yet again Darrick J. Wong
2025-09-20 11:21 ` A. Wilcox
2025-09-22 17:01 ` Christoph Hellwig
2025-09-24  0:53   ` Darrick J. Wong
2025-09-25  7:23     ` Christoph Hellwig
2025-09-25 20:04       ` Darrick J. Wong
2025-09-25 20:58         ` Holger Hoffstätte
2025-09-26 16:27           ` Darrick J. Wong
2025-10-03 10:07             ` Andrey Albershteyn
2025-09-29  6:34         ` Christoph Hellwig [this message]

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=aNook1_KNirZRYY0@infradead.org \
    --to=hch@infradead.org \
    --cc=AWilcox@wilcox-tech.com \
    --cc=aalbersh@redhat.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.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