Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5604361pxb; Mon, 14 Feb 2022 03:13:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwK+x46Q7rOiuoXdlSEiWOYMDKOEHl8XiL76Ftr3D2wfQAz/Tq9Won2TtWJRSh1p6LAmAzP X-Received: by 2002:a63:61d3:: with SMTP id v202mr3760169pgb.350.1644837216769; Mon, 14 Feb 2022 03:13:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644837216; cv=none; d=google.com; s=arc-20160816; b=BpybKMEHFTDdyO6tOraHo5QbbDB8SRykfe64PVv+fwziF3jmeQ8AjRYIYe3u0VRdb0 wLXzkNxq0Gq58BsuwwhH/RXK6dJ6hxSV4WM9LCsJybDy3KqhCV1BaeMBkJ+VkP+QLF4q wwIDzZa/XwudRmTobm9sOTlXWmozXQehI6vMiP5SZXWKzJgc2U07T2j/WKpjI/S9OEHi Uy9jsZBNmGY8dTg/LytXBfSrLdLfLzr6NWRRY2i2mCY59to0o/xk9hb//dYNCEjhCNYo TvLPHOTj40mLlwGIXl4UH4d5vFKB46vm7tkpysz/KqJ5MeoyHGMiHDD7eV/D0hneTNZm 53iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=684CqHNwxeeFLDieT+hnImprW0dvEy16HRmo/OqQ8xM=; b=f3O9CDM9b7Ylp0Xk5t3gfs1MlsQUvsvYxKMZ4N70COMfL+hg6T8aPUe+M0mDHx02WB hjwoICXRkumOBSdG+oLgA3czDxbzQL7kwYsVzCiO3svh/6aS0xvTemIAGv0gukjjKapL NUhhumnpO2IPO4cPqzVZt53YTBhRdViyqUDXE/hczcizNH8t8YXjXQtnFaJM8D7VfhRm keFBMp6H5WkwT9Euosa9uO+91wvjSYTgdXaZM0Mq8cJO94HOA2gKXYYX/LPGmUtAUktf LZySpkUy9iFbjDyz9HrPr7PWsRCD4B3X84xKao4EAoiAy/ZYJOiufv7nYPjcEjNm2lGM C8IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20210112.gappssmtp.com header.s=20210112 header.b="2/eyFc1P"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f132si28971149pgc.340.2022.02.14.03.13.21; Mon, 14 Feb 2022 03:13:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20210112.gappssmtp.com header.s=20210112 header.b="2/eyFc1P"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232929AbiBMCcU (ORCPT + 99 others); Sat, 12 Feb 2022 21:32:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbiBMCcS (ORCPT ); Sat, 12 Feb 2022 21:32:18 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61CD05FF27 for ; Sat, 12 Feb 2022 18:32:13 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id a11-20020a17090a740b00b001b8b506c42fso15732464pjg.0 for ; Sat, 12 Feb 2022 18:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=684CqHNwxeeFLDieT+hnImprW0dvEy16HRmo/OqQ8xM=; b=2/eyFc1PS/DG76NEKk8T151hYk/zKSztRGlztHd6pc0aK7ITJTn2hnlBYUh4LfTu8N NzDHhflNWPpKnwjtmTIem29YuUXO8HGI6pGiua3Ht1aD51mkr0XaB+i7i8B1y+C2wLN4 Gp0235f94zC/e+/VEY+aBGx7k5zK86/Q+rcv90U55I3yFunbLBqcm0P9PrIuUTs3WvkX xyWMflfEMQ89O1RPyHPWwnySFALCgg9m+jmk6128At2dw8WD6TrfQsPHvsXgBmQ2WI9/ 79XVmkOmcqEpAwgWU8r91cFOXXgtjCZPRK+cMrdnbAEp+PQ99Ak114iATUTAyY2sx7Qv ELKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=684CqHNwxeeFLDieT+hnImprW0dvEy16HRmo/OqQ8xM=; b=HfaACq5qfYpMa96loYaRWst7urLSh8lyvK9NwhGr4QKSEQ444w71oe5pG9bjF3vqSJ xGaghPE86LTAp9ZZFVuqB3bQSRGcX6S6qSlLOIauzq9gufDdNd/JuOBaEbqHdkZ2BqM5 Px7E38BP3XK/O0AGeHwWMvy9FZOHSfsB8t9+AnHC1pMIcReCJOiATzDigjs3QfcbsUZd MOP8puOF52PkCp4hWt7WdrN7Q+hK5TvM9ZnTHzUgBRPmtHDaSzV3CtRrA/ozM4shc/A6 ow2AOIZBwydFN5Kku9Qyl7wALdb9fxQCzvYMs/BwkMDBgOExilKlD1Zsib4P38C2pa20 lL8Q== X-Gm-Message-State: AOAM533rvpxowm/WrlwoUzoWpZdupJ5PJKL1jjzbR7u/ntAcDLA4SvJS i6SjLL+3oHYilTz1BJGLrX1cCQ== X-Received: by 2002:a17:90a:9704:: with SMTP id x4mr7680500pjo.219.1644719532927; Sat, 12 Feb 2022 18:32:12 -0800 (PST) Received: from smtpclient.apple ([2600:1010:b021:31a8:38de:7526:b98f:ba7b]) by smtp.gmail.com with ESMTPSA id 16sm20612051pfm.200.2022.02.12.18.32.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Feb 2022 18:32:12 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [RFC] Get siginfo from unreaped task Date: Sat, 12 Feb 2022 18:32:08 -0800 Message-Id: References: Cc: Kees Cook , "Eric W. Biederman" , Jann Horn , Will Drewry , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org In-Reply-To: To: =?utf-8?Q?Robert_=C5=9Awi=C4=99cki?= X-Mailer: iPhone Mail (19C63) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Feb 12, 2022, at 3:24 AM, Robert =C5=9Awi=C4=99cki = wrote: >=20 > =EF=BB=BFsob., 12 lut 2022 o 05:28 Kees Cook napis= a=C5=82(a): >>=20 >> Make siginfo available through PTRACE_GETSIGINFO after process death, >> without needing to have already used PTRACE_ATTACH. Uses 48 more bytes >> in task_struct, though I bet there might be somewhere else we could >> stash a copy of it? >=20 > An alternative way of accessing this info could be abusing the > waitid() interface, with some additional, custom to Linux, flag >=20 > waitid(P_ALL, 0, &si, __WCHILDSIGINFO); >=20 > which would change what is put into si. >=20 > But maybe ptrace() is better, because it's mostly incompatible with > other OSes anyway on the behavior/flag level, while waitd() seems to > be POSIX/BSD standard, even if Linux specifies some additional flags. >=20 >=20 I had a kind of opposite thought, which is that it would be very nice to be a= ble to get all the waitid() data without reaping a process or even necessari= ly being its parent. Maybe these can be combined? A new waitid() option li= ke you=E2=80=99re suggesting could add siginfo (and might need permissions).= And we could have a different waitid() flag that says =E2=80=9Cmaybe not m= y child, don=E2=80=99t reap=E2=80=9D (and also needs permissions). Although the =E2=80=9Cdon=E2=80=99t reap=E2=80=9D thing is fundamentally rac= y. What a sane process manager actually wants is an interface to read all th= is info from a pidfd, which means it all needs to get stuck in struct pid. A= nd task_struct needs a completion or wait queue so you can actually wait for= a pidfd to exit (unless someone already did this =E2=80=94 I had patches a w= hile back). And this would be awesome.=