public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nars at yottadb dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29863] Segmentation fault in memcmp-sse2.S if memory contents can concurrently change
Date: Tue, 13 Dec 2022 18:45:32 +0000	[thread overview]
Message-ID: <bug-29863-131-VooBg3cTlk@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29863-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29863

--- Comment #5 from Narayanan Iyer <nars at yottadb dot com> ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Narayanan Iyer from comment #3) 
> > More importantly this code works fine prior to glibc 2.36. It fails only
> > with glibc 2.36.
> 
> On x86_64. My bet it fails on most other targets and always had failed.
> The Seg fault is just saying you are violating atomicity.
> It is not only a race condition but the race condition is inside memcmp
> itself now since memcmp is not atomic for the whole length, it is a byte
> wise comparison which can be read more than once so you just happen to run
> into a bug in your code.
> Having memcmp being atomicity and reading from the memory only once is ABI
> thing really and x86_64 ABI does not talk about that. It just happened to
> work on accident does not mean the behavior should go back to what it was.

Seems to me you are saying that `memcmp()` can only be called on memory that is
guaranteed to be never changing. And that it should never be called on a shared
memory buffer whose contents could be concurrently changing as it goes into
undefined behavior territory. That does not sound right to me as we have been
using `memcmp()` with shared memory (where multiple processes write to that
memory buffer all the time) for the past 25+ years on a variety of
architectures and operating systems and have never once seen a SIG-11 in
memcmp().

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-12-13 18:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 10:49 [Bug libc/29863] New: " nars at yottadb dot com
2022-12-12 13:02 ` [Bug libc/29863] " nars at yottadb dot com
2022-12-13 18:26 ` pinskia at gcc dot gnu.org
2022-12-13 18:28 ` pinskia at gcc dot gnu.org
2022-12-13 18:33 ` nars at yottadb dot com
2022-12-13 18:39 ` pinskia at gcc dot gnu.org
2022-12-13 18:45 ` nars at yottadb dot com [this message]
2022-12-13 18:52 ` pinskia at gcc dot gnu.org
2022-12-13 19:13 ` goldstein.w.n at gmail dot com
2022-12-13 19:36 ` bhaskar at yottadb dot com
2022-12-13 20:09 ` goldstein.w.n at gmail dot com
2022-12-13 20:18 ` goldstein.w.n at gmail dot com
2022-12-13 20:46 ` nars at yottadb dot com
2022-12-13 21:09 ` hjl.tools at gmail dot com
2022-12-13 21:53 ` bhaskar at yottadb dot com
2022-12-13 23:01 ` goldstein.w.n at gmail dot com
2022-12-13 23:16 ` nars at yottadb dot com
2022-12-13 23:39 ` goldstein.w.n at gmail dot com
2022-12-14  0:14 ` goldstein.w.n at gmail dot com
2022-12-14  7:45 ` sam at gentoo dot org
2022-12-14 15:40 ` nars at yottadb dot com
2022-12-14 18:17 ` nars at yottadb dot com
2023-05-14 21:46 ` ppluzhnikov at google dot com
2023-05-14 21:48 ` ppluzhnikov at google dot com
2023-05-14 21:49 ` ppluzhnikov at google dot com

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=bug-29863-131-VooBg3cTlk@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).