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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45850C4167B for ; Mon, 11 Dec 2023 16:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344784AbjLKQBN (ORCPT ); Mon, 11 Dec 2023 11:01:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344651AbjLKQAu (ORCPT ); Mon, 11 Dec 2023 11:00:50 -0500 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC7602682 for ; 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?