public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sergey Bugaev <bugaevc@gmail.com>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: bug-hurd <bug-hurd@gnu.org>, libc-alpha@sourceware.org
Subject: Re: intr-msg / hurdsig looks broken, is my analysis correct?
Date: Wed, 1 Mar 2023 12:21:17 +0300	[thread overview]
Message-ID: <CAN9u=HdUeTE09m5gtUfEfdSy2pgKqBDVQMDw3yE2U_YJpour3g@mail.gmail.com> (raw)
In-Reply-To: <20230228210951.6ifyk7cq4ztkfbxq@begin>

On Wed, Mar 1, 2023 at 12:09 AM Samuel Thibault <samuel.thibault@gnu.org> wrote:
>
> Sergey Bugaev, le mar. 28 févr. 2023 18:53:05 +0300, a ecrit:
> > Really, why would it matter whether eip is after
> > _hurd_intr_rpc_msg_about_to or not? What if it's 1 instruction before
> > that? We skip the call, pretending it was interrupted, but does it
> > really matter that we do that — can't we just admit that the signal
> > arrived before the call, after all that's exactly how it would look if
> > we catch the thread before it enters _hurd_intr_rpc_msg_about_to?
>
> Yes, but we still need to know whether it was "about to" make an RPC,
> to determine whether to interrupt it, or let the code flow until an
> cancellation point.

Ah, right, cancellation! That explains it. Thank you for correcting me.

I was only thinking of delivering a signal, in which case, yes, it
should be fine if we just say that the signal arrived before the RPC
and did not interrupt it. But in case of cancellation (as in --
hurd_thread_cancel) we indeed need to not enter the RPC (nor *any*
interruptible RPCs?) once we're cancelled.

So then indeed we need _hurdsig_abort_rpcs to handle the case where
the eip is between the very last check for cancellation and the trap,
and make it skip over the trap. Back to my original plan then, luckily
I have the code saved in a git stash.

* eip < _hurd_intr_rpc_msg_about_to => thread is still to check
ss->cancel, so just set ss->cancel = 1;
* _hurd_intr_rpc_msg_about_to <= eip < _hurd_intr_rpc_msg_setup_done
=> thread is still to check eax, so set eax = MACH_SEND_INTERRUPTED;
* _hurd_intr_rpc_msg_setup_done <= eip => the thread will not check
anything, but we can make it skip over the trap safely, so do that.

Sergey

  reply	other threads:[~2023-03-01  9:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 13:39 Sergey Bugaev
2023-02-27 16:39 ` Samuel Thibault
2023-02-27 17:03   ` Sergey Bugaev
2023-02-27 17:28     ` Samuel Thibault
2023-02-28 15:53       ` Sergey Bugaev
2023-02-28 19:44         ` [PATCH 1/2] hurd: Fully remove the ecx kludge Sergey Bugaev
2023-02-28 19:44           ` [PATCH 2/2] hurd: Fix some broken indentation Sergey Bugaev
2023-02-28 22:16           ` [PATCH 1/2] hurd: Fully remove the ecx kludge Samuel Thibault
2023-02-28 21:09         ` intr-msg / hurdsig looks broken, is my analysis correct? Samuel Thibault
2023-03-01  9:21           ` Sergey Bugaev [this message]
2023-03-01  9:24             ` Samuel Thibault
2023-03-01 16:23               ` [PATCH 1/2] hurd: Remove the ecx kludge Sergey Bugaev
2023-03-01 16:23                 ` [PATCH 2/2] hurd: Fix some broken indentation Sergey Bugaev
2023-03-01 23:33                   ` Samuel Thibault
2023-03-01 18:01                 ` [PATCH 1/2] hurd: Remove the ecx kludge Luca
2023-03-01 18:23                   ` Samuel Thibault
2023-03-01 23:33                 ` Samuel Thibault

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='CAN9u=HdUeTE09m5gtUfEfdSy2pgKqBDVQMDw3yE2U_YJpour3g@mail.gmail.com' \
    --to=bugaevc@gmail.com \
    --cc=bug-hurd@gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=samuel.thibault@gnu.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).