Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp1516785ima; Sat, 2 Feb 2019 02:15:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN7vHA3D8Dy/mjjug02z7ro9mEWNTXRzc0YKUCkFn9NAm/bgMpe/go76voXehRsTDq1+hTwq X-Received: by 2002:a17:902:e002:: with SMTP id ca2mr44068566plb.103.1549102506624; Sat, 02 Feb 2019 02:15:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549102506; cv=none; d=google.com; s=arc-20160816; b=g9XkcrdRfknS+OllA1gOlo6Wk3PfAf4jTvAmmtuVF+cTLkghcdVn8BwyqXjPiLsdcs ewEPhwe3Ys9fzq1F+IBid8goztWMdBvQPaOL3Bdk91fLhZ+Ky7SdbN0ZmqS645/kvZJq v36cmF8m8HNns1/TiQv+Xa2UyKXDix5ZP0RuIkI/SXsH8Q1KbvqNKIW8ZhGh6SMssT2Q +2oVfs72qBsjF7N/arP0WFYbyjgSgAE+W/n/iXjnsgWEDnJyOOqaFz5O0t4iM+vpo/W8 yvgk7CEktEMkbxzHur/9bMFINKIFepqweWSvLpx4ylg7fgX4eulCQs38pcI75aCDKl9X mCSA== 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:dkim-signature; bh=9xDMejnxtfTklT2oXYVbm9EEbkLLZPi6FL7oGEKGEQc=; b=KSi8EufJO+aKtTGbIGNmx+ZMi23Ya4IOcVcaFFqj8PfiNCwKjAt6VQcJu9O500AL+F AN1jR08I5pnQBDu491fuH47RnO2vVUad7YxPeoDR7OzaGCnkh8paAo68x6tHfIQy6QB7 dWHP2XhhDFRYMTbSuTLWnD4q/0f2AautQJiywb3DvzKM6ZA3Ief/zPcSP0pER+4m1Dbs lMoypztXVuuJEwX6+gmjKrmoRZn+f2ZoOFqcOYuqeLAoXNe+0nCNxvQ+jvdzma/cEWpN S7GOk4LlR2Q3OeMiekqTTFnnaoQ5DH5EbBootT+zD7QHgxCgloWkN/B3AJyPzKqwyHr4 MZng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HhAb+Ifm; 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 ay7si10155348plb.410.2019.02.02.02.14.40; Sat, 02 Feb 2019 02:15:06 -0800 (PST) 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=HhAb+Ifm; 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 S1727599AbfBBKEo (ORCPT + 99 others); Sat, 2 Feb 2019 05:04:44 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44043 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726659AbfBBKEn (ORCPT ); Sat, 2 Feb 2019 05:04:43 -0500 Received: by mail-pl1-f195.google.com with SMTP id p4so1252886plq.11 for ; Sat, 02 Feb 2019 02:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9xDMejnxtfTklT2oXYVbm9EEbkLLZPi6FL7oGEKGEQc=; b=HhAb+IfmU+HMdVVnhiM1hN5C3fUsg9NwJysZh2oncx0fwsWhDiqUYlP289TmO70MK8 maYEc9HJ9htNKWqHIThyB76aYuaejUzawK4zMU2Cm8k6cYTpxA9TB8KUpwXiUmXhZqIf qkryZu6Z2a6MBqAjIqviSB5We7cNs3EzhFXm0TOEKzIE47efrri+uMsGmgZ5qUJYrDbo drBaBeavNhBi6XbLnO9eA7nHa/45Q51f40rWu4VNWrtxQt3uZpP65SqhK5aateUJPlrk fcZMnMqGG4yRwgY1VYtAWfDmtlO+VVWe2s5Gwb9IP07cRi3lxFn2y8wTW0hbQTPZf+jE WR+g== 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:in-reply-to:user-agent; bh=9xDMejnxtfTklT2oXYVbm9EEbkLLZPi6FL7oGEKGEQc=; b=kN4g7OGae8e6WHxYipQsOgF9rYKzn/KzWefjdsjtfpDzgznbZO6FJgNaXs6YELFMhr fgT0yXtTjQMGQmMOba+IXwZR4WLqTwC3ex4bmVbGQXEgi79jH+POFi4Z0DAYwbr2NqQK qzBIGGVirqJhjB0NlhtmIlzQEBLy0+uwvuZ4zja9+gyWsE7opz+WT3bPSgPVfX+EWpSM SyJwSa0oaO3TV0eGAlFN/hMcYJ9l7aMHDzBi64ngXjc34Jwo6z/XkP4Ma2K+Sy49nQtL HUQMivIs/QzPc6i8Q2HWCjHLCrfkatA/hIIwrd3zQmftoxPJlNe2vnFKdmgx3xGoaUGT qXrA== X-Gm-Message-State: AJcUukdZgeOfawIZKltW0eiydMZmfVvOWhot6/8GWwPw9e+XNkv1F6dv CkdHgN0HWTOMmdsBxvirosM= X-Received: by 2002:a17:902:6683:: with SMTP id e3mr41346783plk.93.1549101882752; Sat, 02 Feb 2019 02:04:42 -0800 (PST) Received: from gmail.com (c-73-140-212-29.hsd1.wa.comcast.net. [73.140.212.29]) by smtp.gmail.com with ESMTPSA id u8sm14684681pfl.16.2019.02.02.02.04.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Feb 2019 02:04:42 -0800 (PST) Date: Sat, 2 Feb 2019 02:04:40 -0800 From: Andrei Vagin To: Andrew Morton Cc: Oleg Nesterov , linux-kernel@vger.kernel.org, "Eric W. Biederman" Subject: Re: [PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK Message-ID: <20190202100439.GA16265@gmail.com> References: <20181120060616.6043-1-avagin@gmail.com> <20181121181650.8d2d6abcf83b9defb7195cd3@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20181121181650.8d2d6abcf83b9defb7195cd3@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 21, 2018 at 06:16:50PM -0800, Andrew Morton wrote: > On Mon, 19 Nov 2018 22:06:16 -0800 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. > > Looks good to me, but what would I know. I'll await input from Eric > and/or Oleg (please). Hi Andrew, What is your plan for this patch? In the ~akpm/mmotm/series, I see a comment of waiting for ack from Oleg. Here was a feedback from Oleg: https://www.spinics.net/lists/kernel/msg2972154.html where he said: "Ok, I think the patch is fine". Is it enough or should I convince him to send a "real" ack? Thanks, Andrei > > > --- a/include/linux/sched/signal.h > > +++ b/include/linux/sched/signal.h > > @@ -417,10 +417,20 @@ static inline void set_restore_sigmask(void) > > set_thread_flag(TIF_RESTORE_SIGMASK); > > WARN_ON(!test_thread_flag(TIF_SIGPENDING)); > > } > > + > > +static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) > > +{ > > + clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); > > +} > > How irritating is it that this file uses "task" 85 times and "tsk" 19 > times? What did that gain us? This patch worsens things. > > Oh well.