Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp562952img; Wed, 20 Mar 2019 06:29:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoUdc81IIyX9kOCyUm+itFbb/5wuoJJ6J/xJ6DWV5Ks6kWmo8mS7oH6aE6MQ7LFykn2Y6z X-Received: by 2002:a62:4e8e:: with SMTP id c136mr7735758pfb.254.1553088544768; Wed, 20 Mar 2019 06:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553088544; cv=none; d=google.com; s=arc-20160816; b=uA1Xq1LFMPgxiRqveVGZbGdP8/meOZwLnYq5sXzb7MYb/yKSHap5wdv7h3k25N4Oyc n4u0gy2L3+kw5u5BYEiVNYadDOqFLreOPKMN/Wx9DyiVPe9wUTNuNmsB8P43G5b21OoP 2qb5VaHlsLPI9+wAQrOCRozEFzB+sWN3svJGY3UGUoIgg4Rll1k3KV8cMEQiKMi5S4ml AeXb/ZK6t0IWW40lKoL4R+SpUNO3cfqPIl9AGyB0KryFb1qhA13MmRS0QpNqi949cBQu VPWBCsSBtBiutGctNF4x1Igu8torAfZ5b/ObrRA3TaU9s22SHxDJ9HQtay5aKFnMDCsc ki3Q== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UZ6wClN0axv/9/xnsgsU2OneANHXF7pGPHVaFZhWp5Y=; b=YN2Mdgu/r43I4tJLfwT0W+YxiVXY2WZ/E76hiMwUvgom4APmyuPVws1tM/OjzK4att vFfmC2d3qzKVzxkVAXH8bMWgjIQ0jfD8A3OPO6DMKL9lHGzywtmpwlKIzbuLtqLl46mK 0NvhfD9GRzBpe72hdm1fsDbGJjnSJJ/QqGNt30JsHYyiXpsLcJx04HNkl8VZUYkngT5c 3k3lr6Zu0wibdALgLTycignGyVEUz7M1fA6DsMpl6MSXdpcUVP3SMe5c3EVMyLoSiBBS kbWvbzykF5ve9vVGklu66UproslHDddFv2FzIwtXh7FTVa1OmgwgjdQ2rmIfhuEMuBYO 7a3w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si595602pgi.451.2019.03.20.06.28.48; Wed, 20 Mar 2019 06:29:04 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727480AbfCTN1f (ORCPT + 99 others); Wed, 20 Mar 2019 09:27:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfCTN1e (ORCPT ); Wed, 20 Mar 2019 09:27:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8D9C306641B; Wed, 20 Mar 2019 13:27:34 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.34]) by smtp.corp.redhat.com (Postfix) with SMTP id 764144127; Wed, 20 Mar 2019 13:27:33 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 20 Mar 2019 14:27:33 +0100 (CET) Date: Wed, 20 Mar 2019 14:27:32 +0100 From: Oleg Nesterov To: Andrei Vagin Cc: Andrew Morton , linux-kernel@vger.kernel.org, "Eric W. Biederman" , Stephen Rothwell Subject: Re: [RESEND PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK Message-ID: <20190320132731.GC21673@redhat.com> References: <20190319191957.27156-1-avagin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190319191957.27156-1-avagin@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 20 Mar 2019 13:27:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/19, Andrei Vagin wrote: > > There are a few system calls (pselect, ppoll, etc) which replace a task > sigmask while they are running in a kernel-space > > When a task calls one of these syscalls, the kernel saves a current > sigmask in task->saved_sigmask and sets a syscall sigmask. > > On syscall-exit-stop, ptrace traps a task before restoring the > saved_sigmask, so PTRACE_GETSIGMASK returns the syscall sigmask and > PTRACE_SETSIGMASK does nothing, because its sigmask is replaced by > saved_sigmask, when the task returns to user-space. > > This patch fixes this problem. PTRACE_GET_SIGMASK returns saved_sigmask > is it's set. PTRACE_SETSIGMASK drops the TIF_RESTORE_SIGMASK flag. Acked-by: Oleg Nesterov