Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp907990rdb; Fri, 2 Feb 2024 07:36:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9jSEQg27/HbLAOuak2TWh4JjxFxeeJfvdIO0gKOGXcWcmb8hAv7kMRlI4MJ6dyPbrcLB4 X-Received: by 2002:a17:90a:72ca:b0:295:fb69:f7f0 with SMTP id l10-20020a17090a72ca00b00295fb69f7f0mr6607436pjk.22.1706888195518; Fri, 02 Feb 2024 07:36:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706888195; cv=pass; d=google.com; s=arc-20160816; b=03rW6a5gJ8TUC7D0N7FbzoTETtMl0J1/LHs5tGNZnI4ZHAAFtwyF04ZcOBGv/cQ00X kDhlaQPweS97YIp+Amw1xnEQ8BWZ0+A0ROl4y5zQmMpWYrYMv4SAcZy4qJkEc4D0BlUK 0aT+a4w7vcgx2ucJno+TImUwIf8LRy36OebWjHj3DFtpEtsEQrShuBa37PPoDuzvTHfa e6zXf5gePEUpL80YMNUY1BA0RY7V4HazgiObMKCIfZZyKYcrPZkW7VQ+YMsbHkut7wX2 m8qeeqzIGBo6cRSxxye7L7gUqONiQpYS1H6MhX5eVK3eIrIozHdgnfTsx7zmTxoHmF1f e9fQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rR4f/G9KHpf50WpQRzxJGNJUjVXtgsd/g7AYKCOPypk=; fh=1JL2qidigvgg1x6W4bdjA1NpJJgObSw+GkZdMIYI79U=; b=nkHo3LDA0B7A8bmEdB4YYw9OiazhTrXkQ1Vlh0jLFQ2Y8zObf+Gx48F4JZ5qu8744E rVLEzRu9hJbUPFJNr6y6Ia8dvq4JUQeCw13U94lZMI6hEHPVDI9NwBVDvsaNV3IFpcsW PJ5B54cPNR24EPM9ZkcU/KbNdAIoSHImmFw75jHPTsvMOoQBNZjCYm652w9sNr3O5HnU BFyt3d6VCEMgPsFEiDTFB0weioINvvF2C4W/2/ytORQxW1rpgKK+mgLGB3YTv53vDtjC korXwoXrNojtNyXkMKC4SQB0X218RY/PVHeJIgauImmpjELf0Y4MLSZL6GOYnZBrfm3u lzPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZJA8gBX; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-50028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50028-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org X-Forwarded-Encrypted: i=1; AJvYcCX+1IsTVMyf0F2R3zf9VYiHt014rqsJ5tpZ43cMAfagXLzEZcXbgiqVxd4JypP8Va2B0GSHai8GX9emfpdmSElZCVD+R0wR+NI1nK9eWg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x23-20020a17090ab01700b002935f38dcf1si95683pjq.181.2024.02.02.07.36.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZJA8gBX; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-50028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50028-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E41E28B6E2 for ; Fri, 2 Feb 2024 15:36:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB5B71482E7; Fri, 2 Feb 2024 15:36:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DZJA8gBX" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 929891482E8; Fri, 2 Feb 2024 15:36:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706888182; cv=none; b=J9XfisvARrTZ70sosG5ecRm/KK6l6zf6aNhyDESk241AYgT2Bo5D7xU+2mrIgR8PR9es/ZzkNorUrxI8mRIaSzx7lLPaeaTBQwdACQPdhVwII7uJVyY92TQxFPHrTKK/mfo9Gb5vTW2Mp6bKmqWvut+g3sSbJvhZOQFDfAgmdJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706888182; c=relaxed/simple; bh=Wvl87XNvXMMBWBNxLEx5QalHdJhfB/UDqRD0cL5pQrQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MgooAgqS0FwL95KKIN6l8bWbFtV2cf9tRMOGhXECtvwKKniJUhQvdh8qav/i7H9Z//xkQ0xFs/PiCX3MLawCHW4y1xvWJ1hS5Vs7u4XHnF45fRFpFowavUptoCRFI72nHifCICyorVQIEAmnaBb/Z5jRhTxYFYN56vuhIptCIiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DZJA8gBX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25AA4C433F1; Fri, 2 Feb 2024 15:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706888182; bh=Wvl87XNvXMMBWBNxLEx5QalHdJhfB/UDqRD0cL5pQrQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DZJA8gBXms4F+fDYW6PqCtbmIskJoLqLxNLntY0A5nOHSLbtl94NwrJo0pwCAUIO7 Gl3OzmnfhgtOfSDB/932KCoZyiuEEnzRIuW+YdF4vmSXUXB6Dfy7ecxygCt6IbHDM6 6DBi+PKKKzr5MZlyUGE5zplsn7Fuw+pS/vp/zyz8= Date: Fri, 2 Feb 2024 07:36:21 -0800 From: Greg Kroah-Hartman To: Alice Ryhl Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Peter Zijlstra , Alexander Viro , Christian Brauner , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Dan Williams , Kees Cook , Matthew Wilcox , Thomas Gleixner , Daniel Xu , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 7/9] rust: file: add `Kuid` wrapper Message-ID: <2024020214-concierge-rework-2ac5@gregkh> References: <20240202-alice-file-v4-0-fc9c2080663b@google.com> <20240202-alice-file-v4-7-fc9c2080663b@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240202-alice-file-v4-7-fc9c2080663b@google.com> On Fri, Feb 02, 2024 at 10:55:41AM +0000, Alice Ryhl wrote: > + /// Returns the given task's pid in the current pid namespace. > + pub fn pid_in_current_ns(&self) -> Pid { > + let current = Task::current_raw(); > + // SAFETY: Calling `task_active_pid_ns` with the current task is always safe. > + let namespace = unsafe { bindings::task_active_pid_ns(current) }; > + // SAFETY: We know that `self.0.get()` is valid by the type invariant, and the namespace > + // pointer is not dangling since it points at this task's namespace. > + unsafe { bindings::task_tgid_nr_ns(self.0.get(), namespace) } > + } pids are reference counted in the kernel, how does this deal with that? Are they just ignored somehow? Where is the reference count given back? thanks, greg k-h