public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Tobias Bading <tbading@web.de>
To: Godmar Back <godmar@gmail.com>
Cc: William Tambe via Libc-help <libc-help@sourceware.org>
Subject: Re: (stat(...) == -1 || faccessat(...) == -1) && errno == EINTR ?!??
Date: Mon, 15 Feb 2021 10:15:24 +0100	[thread overview]
Message-ID: <f80ab2e1-e535-2e2e-ecd5-7d1881350e47@web.de> (raw)
In-Reply-To: <CAB4+JYJ8HE4eMUU3drbXRQ-s_saC1MnB0+p+e+d91Dku5Am-ZQ@mail.gmail.com>

 > You could use systemtap to patch the kernel to see if you can trap the
 > path where they're returning `EINTR`.
 > I recently came across a blog post:
 >
https://engineering.skroutz.gr/blog/uncovering-a-24-year-old-bug-in-the-linux-kernel/
 > where some people did that and found a bug in the TCP code. Very
 > impressive.

Thanks, very interesting read indeed. I haven't heard of systemtap
before, sounds like a very cool tool for kernel hackers. Since I'm only
doing userland stuff, I usually trust Valgrind to help me out when
things get fishy.

 > I don't know if this qualifies as "breaking userland" [...]

I'd say breaking stat() qualifies big time, but to be honest I don't
really have the time/nerve to read
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap02.html
in full. The "Signal Effects on Other Functions" paragraph seems
interesting, but my head explodes when I read sentences like

   "Therefore, implementations should generally make such functions
(including ones defined as extensions) interruptible."

   "Functions not mentioned explicitly as interruptible may be so on
some implementations, possibly as an extension where the function gives
an [EINTR] error."

English isn't my first language, so I must be reading this wrong or
interpreting it in the wrong context. If a POSIX implementation was
allowed to add EINTR to the list of possible error codes returned by a
function defined in the standard, what kind of standard would that be?
How about an implementation of malloc() which returns NULL and sets
errno to EINTR when a signal is raised while the calling thread was
asleep because it was waiting for a disk read from swapspace? XD

Tobias

---

On 14.02.21 23:04, Godmar Back wrote:
> I don't know if this qualifies as "breaking userland" or "this has
> never worked."
>
> You could use systemtap to patch the kernel to see if you can trap the
> path where they're returning `EINTR`.
> I recently came across a blog post:
> https://engineering.skroutz.gr/blog/uncovering-a-24-year-old-bug-in-the-linux-kernel/
> where some people did that and found a bug in the TCP code. Very
> impressive.


  reply	other threads:[~2021-02-15  9:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14 11:13 Tobias Bading
2021-02-14 12:18 ` Tobias Bading
2021-02-14 13:17   ` Tobias Bading
2021-02-14 15:14     ` Godmar Back
2021-02-14 15:20       ` Godmar Back
2021-02-14 17:30       ` Tobias Bading
2021-02-14 22:04         ` Godmar Back
2021-02-15  9:15           ` Tobias Bading [this message]
2021-02-15  9:24             ` Florian Weimer
2021-02-15  9:43               ` Tobias Bading
2021-02-15  9:45                 ` Florian Weimer
2021-02-15 10:02                   ` Tobias Bading
2021-02-15 10:20                     ` Florian Weimer
2021-02-15 10:36                       ` Tobias Bading
2021-02-15  8:33         ` Tobias Bading
2021-02-15  8:45           ` Konstantin Kharlamov
2021-02-15 10:25             ` Tobias Bading
2021-02-14 17:56   ` Konstantin Kharlamov
2021-02-14 18:58     ` Tobias Bading
2021-02-14 20:46       ` Konstantin Kharlamov

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=f80ab2e1-e535-2e2e-ecd5-7d1881350e47@web.de \
    --to=tbading@web.de \
    --cc=godmar@gmail.com \
    --cc=libc-help@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).