public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: bug-hurd@gnu.org, libc-alpha@sourceware.org
Subject: Re: [PATCH 1/2] hurd: Fully remove the ecx kludge
Date: Tue, 28 Feb 2023 23:16:41 +0100	[thread overview]
Message-ID: <20230228221641.4pz56lfkwze3bl2b@begin> (raw)
In-Reply-To: <20230228194409.379949-1-bugaevc@gmail.com>

Sergey Bugaev, le mar. 28 févr. 2023 22:44:08 +0300, a ecrit:
> @@ -430,23 +429,11 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
>       receive completes immediately or aborts.  */
>    abort_thread (ss, state, reply);
>  
> -  if (state->basic.PC >= (uintptr_t) &_hurd_intr_rpc_msg_about_to
> -      && state->basic.PC < (uintptr_t) &_hurd_intr_rpc_msg_in_trap)
> -    {
> -      /* The thread is about to do the RPC, but hasn't yet entered
> -	 mach_msg.  Mutate the thread's state so it knows not to try
> -	 the RPC.  */
> -      INTR_MSG_BACK_OUT (&state->basic);
> -      MACHINE_THREAD_STATE_SET_PC (&state->basic,
> -				   &_hurd_intr_rpc_msg_in_trap);
> -      state->basic.SYSRETURN = MACH_SEND_INTERRUPTED;
> -      *state_change = 1;
> -    }
> -  else if (state->basic.PC == (uintptr_t) &_hurd_intr_rpc_msg_in_trap
> -	   /* The thread was blocked in the system call.  After thread_abort,
> -	      the return value register indicates what state the RPC was in
> -	      when interrupted.  */
> -	   && state->basic.SYSRETURN == MACH_RCV_INTERRUPTED)
> +  if (state->basic.PC == (uintptr_t) &_hurd_intr_rpc_msg_in_trap
> +      /* The thread was blocked in the system call.  After thread_abort, the
> +         return value register indicates what state the RPC was in when
> +         interrupted.  */
> +      && state->basic.SYSRETURN == MACH_RCV_INTERRUPTED)
>        {
>  	/* The RPC request message was sent and the thread was waiting for
>  	   the reply message; now the message receive has been aborted, so

No, that's not enough, it's racy: if cancellation/interrupt
happens between the last C check and actually running lcall, the
cancellation/interrupt will be lost.

We do need to properly check for the eip case between the last check for
these, and lcall.

Samuel

  parent reply	other threads:[~2023-02-28 22:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 13:39 intr-msg / hurdsig looks broken, is my analysis correct? 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           ` Samuel Thibault [this message]
2023-02-28 21:09         ` intr-msg / hurdsig looks broken, is my analysis correct? Samuel Thibault
2023-03-01  9:21           ` Sergey Bugaev
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=20230228221641.4pz56lfkwze3bl2b@begin \
    --to=samuel.thibault@gnu.org \
    --cc=bug-hurd@gnu.org \
    --cc=bugaevc@gmail.com \
    --cc=libc-alpha@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).