From owner-svn-src-projects@freebsd.org Tue Sep 3 14:07:25 2019 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8203BDDA7B for ; Tue, 3 Sep 2019 14:07:25 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N80X3s3lz4QZ7; Tue, 3 Sep 2019 14:07:24 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 7E2CC1B5C6; Tue, 3 Sep 2019 14:06:38 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id F1A863FDF; Tue, 23 Apr 2019 12:47:10 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 586317099D; Tue, 23 Apr 2019 12:47:10 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1C16A3F8F; Tue, 23 Apr 2019 12:47:10 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 4F5A33F84; Tue, 23 Apr 2019 12:47:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98EFE7098B; Tue, 23 Apr 2019 12:47:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x3NCkwXP093133 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Apr 2019 15:47:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x3NCkwXP093133 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x3NCkwep093130; Tue, 23 Apr 2019 15:46:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f From: Konstantin Belousov To: Alan Somers Cc: src-committers , svn-src-projects@freebsd.org Subject: Re: svn commit: r346507 - in projects/fuse2/sys: kern sys Message-ID: <20190423124657.GY12936@kib.kiev.ua> References: <201904212304.x3LN46Pt046728@repo.freebsd.org> <20190422171033.GX12936@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 586317099D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:07:26 -0000 X-Original-Date: Tue, 23 Apr 2019 15:46:57 +0300 X-List-Received-Date: Tue, 03 Sep 2019 14:07:26 -0000 On Mon, Apr 22, 2019 at 11:27:54AM -0600, Alan Somers wrote: > 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? Generally yes, but lets see the specifics of the use. > > > > > 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. In what context does the interruption happen ? Is it for a thread of the fuse daemon, or normal process ? Can you point out the specific fragment of code where the function is used ?