From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="oZlTzftu" Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573FC268B; Mon, 11 Dec 2023 07:59:16 -0800 (PST) Date: Mon, 11 Dec 2023 10:58:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702310354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iTqyHUAM8Y8CTQWaVxNypmVJd4cL32JtHj8W07cIG1s=; b=oZlTzftu1xM4Uy81K6BPPht40D6wXyU4rig7xmFxREm4jat2OGKs5vZf7ecwRdgGMbe+oH 2eAWXtolC9pbNA7LfWV6t2s6db/Ow437NkbOSNWN0d+IDCiuPRtJBmBU3uQp6mJ/iSkfPn nBqIe+mIXVbyFDYiKbV0mZMkknokXF4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Boqun Feng Cc: Benno Lossin , Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Andreas Hindborg , Peter Zijlstra , Alexander Viro , Christian Brauner , Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , 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 v2 5/7] rust: file: add `Kuid` wrapper Message-ID: <20231211155836.4qb4pfcfaguhuzo7@moria.home.lan> References: <20231206-alice-file-v2-0-af617c0d9d94@google.com> <20231206-alice-file-v2-5-af617c0d9d94@google.com> Precedence: bulk X-Mailing-List: rust-for-linux@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: X-Migadu-Flow: FLOW_OUT On Fri, Dec 08, 2023 at 08:43:19AM -0800, Boqun Feng wrote: > On Fri, Dec 08, 2023 at 04:40:09PM +0000, Benno Lossin wrote: > > On 12/6/23 12:59, Alice Ryhl wrote: > > > + /// Returns the given task's pid in the current pid namespace. > > > + pub fn pid_in_current_ns(&self) -> Pid { > > > + // SAFETY: Calling `task_active_pid_ns` with the current task is always safe. > > > + let namespace = unsafe { bindings::task_active_pid_ns(bindings::get_current()) }; > > > > Why not create a safe wrapper for `bindings::get_current()`? > > This patch series has three occurrences of `get_current`, so I think it > > should be ok to add a wrapper. > > I would also prefer to move the call to `bindings::get_current()` out of > > the `unsafe` block. > > FWIW, we have a current!() macro, we should use it here. Why does it need to be a macro?