Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4911068ybi; Tue, 28 May 2019 04:40:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9k0L6xXNjmym2ZKwlbm5dQZjCc0Q41kRrDqjR2tYfpoy1IGbqtXEsr0eCu6Hjih1focrJ X-Received: by 2002:a63:1460:: with SMTP id 32mr132888146pgu.319.1559043615407; Tue, 28 May 2019 04:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559043615; cv=none; d=google.com; s=arc-20160816; b=GZ23yhTvfIvwNDERQR1POsI8B0yagL6tiDZ9RfWDRd8nEeK9P32UdR1QZ6AAvgYfG8 OzctpH+yP8r+t8J4LnpVxqcYrxok5qb/F+bRDkk1OiIiAjcCj+8wWZJPiGfSgmoZbWji jpDZ4sbc19C8tqFLNDLxH+6O/FaDgnh5k9yySGk8Gz5UE2ZGXE34pHvhMrVL0mkwy/yj OxofN1uJwa6jbLgyzYrP4Zz3S0OLCUjaNRtGWqsWKalThOt31IGMaEDnfgcFH/FOTv6Y 0Tr6rBRhyw6/vSbUfs7jrU8/71ALy0CauFb0QNj0mSFRVcHT/Yfeil//yuNrR7ZVQsxW js3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=Mje4Sqm+Ror3it0+HkeEWilvUO3xfODnH6D7IlgYARg=; b=Jindzj74ZfKBgw59x5UQk9vxMhFQg/Ni2zQoPWCJ4BRMwL1LViB0hn/oHZtsZnMpTk 5FFj2IoHyoTedoGqLwXudo40t1Bu37kssO1sNiiewr75O3SqgLig7JBRQyyUME60SF8e Gai7UJzPWl+80ue7fg+OeN40vzm615vgeSvCN8iZrpQucIe4j2T8EsdPG07tAd815/Xh 7MG6rwG+iDG8ueOXl7Ba3CM1sBm7K3V/Q/ZnRZrlylRRljNaIczJS578a0I2f9kxxpoO n4/2Zjm65LdJBL3x/vBWz6vTnDpXZLkgqFkihX27EEB5vTVDQPPd8YuksPN2byCGGqvz Xz+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=leTTuzro; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si13333195pgm.568.2019.05.28.04.39.59; Tue, 28 May 2019 04:40:15 -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=@gmail.com header.s=20161025 header.b=leTTuzro; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726701AbfE1Lht (ORCPT + 99 others); Tue, 28 May 2019 07:37:49 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42115 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726580AbfE1Lht (ORCPT ); Tue, 28 May 2019 07:37:49 -0400 Received: by mail-pg1-f193.google.com with SMTP id 33so7868816pgv.9; Tue, 28 May 2019 04:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Mje4Sqm+Ror3it0+HkeEWilvUO3xfODnH6D7IlgYARg=; b=leTTuzrol5cXVn4UToRdkhDMCU1N1h/DSCdgBsc6Gypt7PCMxf1rb6oUc2MEm02j/j a0P4UluWuPi1mTg5gFDKg2ssKVD2bFzgD4qfjQKGmjcX+TN/9OBhfmPwtojC8hQwGubu Se+O40//DHhIu4Bxqb4i29E0rjnEqxmhWNAIiN6URjejoY8WlInN/I4PfgF4UvY6gXDf H4s8+B7KBc+SwY6EbRsJLKEoKYhJI+XQVHpYA5K+jo47SsxPwoUrGpPH4lH0mydQ5TFW 1gAbzV5B9vT1UFVBYBAspEbwKfhuqs+lNzJfCjcKcKrtoUyUwFT+tz7TWMwCbFU7K7cd aSYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Mje4Sqm+Ror3it0+HkeEWilvUO3xfODnH6D7IlgYARg=; b=a90SG42aaBXBpEXfyF5Ygom8CcPJ7dtupA5sAwWl4UE9IjJeA+ez88Bsxu0+uqGqNX YVflVOAbr8o/V6UlWsXdssEZxEJH2o1KkFENAsB/03WGcRJjE31Iocgb/dm+z18sZJXo mIA0OFvuFSsP0KH1RcDsYhPrcguThCmcEDh25/6KFpdGWhrhYKpxXlUf9gsXEbspEzgG IVHpxzI2hlt/WMK/R/DkV5iLBBxmOwBtlky549+TrUy2v3bROC+eIyhiFupSPW9KtdIq 5/aT/35/tT6X+RvBmfxaOQegNT+Q4wkVvC7+frrPNK64F+v2Xen7N+lC9iUOSx6owoY9 1A/A== X-Gm-Message-State: APjAAAUiYXCrNOf0O1gaerMzXD0p/2xWOwIS0/PoA6hJpz7RNueYENsK hsGPwQsazUaTg0sK88u6lFc= X-Received: by 2002:a65:42ca:: with SMTP id l10mr77858165pgp.181.1559043468390; Tue, 28 May 2019 04:37:48 -0700 (PDT) Received: from [192.168.86.32] (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id h11sm14470578pfn.170.2019.05.28.04.37.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 04:37:47 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask() From: Deepa Dinamani X-Mailer: iPhone Mail (16F203) In-Reply-To: Date: Tue, 28 May 2019 04:37:46 -0700 Cc: Oleg Nesterov , Linux Kernel Mailing List , Andrew Morton , Alexander Viro , Arnd Bergmann , "dbueso@suse.de" , "axboe@kernel.dk" , Davidlohr Bueso , Eric Wong , Jason Baron , Linux FS-devel Mailing List , linux-aio , Omar Kilani , Thomas Gleixner , "stable@vger.kernel.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190522161407.GB4915@redhat.com> <4f7b6dbeab1d424baaebd7a5df116349@AcuMS.aculab.com> <20190523145944.GB23070@redhat.com> <345cfba5edde470f9a68d913f44fa342@AcuMS.aculab.com> <20190523163604.GE23070@redhat.com> <20190524141054.GB2655@redhat.com> <20190524163310.GG2655@redhat.com> To: David Laight Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 28, 2019, at 2:12 AM, David Laight wrote:= >=20 > From: Deepa Dinamani >> Sent: 24 May 2019 18:02 > ... >> Look at the code before 854a6ed56839a: >>=20 >> /* >> * If we changed the signal mask, we need to restore the original on= e. >> * In case we've got a signal while waiting, we do not restore the >> * signal mask yet, and we allow do_signal() to deliver the signal o= n >> * the way back to userspace, before the signal mask is restored. >> */ >> if (sigmask) { >> ####### This err has not been changed since ep_poll() >> ####### So if there is a signal before this point, but >> err =3D 0, then we goto else. >> if (err =3D=3D -EINTR) { >> memcpy(¤t->saved_sigmask, &sigsaved, >> sizeof(sigsaved)); >> set_restore_sigmask(); >> } else >> ############ This is a problem if there is signal >> pending that is sigmask should block. >> ########### This is the whole reason we have >> current->saved_sigmask? >> set_current_blocked(&sigsaved); >> } >=20 > What happens if all that crap is just deleted (I presume from the > bottom of ep_wait()) ? Hmm, you have to update the saved_sigmask or the sigmask. > I'm guessing that on the way back to userspace signal handlers for > signals enabled in the process's current mask (the one specified > to epoll_pwait) get called. > Then the signal mask is loaded from current->saved_sigmask and > and enabled signal handlers are called again. Who is saving this saved_sigmask that is being restored on the way back? > No special code there that depends on the syscall result, errno > of the syscall number. I didn=E2=80=99t say this has anything to do with errno. -Deepa=20