Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2422631ybl; Mon, 19 Aug 2019 01:40:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/TJIKwFf+0egniDZEkuB/lue7zB+gYhj7OgBg0ZWcVrPzGSP5rgSPTGep2rYEiuhWymke X-Received: by 2002:a17:902:124:: with SMTP id 33mr21798653plb.145.1566204041913; Mon, 19 Aug 2019 01:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566204041; cv=none; d=google.com; s=arc-20160816; b=rD8bIFnwwq69WUpT1OtvQDMLsrVLSX3g9Lq9r/0UAXX5JUzAdlZVYdOvHa3dH53Uwe yADn/Cw00z0HSLxxh8eRb0v7q/tytZ8ucpndTOBa4Y0pr58UFQfUIgsrt7963P6SaSya J/79UmmrBzcYDMUPDzodmWTkRXlErQCuqZ7jM+I0rVoBKwP2ubk8yBgswoHsoaJKmDXh zNTI3oR/eR3N86SefbVqYRDWvccqeoVB7A7dgDtFa816uDNcyMnInyp3L+Vs/O5QDrKr zDVx5L6+YS+UaSHMDwUWRGT1n0rR5s0j1xGl1NKVL9g4psCZ0GgJGgf17GEf+Og+3/KP GTfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yo+SdyqZ/O4jXuFjj8QZr2O/7A5RWexuHtaCgMhz+og=; b=M3Abu8h0zZldOK0jtyYx6e3sp0jKHZurqvFEYJf7xlSyJiO5gtCFGbCLDPXXBLeI2/ dQNUajmhVb3OFjuAlw/f1DLGhIuf9hU4dSbRN+mGXSOXrM6ftQKuhSKVwuUzNJDMZ7kZ Xh0njmwDIR3v43bEKEG4STvms4x7dgp+3LmxNoSl4SJB0FfQBKvAi7VFt/zavC8Apu84 Nh96QONyqRjR8Feh/lHBz84STA4sJlJPY+0y4l1ivDhjw9lXQc8FXI8jzJbiSYftnfUh 04q/xbKlqOVKJLsPYpg/K+NB0ajjON/RtID6CKxCvu6YpRmb0BWm6IAYH9J6m10T2bQr QP+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linbit-com.20150623.gappssmtp.com header.s=20150623 header.b=ntdlk6mV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si9369391pgq.240.2019.08.19.01.40.26; Mon, 19 Aug 2019 01:40:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linbit-com.20150623.gappssmtp.com header.s=20150623 header.b=ntdlk6mV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbfHSIiD (ORCPT + 99 others); Mon, 19 Aug 2019 04:38:03 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41638 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726538AbfHSIiD (ORCPT ); Mon, 19 Aug 2019 04:38:03 -0400 Received: by mail-wr1-f68.google.com with SMTP id j16so7761955wrr.8 for ; Mon, 19 Aug 2019 01:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linbit-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=yo+SdyqZ/O4jXuFjj8QZr2O/7A5RWexuHtaCgMhz+og=; b=ntdlk6mVJT05SvDl8G9rkbVUSwiBi09oFdnJt4ab1t8Mc211HaWcimS5aP/d6EWWB/ ltgQmGv2xkM6fMtCmspbvi8CPgoaolEoqEi7S7/g6QPpSS/XjcjuudlJjyAfFl+zUKnZ 5FkOnONhEI1x4+t8GMItA+ikzNDYLhMq3m1nmgonF7EIq3HgQbHSgEt6sHoqDELbP2vf omCCF6k6RwMRo+2zf0rx6pfB52zv3Ekb2l6HliGhB4RLBI+dw4Wwx97RvmEg8T4VkWbw qITiQasUJNWwJf/6jujnoEcY1ChkHAvYg84J9FeZ04HlKtrPrx45rpT6S7zQBAFZHtT1 D0aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=yo+SdyqZ/O4jXuFjj8QZr2O/7A5RWexuHtaCgMhz+og=; b=Y1Q2DViu91+nJDwBb6GHILa4qFpO3RMtLqHHAhUkQxxbKMAD54cKyEbeS564r9NOnX y5VazYB1PnKZG6ckxCpSPt6JOIw5RJ5I0SJ5s7rAqXALAmW0+f1aeDk/y7fA0kSHa2fM 4a95MAyh7TI4fucch0uaWuf8d+p6acvPq1NAJ1ZRrUp+0k2cLouEwUugy1uVSPwkdz+g UwV57Zr1qvfi35MMjab5RLXqZzJCXjCGAbw3vMQzjvQysTq4dK8gXAkMuBX0vw78UFC0 CW7AWli3DfdSVm5jomK64RSeXE8AxBmpfW/6RsmdlYF7FBj73v8IPESfb8FDTu24QEIX h/pQ== X-Gm-Message-State: APjAAAWD89YmcN/uqNpxamUsY7neKeWgs0r8WkewW4ZIZtAuV7R53BrI Hm2tCJFo9KIfviOZaPYr7jh13w== X-Received: by 2002:adf:9482:: with SMTP id 2mr25343130wrr.91.1566203881132; Mon, 19 Aug 2019 01:38:01 -0700 (PDT) Received: from localhost ([2001:858:107:1:1d81:f726:81fa:b07a]) by smtp.gmail.com with ESMTPSA id p69sm13597648wme.36.2019.08.19.01.38.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 01:38:00 -0700 (PDT) Date: Mon, 19 Aug 2019 10:37:59 +0200 From: Christoph =?utf-8?Q?B=C3=B6hmwalder?= To: "Eric W. Biederman" Cc: Philipp Reisner , David Laight , Jens Axboe , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Steve French , ronnie sahlberg , Jeff Layton , linux-cifs Subject: Re: [PATCH] signal: Allow cifs and drbd to receive their terminating signals Message-ID: <20190819083759.73ee5zct4yxbyyfd@gintonic.linbit> References: <20190729083248.30362-1-christoph.boehmwalder@linbit.com> <1761552.9xIroHqhk7@fat-tyre> <1fcbb94c5f264c17af3394807438ad50@AcuMS.aculab.com> <2789113.VEJ2NpTmzX@fat-tyre> <87k1bclpmt.fsf_-_@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87k1bclpmt.fsf_-_@xmission.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 05:19:38PM -0500, Eric W. Biederman wrote: > > My recent to change to only use force_sig for a synchronous events > wound up breaking signal reception cifs and drbd. I had overlooked > the fact that by default kthreads start out with all signals set to > SIG_IGN. So a change I thought was safe turned out to have made it > impossible for those kernel thread to catch their signals. > > Reverting the work on force_sig is a bad idea because what the code > was doing was very much a misuse of force_sig. As the way force_sig > ultimately allowed the signal to happen was to change the signal > handler to SIG_DFL. Which after the first signal will allow userspace > to send signals to these kernel threads. At least for > wake_ack_receiver in drbd that does not appear actively wrong. > > So correct this problem by adding allow_kernel_signal that will allow > signals whose siginfo reports they were sent by the kernel through, > but will not allow userspace generated signals, and update cifs and > drbd to call allow_kernel_signal in an appropriate place so that their > thread can receive this signal. > > Fixing things this way ensures that userspace won't be able to send > signals and cause problems, that it is clear which signals the > threads are expecting to receive, and it guarantees that nothing > else in the system will be affected. > > This change was partly inspired by similar cifs and drbd patches that > added allow_signal. > > Reported-by: ronnie sahlberg > Reported-by: Christoph Böhmwalder > Cc: Steve French > Cc: Philipp Reisner > Cc: David Laight > Fixes: 247bc9470b1e ("cifs: fix rmmod regression in cifs.ko caused by force_sig changes") > Fixes: 72abe3bcf091 ("signal/cifs: Fix cifs_put_tcp_session to call send_sig instead of force_sig") > Fixes: fee109901f39 ("signal/drbd: Use send_sig not force_sig") > Fixes: 3cf5d076fb4d ("signal: Remove task parameter from force_sig") > Signed-off-by: "Eric W. Biederman" > --- > drivers/block/drbd/drbd_main.c | 2 ++ > fs/cifs/connect.c | 2 +- > include/linux/signal.h | 15 ++++++++++++++- > kernel/signal.c | 5 +++++ > 4 files changed, 22 insertions(+), 2 deletions(-) > Just tested this patch, and I can confirm that it makes DRBD work as intended again. Tested-by: Christoph Böhmwalder -- Christoph Böhmwalder LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage