From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C12EDC432C1 for ; Tue, 24 Sep 2019 19:43:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95E6D214AF for ; Tue, 24 Sep 2019 19:43:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H2na7SsL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441945AbfIXTnm (ORCPT ); Tue, 24 Sep 2019 15:43:42 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45810 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395538AbfIXTnl (ORCPT ); Tue, 24 Sep 2019 15:43:41 -0400 Received: by mail-wr1-f65.google.com with SMTP id r5so3325772wrm.12; Tue, 24 Sep 2019 12:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=cc:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZbmGKH+DoD4e4TU0rL8OW+6yE02iYsouUxhdX3yNhV4=; b=H2na7SsLZPHFIjyCac4VcZKwCIpZqZVH2iS/v/KPU8+8vkqmJrKqIvu+Byy+18gdUT NzBcCfIVBI6yCWllrdlzRBTYNTC3iowJqlgXq8NnuKXf70/LtUzSGwEa4/Ar4OgwZiHI bZexQkHLUTmS7DEjx+ECMjebf4dUSAyx5kQXmvj8DYV3VU7BOnrlJr7Hc6ZhCKFkZDLG ub4cB1NYcg33EARdvgGpy2LyAJ7NI4beSn7LsqN+qOlUSLrARkS6Hm4FeNFiBjeHUTPr Itl7mYxel0f3CcDzpMIcxMZTGE3LWrlvdO/H9U7DqP8CT2YxqRVHdWqWbP1cFEd7JbZ4 98rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZbmGKH+DoD4e4TU0rL8OW+6yE02iYsouUxhdX3yNhV4=; b=eKD0hcGTcLMme+8iCIralVeSy2LfqLiS8LcrTylxwB0sc+ySnOyQNFfxOlpdJ1i01g RmCpc24oCGKGzlsL1uG8SCv9uyZ6lzXscpITEKYlD7JLguFPbWFzZdk1GHkZZuglXk5Y zgpFVcsxEG9ChBGeufflslF0Yrw+FIe1wKu1tvggeDZxWQORHKHtZ0CajdDxAVxo7feu ntjvB3y2zyFMWMqgCJlbrxAIVS/PfBeEcSJRxEdb8ziBqJx4lT+C9Wv0dNODE1spRwW3 uza50Pm63zq05vZG5a1cFVVM5haZB2hFY6ntbn6YF2GBYlttgyZAZ3Xoq8HbB4UmTBRD rYoQ== X-Gm-Message-State: APjAAAWrDCtD047aD+i6qMnIUU7cdrsSMM2uoXk6nxZehqFOyAwGulBB WSkDppXnKowoPthq/QwT7dfciDp8 X-Google-Smtp-Source: APXvYqzMXr8MC+in2pAg7SeE0IHESj9+qAK00yGFjlDifW6en5O3NMyy3TIpj55bCizARJqErphLsg== X-Received: by 2002:adf:ef0c:: with SMTP id e12mr2003774wro.81.1569354219435; Tue, 24 Sep 2019 12:43:39 -0700 (PDT) Received: from ?IPv6:2001:a61:24d6:4e01:ef75:e978:47cd:1c50? ([2001:a61:24d6:4e01:ef75:e978:47cd:1c50]) by smtp.gmail.com with ESMTPSA id q10sm5746592wrd.39.2019.09.24.12.43.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Sep 2019 12:43:38 -0700 (PDT) Cc: mtk.manpages@gmail.com, Oleg Nesterov , Christian Brauner , Jann Horn , "Eric W. Biederman" , Daniel Colascione , Joel Fernandes , linux-man , Linux API , lkml Subject: Re: For review: pidfd_send_signal(2) manual page To: Florian Weimer References: <87pnjr9rth.fsf@mid.deneb.enyo.de> From: "Michael Kerrisk (man-pages)" Message-ID: Date: Tue, 24 Sep 2019 21:43:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <87pnjr9rth.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-man-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org Hello Florian, On 9/23/19 1:26 PM, Florian Weimer wrote: > * Michael Kerrisk: > >> SYNOPSIS >> int pidfd_send_signal(int pidfd, int sig, siginfo_t info, >> unsigned int flags); > > This probably should reference a header for siginfo_t. Thanks. I added: #include >> ESRCH The target process does not exist. > > If the descriptor is valid, does this mean the process has been waited > for? Maybe this can be made more explicit. Yes. I added "(i.e., it has terminated and been waited on)". >> The pidfd_send_signal() system call allows the avoidance of race >> conditions that occur when using traditional interfaces (such as >> kill(2)) to signal a process. The problem is that the traditional >> interfaces specify the target process via a process ID (PID), with >> the result that the sender may accidentally send a signal to the >> wrong process if the originally intended target process has termi‐ >> nated and its PID has been recycled for another process. By con‐ >> trast, a PID file descriptor is a stable reference to a specific >> process; if that process terminates, then the file descriptor >> ceases to be valid and the caller of pidfd_send_signal() is >> informed of this fact via an ESRCH error. > > It would be nice to explain somewhere how you can avoid the race using > a PID descriptor. Is there anything else besides CLONE_PIDFD? Please see my comment in reply to Christian (which will be sent just after this). >> static >> int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, >> unsigned int flags) >> { >> return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); >> } > > Please use a different function name. Thanks. Please see my open question in the thread on pidfd_open(). Thanks for the review, Florian. Cheers, Michael Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/