Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Apr 2019 19:28:37 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Alan Somers <asomers@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   Re: svn commit: r346640 - in projects/fuse2/sys: fs/fuse kern
Message-ID:  <20190424162837.GD12936@kib.kiev.ua>
In-Reply-To: <201904241554.x3OFsIjw024483@repo.freebsd.org>
References:  <201904241554.x3OFsIjw024483@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 24, 2019 at 03:54:18PM +0000, Alan Somers wrote:
> Author: asomers
> Date: Wed Apr 24 15:54:18 2019
> New Revision: 346640
> URL: https://svnweb.freebsd.org/changeset/base/346640
> 
> Log:
>   fusefs: interruptibility improvements suggested by kib
>   
>   * Block stop signals in fticket_wait_answer
This might be ok, but consider using VFCF_SBDRY.

>   * Hold ps_mtx while checking signal disposition
This part is pointless, as explained before.

>   * style(9) changes
And sig_isfatal() is still there, which I consider an architectural bug.

>   
>   PR:		346357
>   Reported by:	kib
>   Sponsored by:	The FreeBSD Foundation
> 
> Modified:
>   projects/fuse2/sys/fs/fuse/fuse_ipc.c
>   projects/fuse2/sys/kern/kern_sig.c
> 
> Modified: projects/fuse2/sys/fs/fuse/fuse_ipc.c
> ==============================================================================
> --- projects/fuse2/sys/fs/fuse/fuse_ipc.c	Wed Apr 24 15:35:29 2019	(r346639)
> +++ projects/fuse2/sys/fs/fuse/fuse_ipc.c	Wed Apr 24 15:54:18 2019	(r346640)
> @@ -430,10 +430,11 @@ fticket_wait_answer(struct fuse_ticket *ftick)
>  {
>  	struct thread *td = curthread;
>  	sigset_t blockedset, oldset;
> -	int err = 0;
> +	int err = 0, stops_deferred;
>  	struct fuse_data *data;
> -	SIGEMPTYSET(blockedset);
>  
> +	SIGEMPTYSET(blockedset);
> +	stops_deferred = sigdeferstop(SIGDEFERSTOP_SILENT);
>  	kern_sigprocmask(td, SIG_BLOCK, NULL, &oldset, 0);
>  
>  	fuse_lck_mtx_lock(ftick->tk_aw_mtx);
> @@ -476,6 +477,7 @@ retry:
>  		 * or EAGAIN to the interrupt.
>  		 */
>  		int sig;
> +		bool fatal;
>  
>  		SDT_PROBE2(fusefs, , ipc, trace, 4,
>  			"fticket_wait_answer: interrupt");
> @@ -485,11 +487,12 @@ retry:
>  		PROC_LOCK(td->td_proc);
>  		mtx_lock(&td->td_proc->p_sigacts->ps_mtx);
>  		sig = cursig(td);
> +		fatal = sig_isfatal(td->td_proc, sig);
>  		mtx_unlock(&td->td_proc->p_sigacts->ps_mtx);
>  		PROC_UNLOCK(td->td_proc);
>  
>  		fuse_lck_mtx_lock(ftick->tk_aw_mtx);
> -		if (!sig_isfatal(td->td_proc, sig)) {
> +		if (!fatal) {
>  			/* 
>  			 * Block the just-delivered signal while we wait for an
>  			 * interrupt response
> @@ -512,6 +515,7 @@ out:
>  		err = ENXIO;
>  	}
>  	fuse_lck_mtx_unlock(ftick->tk_aw_mtx);
> +	sigallowstop(stops_deferred);
>  
>  	return err;
>  }
> 
> Modified: projects/fuse2/sys/kern/kern_sig.c
> ==============================================================================
> --- projects/fuse2/sys/kern/kern_sig.c	Wed Apr 24 15:35:29 2019	(r346639)
> +++ projects/fuse2/sys/kern/kern_sig.c	Wed Apr 24 15:54:18 2019	(r346640)
> @@ -929,16 +929,16 @@ osigreturn(struct thread *td, struct osigreturn_args *
>  #endif
>  #endif /* COMPAT_43 */
>  
> -/* Will this signal be fatal to the current process ? */
> +/* Would this signal be fatal to the current process, if it were caught ? */
>  bool
>  sig_isfatal(struct proc *p, int sig)
>  {
>  	intptr_t act;
> +	int prop;
>  
> +	mtx_assert(&p->p_sigacts->ps_mtx, MA_OWNED);
>  	act = (intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)];
>  	if ((intptr_t)SIG_DFL == act) {
> -		int prop;
> -
>  		prop = sigprop(sig);
>  		return (0 != (prop & (SIGPROP_KILL | SIGPROP_CORE)));
>  	} else {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190424162837.GD12936>