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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 55A04C83002 for ; Tue, 28 Apr 2020 01:44:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F275206D9 for ; Tue, 28 Apr 2020 01:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588038241; bh=Lkl6K/3AX+U13aetHC0TrO4ikRJFL3MaON0p7QUiEWQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=fGzTbG5uRc1ASMRICBXP7WsKjltT8MtuxGcSHp4itK1MZYTZ7ItKWnpKqLtzzzoi4 0UyF+iXQXVNrir+6yALcwviWgHM4qkP2pj/SDzE6VLcQpfsw8uZQseE23BeKONAMxB kQ3MzGeQaJSXh0f3Eh8dO3vLCT0HZOJmBprRdtzY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726251AbgD1BoA (ORCPT ); Mon, 27 Apr 2020 21:44:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726233AbgD1BoA (ORCPT ); Mon, 27 Apr 2020 21:44:00 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A535C03C1A8 for ; Mon, 27 Apr 2020 18:44:00 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id d16so15214801edv.8 for ; Mon, 27 Apr 2020 18:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6dLKuml1l37VsUNUL7W3+8Plw3oZZU13zk85vygbzVU=; b=Bd+HoaOQxYuuh8Zf1OdODQuVSh84RUl4JQmlzGerUyQmf8yQo21wChRkbSt91VRbi7 rW7nVLys2SsQX2Zyf0eFgqihojc0YmFDp8m/iu9CZyEhvrn1ELZTebPjm+Ei/dLS9xRA fQg/tEt3Rd0+Q259PEVjDGKRpewOS/+lcY8FU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6dLKuml1l37VsUNUL7W3+8Plw3oZZU13zk85vygbzVU=; b=gxg94O6v7GM7+DJmjJ7tI0KMYOZqG56PlAS/qc7J51ltPRSV8ijyn77th/7mUage5E q1meFTLWSAAt/CDiIQrbZIMK+v7fUFfCoZ7nuJXq2Eff/p9Gix60fLljlM/lZkzrhRuq p5venb9MMsOkYA+QFCGm9MsONaPPYPtmtal5Nhmp3wC11ZitKVLGITsGhZAD+C8LjXJ2 liAroonlWnAMDSQJZU9aYpqM9KVcMe9zMo1YeGztOhs32NwfVlTVkegHEplZMjXSuLov 5zSsSX1pwjk8i08hP38auVJ8QOHz8s1wtGVWSxB/q1J0jOnlK+ZV46PuZJuKpgh82BaW XMHQ== X-Gm-Message-State: AGi0PuYUep5Z9ivre2sCVoJKpxxUDMoDjO6quaHa5WnacQFxsyQdmoAP MbCFrCWqZaLKxQs8YnKQ69ni3n2mAXo= X-Google-Smtp-Source: APiQypJ/XLebd4HrD8EpPZ8R20+VwhD5MXmZfNFX8ELwb6EKEL1sCkME1B3xwMgrTtdfu0VTdJb0sQ== X-Received: by 2002:a05:6402:356:: with SMTP id r22mr22095618edw.3.1588038234503; Mon, 27 Apr 2020 18:43:54 -0700 (PDT) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com. [209.85.208.41]) by smtp.gmail.com with ESMTPSA id x25sm133477edr.61.2020.04.27.18.43.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Apr 2020 18:43:54 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id g16so15222135eds.1 for ; Mon, 27 Apr 2020 18:43:54 -0700 (PDT) X-Received: by 2002:a05:6512:14a:: with SMTP id m10mr17156490lfo.152.1588037812064; Mon, 27 Apr 2020 18:36:52 -0700 (PDT) MIME-Version: 1.0 References: <20200426130100.306246-1-hagen@jauu.net> <20200426163430.22743-1-hagen@jauu.net> <20200427170826.mdklazcrn4xaeafm@wittgenstein> <87zhawdc6w.fsf@x220.int.ebiederm.org> <20200427185929.GA1768@laniakea> <20200427201303.tbiipopeapxofn6h@wittgenstein> <20200428004546.mlpwixgms2ekpfdm@yavin.dot.cyphar.com> In-Reply-To: <20200428004546.mlpwixgms2ekpfdm@yavin.dot.cyphar.com> From: Linus Torvalds Date: Mon, 27 Apr 2020 18:36:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC v2] ptrace, pidfd: add pidfd_ptrace syscall To: Aleksa Sarai Cc: Christian Brauner , Arnd Bergmann , Hagen Paul Pfeifer , "Eric W. Biederman" , Jann Horn , kernel list , Florian Weimer , Al Viro , Christian Brauner , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Brian Gerst , Sami Tolvanen , David Howells , Andy Lutomirski , Oleg Nesterov , Arnaldo Carvalho de Melo , Sargun Dhillon , Linux API , linux-arch , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-api-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Mon, Apr 27, 2020 at 5:46 PM Aleksa Sarai wrote: > > I agree. It would be a shame to add a new ptrace syscall and not take > the opportunity to fix the multitude of problems with the existing API. > But that's a Pandora's box which we shouldn't open unless we want to > wait a long time to get an API everyone is okay with -- a pretty high > price to just get pidfds support in ptrace. We should really be very very careful with some "smarter ptrace". We've had _so_ many security issues with ptrace that it's not even funny. And that's ignoring all the practical issues we've had. I would definitely not want to have anything that looks like ptrace AT ALL using pidfd. If we have a file descriptor to specify the target process, then we should probably take advantage of that file descriptor to actually make it more of a asynchronous interface that doesn't cause the kinds of deadlocks that we've had with ptrace. The synchronous nature of ptrace() means that not only do we have those nasty deadlocks, it's also very very expensive to use. It also has some other fundamental problems, like the whole "take over parent" and the SIGCHLD behavior. It also is hard to ptrace a ptracer. Which is annoying when you're debugging gdb or strace or whatever. So I think the thing to do is ask the gdb (and strace) people if they have any _very_ particular painpoints that we could perhaps help with. And then very carefully think things through and not repeat all the mistakes ptrace did. I'm not very optimistic. Linus