Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Apr 2019 20:10:33 +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: r346507 - in projects/fuse2/sys: kern sys
Message-ID:  <20190422171033.GX12936@kib.kiev.ua>
In-Reply-To: <201904212304.x3LN46Pt046728@repo.freebsd.org>
References:  <201904212304.x3LN46Pt046728@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 21, 2019 at 11:04:06PM +0000, Alan Somers wrote:
> Author: asomers
> Date: Sun Apr 21 23:04:06 2019
> New Revision: 346507
> URL: https://svnweb.freebsd.org/changeset/base/346507
> 
> Log:
>   fusefs: commit missing files from r346387
>   
>   PR:		346357
>   Sponsored by:	The FreeBSD Foundation
> 
> Modified:
>   projects/fuse2/sys/kern/kern_sig.c
>   projects/fuse2/sys/sys/signalvar.h
> 
> Modified: projects/fuse2/sys/kern/kern_sig.c
> ==============================================================================
> --- projects/fuse2/sys/kern/kern_sig.c	Sun Apr 21 22:53:51 2019	(r346506)
> +++ projects/fuse2/sys/kern/kern_sig.c	Sun Apr 21 23:04:06 2019	(r346507)
> @@ -929,6 +929,23 @@ osigreturn(struct thread *td, struct osigreturn_args *
>  #endif
>  #endif /* COMPAT_43 */
>  
> +/* Will this signal be fatal to the current process ? */
> +bool
> +sig_isfatal(struct proc *p, int sig)
> +{
> +	intptr_t act;
> +
> +	act = (intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)];
> +	if ((intptr_t)SIG_DFL == act) {
> +		int prop;
This is against style.

> +
> +		prop = sigprop(sig);
> +		return (0 != (prop & (SIGPROP_KILL | SIGPROP_CORE)));
> +	} else {
> +		return (false);
> +	}
> +}
Either your function lacks asserts about the owned locks, or it is racy.

Said that, is the comment above describes the intent ? The
implementation is too naive. Just for example, blocked signals with
default disposition do not result in the termination. On the other hand,
blocked ignored traps cause immediate termination.

Overall, I do not believe that it is possible to implement that without
duplicating the code of tdsendsignal() and trapsignal(), i.e. you should
additionally provide the originating context, besides a signal number.

What you are trying to do there ?

> +
>  /*
>   * Initialize signal state for process 0;
>   * set to ignore signals that are ignored by default.
> 
> Modified: projects/fuse2/sys/sys/signalvar.h
> ==============================================================================
> --- projects/fuse2/sys/sys/signalvar.h	Sun Apr 21 22:53:51 2019	(r346506)
> +++ projects/fuse2/sys/sys/signalvar.h	Sun Apr 21 23:04:06 2019	(r346507)
> @@ -384,6 +384,7 @@ int	sigacts_shared(struct sigacts *ps);
>  void	sigexit(struct thread *td, int sig) __dead2;
>  int	sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **);
>  int	sig_ffs(sigset_t *set);
> +bool	sig_isfatal(struct proc *p, int sig);
>  void	siginit(struct proc *p);
>  void	signotify(struct thread *td);
>  void	sigqueue_delete(struct sigqueue *queue, int sig);



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