From owner-svn-src-projects@freebsd.org Mon Apr 22 17:34:23 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CE73159FFA4 for ; Mon, 22 Apr 2019 17:34:23 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBDE76E59D; Mon, 22 Apr 2019 17:34:22 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf1-f68.google.com with SMTP id o19so9562053lfl.4; Mon, 22 Apr 2019 10:34:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YN7Fa7AoeXGbEr6al+HB5+AiOVmi8Aq2/vyISY/lrfU=; b=YAmQjYRT+CwfxmORex5lEdvZb4f43gzmP5v/cm4AZcb6M7LYM5ovIrGSKivvdFtUwF +kFfwdvP6UOcuz6BR0Jak/pSE2k/6AzIigEdyp2PHGe6QKTvkRK18hoj+7+3RlwzdTd2 8sm5PVbaqvPNmeC35LWfqDa4+SDoau7HHKf1KEXZJQl68KPR4nCSCblvHQ99z6t0PUC9 4zLeew94z3xMXjHMtlOvVsemOcTJHPwmtO9EqOpd3EBdeCJfBhQVEAQWStdNJOCpNJ8F fJXfi9IqJau3N5Doqj9dK8cV43BIkR+sTUTjp3dA+zO/GDOylPUTWOcy063Zj0kqnmg/ H7fA== X-Gm-Message-State: APjAAAWn6cCLXwfdmc5TnR/Pkcu5mQN5QqxVN1Rl00gsZ9nB9dEyzJ8L nzwqy8zf+UCMlicd6roVT/iuiERfXUMZfP/Vj/Q= X-Google-Smtp-Source: APXvYqyyPGuosulZfWuiXEFXdrXcEN4Vwjf41nXRb3RkHaeCK7YsA/6ffFn2HpluoB02HuedOXZNfoJ+0QyFI8oCp3s= X-Received: by 2002:a19:6d1b:: with SMTP id i27mr11763182lfc.156.1555954086623; Mon, 22 Apr 2019 10:28:06 -0700 (PDT) MIME-Version: 1.0 References: <201904212304.x3LN46Pt046728@repo.freebsd.org> <20190422171033.GX12936@kib.kiev.ua> In-Reply-To: <20190422171033.GX12936@kib.kiev.ua> From: Alan Somers Date: Mon, 22 Apr 2019 11:27:54 -0600 Message-ID: Subject: Re: svn commit: r346507 - in projects/fuse2/sys: kern sys To: Konstantin Belousov Cc: src-committers , svn-src-projects@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: CBDE76E59D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Apr 2019 17:34:23 -0000 On Mon, Apr 22, 2019 at 11:10 AM Konstantin Belousov wrote: > > 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. Good point. I'll add lock assertions. > > 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. I'm using this in a context where the signal has already been delivered and caught. So it can't be blocked, and it can't be a trap. > > 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. Do you still believe that even though it doesn't need to consider blocked signals and traps? > > What you are trying to do there ? It's in a situation where a syscall can't simply return EINTR or ERESTART. I need to do some extra work to interrupt the syscall (ask the FUSE daemon to interrupt the associated FUSE operation). If the signal will be fatal, then there's no point in waiting for the FUSE daemon to reply and I can simply return EINTR. However, if the signal is not fatal, then I need to wait to see if the FUSE daemon to acknowledge the interrupt or else complete the operation like normal. -Alan > > > + > > /* > > * 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);