From nobody Tue Mar 25 05:27:14 2025 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZMJMy5pJHz5s2Pq for ; Tue, 25 Mar 2025 05:27:42 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZMJMy2SBJz3XgR for ; Tue, 25 Mar 2025 05:27:42 +0000 (UTC) (envelope-from 6yearold@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6feaa0319d8so38075447b3.2 for ; Mon, 24 Mar 2025 22:27:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742880461; x=1743485261; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9cO7gTYPVRJkl+KS/Va7GOJKvYcly5h1AH3xUIt4IDE=; b=Ves/ktrmTz/oVdRmj6ujsIfTg1Mo/ttESNXz7iHBUlm2TYFllV/fQuv7oddBUdZPSd gqytr+zj5gKCOcEwHhWVnq8dXehLkoxnNYE7p1aTd/f/AUYGDakbaRiMJVKr57qu5cPa LYooutqvAZxoSZ8wvM6L1vkFaKkapkkhc6AJqqVFcOQ4NvgBC1RolgYK0/+liyFbrYuM g8QBeFOPR4UIMF32jA6M8zTD9zgwexo43UKUEVjWUzksZC1OFsfQKKlkgtdIE9YjrDH4 agQpR6Hl4dj8PqtnYUM2mrmh/rcKofeMArM/A2Tgqy5jR8hPmUGfE1JI6ZNAV7HSw6qG 8GrQ== X-Gm-Message-State: AOJu0YwWIXArqsJLJFSLTasgo/ANP55aK/PqYWeHWxlzePJ3TK2vdS9Q Y9Wm0nSiyW7kDaE+YdxmW9bpzjaB5ZXhHxnD92yMn6uuiUuBXHvMFfYylQjb X-Gm-Gg: ASbGncuSUMDq7tf43e5914cnpQ22hO2gmJ1TwvaLhpu9lAuWcCdMg/b5y6JGGf+deir HyoSEtzr7ewpYx+zuqexywlP0zd74W03bqVDT6gTZRr/LwH7CyyNwVwzIWCkDKyzFUWtfiFf7BH YLtz3C6Ug9S+cbgJxOJHVVmR0weMsIThFf1uuuHYYjVVjNyg6h/28Q2TIzA1HmemWZNSUnRKVDk EthrCtoBkZicPCiOLYVl0CtnBB3jvI5mDqKsrm92pJbB28mKCEgrRZiWytfwEa877jU95CJWTP1 VJvZlWdi54hvOIeNxu+i2A1QT2xctONr9SWS9/oWzC+3AFA6uwZ2BcXPE6NZ9QEiQTKqMbMexu4 6st3yppEo X-Google-Smtp-Source: AGHT+IEQrtH6enpsWxfLDN6M9vFikqMx32zpCjz9kpMvK04rnXN1WMaltQ5ixl+BghOUpv/Nd8JL4g== X-Received: by 2002:a05:690c:600a:b0:6ef:8e4c:65ea with SMTP id 00721157ae682-700babed3ccmr200391987b3.5.1742880460986; Mon, 24 Mar 2025 22:27:40 -0700 (PDT) Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com. [209.85.219.182]) by smtp.gmail.com with ESMTPSA id 00721157ae682-700ba793325sm18843757b3.56.2025.03.24.22.27.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Mar 2025 22:27:40 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e53c9035003so4227095276.2 for ; Mon, 24 Mar 2025 22:27:40 -0700 (PDT) X-Received: by 2002:a05:6902:1183:b0:e60:acd0:fe34 with SMTP id 3f1490d57ef6-e66a4db6bbemr20286013276.24.1742880460527; Mon, 24 Mar 2025 22:27:40 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Gleb Popov Date: Tue, 25 Mar 2025 08:27:14 +0300 X-Gmail-Original-Message-ID: X-Gm-Features: AQ5f1Jq5W9en2AhoOfqZKVrnAT_rSHpW3nlczMhy8AQNo8CGAaUyhJRKF8s0-RU Message-ID: Subject: Re: Would we want pidfd_open(2) & SO_PEERPIDFD? To: Konstantin Belousov Cc: freebsd-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Queue-Id: 4ZMJMy2SBJz3XgR X-Spamd-Bar: ---- On Tue, Mar 25, 2025 at 8:04=E2=80=AFAM Konstantin Belousov wrote: > > Can this be summarized as just a use of pidfd to > - get the pid of the peer > - ensure the peer liveness? > > I do not see much need of pidfd for this functionality. What's the alternative? Tapping into a socket with getsockopt(LOCAL_PEERCRED) to obtain a PID via xucred is not an option because a client is not required to maintain an established connection to a D-Bus socket. The high level code expects a descriptor with some properties, so we either provide it or have to patch large parts of the code using it. Emulating pidfd somehow is also fine to me, but I have no idea how to do that. libinotify-kqueue example shows that emulating a descriptor with certain properties is quite a non-trivial task. > pidfd takes ownership of the parent/child relation. Wait() family of the > functions clean after zombies, but this functionality is subsumed by > the procdesc, so it is 'kind of' contradicts each other. Also, as I > can guess, wait() contradicts the capsicum idea of representing all > access rights as file descriptors, since the special relation with the > child presented yet another special process right. Yes, this is a problem, and I have no experience to have an opinion there.