Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp815723ybk; Wed, 13 May 2020 13:58:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrRZX5blegeopOO+hK9H/PuHBAOuS8JAGMKAZyVwITpWHHs9m4ZGb837QFT6sGKsLnc81V X-Received: by 2002:a17:906:55c4:: with SMTP id z4mr855353ejp.332.1589403504066; Wed, 13 May 2020 13:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403504; cv=none; d=google.com; s=arc-20160816; b=Cr3Fur4QqATGPIqkWBQj9WWv7Mb2rgOuuQoQjhhFHyBHzboNgG65yjOHdlqp6ka46E wCD32C6CkIdq3iZQhexshWhuW9YUXNk5nSwRVE3neB46zdr4bgEm123KPdmi4kJTtuuv rczlWCt+zMQJJt8Vdgoq1sOtbG3R2Fq+IDJ37p5nu+LOKaIhtYBmK7df6mNSO7zP6ntM wrvIdmBcnd1022VzfXS15/h5bA3VPy0pzZoS3Of8fcLbxtErynClo6IGBl5U+o9l/pZG 4ih2/TtVvTp4hNHxNJVyp1c2QhXhX08QQ//nWxItmwac0vc43yEL7n9lgDh2FlC+w1co hvUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=o2jTt9duCIUyDNaTdoLbkZ+KM8WX48TT84C3o43emic=; b=JefouK46W3BLW8o7Sa22ROmPADIY6PTdvmYFh2P6sQoyuswtzwzYpIlTCg9umrPMsF kQ6EMC6+Jm8CIPJ7/712cIYTsGQcTnVmhxQ4Ap4mhT2+8Oy7PKF/inM1Wkw2H39iO04K qhLwdWJrBZe2reiL09tIMORyLoULc8lJ95vjOtJQ5oePhzpZqoJ1cEt/QVLknmgQApvj g+Asz7UXib4djD/kc+0ia5HX1h2Iv7tvn4kTHj70Pgwyql5MMaAeEwf2joIlvTR3JuEM OzeJeqqJJ/3qltYMWuWDdJKg9e/XV3rbYsxwSVGNT65pmMkNTHqTAbOozcRQs4sWGW6B 9azw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=fsgc2buo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si440227edm.53.2020.05.13.13.58.01; Wed, 13 May 2020 13:58:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=fsgc2buo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbgEMU4n (ORCPT + 99 others); Wed, 13 May 2020 16:56:43 -0400 Received: from mail.efficios.com ([167.114.26.124]:48888 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbgEMU4n (ORCPT ); Wed, 13 May 2020 16:56:43 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 1D27F2BEA87; Wed, 13 May 2020 16:56:42 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id wH0ZPTE7Hyep; Wed, 13 May 2020 16:56:41 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id BA2342BE5F0; Wed, 13 May 2020 16:56:41 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com BA2342BE5F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1589403401; bh=o2jTt9duCIUyDNaTdoLbkZ+KM8WX48TT84C3o43emic=; h=Date:From:To:Message-ID:MIME-Version; b=fsgc2buopl5ZEM5CvFJ98Xn9DhXtcXMpH7h/dauPhjF6OyhwoMvs/OLvwrOv35/kC tIPSYEe6qjmudoPOZcZ4LwcpiKfbFmnDt+vTWikKouhRMgbPhvnR9pe/5qDGEVNcwC W1KBIQ5yRu9ne2KT/RnS+3T/cdzzlz9twkJoTpltpG3pmRisoz5z1g4KS7GOEs4aol AjRAxInB0QTmtsOpTUSH2XdKov7dItXKOxTblCHGGmiM5kywC8ICqPBITY3lxxAMF/ xOCjRTE/UlLovvNgivYq0lP8kN67+GOiCB67CDZiq0aIIllXVWY/B2sfcbQxoepRKj rC8Y9snke/1zw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id lha_KD7570TM; Wed, 13 May 2020 16:56:41 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id A3B0B2BEA86; Wed, 13 May 2020 16:56:41 -0400 (EDT) Date: Wed, 13 May 2020 16:56:41 -0400 (EDT) From: Mathieu Desnoyers To: Thomas Gleixner Cc: linux-kernel , x86 , paulmck , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , rostedt , "Joel Fernandes, Google" , Boris Ostrovsky , Juergen Gross , Brian Gerst , Josh Poimboeuf , Will Deacon , Peter Zijlstra Message-ID: <1970736614.19996.1589403401588.JavaMail.zimbra@efficios.com> In-Reply-To: <20200505134058.560059744@linutronix.de> References: <20200505131602.633487962@linutronix.de> <20200505134058.560059744@linutronix.de> Subject: Re: [patch V4 part 1 05/36] x86/entry: Flip _TIF_SIGPENDING and _TIF_NOTIFY_RESUME handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3928 (ZimbraWebClient - FF76 (Linux)/8.8.15_GA_3928) Thread-Topic: x86/entry: Flip _TIF_SIGPENDING and _TIF_NOTIFY_RESUME handling Thread-Index: IQe8pQpccPVegLLPVuBmWFJQ6JCDbQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On May 5, 2020, at 9:16 AM, Thomas Gleixner tglx@linutronix.de wrote: > Make sure task_work runs before any kind of userspace -- very much > including signals -- is invoked. What is missing from this patch description is: _why_ is this deemed useful ? Also, color me confused: is "do_signal()" actually running any user-space, or just setting up the user-space stack for eventual return to signal handler ? Also, it might be OK, but we're changing the order of two things which have effects on each other: restartable sequences abort fixup for preemption and do_signal(), which also have effects on rseq abort. Because those two will cause the abort to trigger, I suspect changing the order might be OK, but we really need to think this through. Thanks, Mathieu > > Suggested-by: Andy Lutomirski > Signed-off-by: Peter Zijlstra (Intel) > Signed-off-by: Thomas Gleixner > --- > arch/x86/entry/common.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > --- a/arch/x86/entry/common.c > +++ b/arch/x86/entry/common.c > @@ -156,16 +156,16 @@ static void exit_to_usermode_loop(struct > if (cached_flags & _TIF_PATCH_PENDING) > klp_update_patch_state(current); > > - /* deal with pending signal delivery */ > - if (cached_flags & _TIF_SIGPENDING) > - do_signal(regs); > - > if (cached_flags & _TIF_NOTIFY_RESUME) { > clear_thread_flag(TIF_NOTIFY_RESUME); > tracehook_notify_resume(regs); > rseq_handle_notify_resume(NULL, regs); > } > > + /* deal with pending signal delivery */ > + if (cached_flags & _TIF_SIGPENDING) > + do_signal(regs); > + > if (cached_flags & _TIF_USER_RETURN_NOTIFY) > fire_user_return_notifiers(); -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com