bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] hurd: Fully remove the ecx kludge


From: Samuel Thibault
Subject: Re: [PATCH 1/2] hurd: Fully remove the ecx kludge
Date: Tue, 28 Feb 2023 23:16:41 +0100
User-agent: NeoMutt/20170609 (1.8.3)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]