Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9750571rwp; Thu, 20 Jul 2023 09:09:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlGpEj/JiXDlr5fKMujrZG8H2oXyL0n5O8vrupelpu9xM4Rjm+pahzpKbumGLcET3oyUxKV/ X-Received: by 2002:a17:907:7f90:b0:99b:56d4:82bb with SMTP id qk16-20020a1709077f9000b0099b56d482bbmr2234774ejc.6.1689869350645; Thu, 20 Jul 2023 09:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689869350; cv=none; d=google.com; s=arc-20160816; b=JkfQRF/dksTdrBKgKggMLRJ+LMoC7qgldnkGjJvUL0APoWUWxBrM4OFfwwetHjhkbQ QAmTRUDGeASJS00IZCMmd96x6uhzG610W2d7/gPfqN1MG4UH2YYgxHHD2fUm2pNF7GB/ Ty0dNnHJNtVhS0yNcczTaPCqJkQEr2eztyfQGnFmpc48Xoedt2pgov2qmJHAnHG9vYJ+ UgTUPubJfbZx7TafnVWYEGqhqTMp3sK2FlqkcBE5PBlOLhYBOnYE13bgOd1uG/5rQqci HDq6dalbdpxOQkSFLlFwHvy0qMD4tJWXQXCykG10s8Ny5QHAxmclMfn4EfHEQqmyNrzf 84mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=IWv9CLtWtTznOku5eHmfJC2LsM6xPb33sZCLyzCmpPY=; fh=QJeT4Tw1+lehlJr34+f1S62NYu5oqf+8bwCeYvKnO+o=; b=VTOBrlP1Ihu3kzitSITRAI1mCHnQvwIGeQzEmY3BGewYFmTIzOlLNNQJsXYosCRIp+ GIInWrBhSQzRkKxjcuDke8SaJmfUsdAKlyhjL3SO8PdkKaJ9d4EzjOuSxEMcmgYTlQN4 mtlYHOjNvqFm3HTPhdUIgP3FFrDI411ZNzmbQmymhEtXZgGPxXe7GxvfaJq6/lRnIXAs pB91924OQyI30YDX3fVthpQX7SALjecUisHlDTMpP3lPXu/a+pP7Np9ukHnNyv7tZYRV EpePExn+7LXY33H2KcX0xASi2rfiMAtNwKJ+PnZ1DpHxb+IAU3a0NI0KlUFmSgSWQ/zA L/+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=c1JgmH+t; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qo24-20020a170907213800b0098642e99c22si803200ejb.604.2023.07.20.09.08.38; Thu, 20 Jul 2023 09:09:10 -0700 (PDT) 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=@google.com header.s=20221208 header.b=c1JgmH+t; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbjGTP24 (ORCPT + 99 others); Thu, 20 Jul 2023 11:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbjGTP2y (ORCPT ); Thu, 20 Jul 2023 11:28:54 -0400 Received: from mail-ej1-x649.google.com (mail-ej1-x649.google.com [IPv6:2a00:1450:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEFA62712 for ; Thu, 20 Jul 2023 08:28:39 -0700 (PDT) Received: by mail-ej1-x649.google.com with SMTP id a640c23a62f3a-987e47d2e81so76392066b.1 for ; Thu, 20 Jul 2023 08:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689866918; x=1690471718; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=IWv9CLtWtTznOku5eHmfJC2LsM6xPb33sZCLyzCmpPY=; b=c1JgmH+tNZLWMbTCSosM+iUVmcQSKnrVa80UTDLEeP9RITnb103bfyCMD8vc/lrM8u rY8MgTzI/P9CbtUQ2K0sOFQUHS9dh7r2J+vsYz33TKkgfNGDR4z8kfUnTFTsZTPpX2VQ 9T8wonC5Rcnr7VEQzRZKGi3yjjpOlzaMV3TicsPfoOOnuSjoQE2h0gBe6vtwHWmELenj DWhnODkj6bF24upvhB7OsZU/y+sk1JWZdzY4vs+pYwItk0t+kii4mJ+oxxT/VOK+bLYG Q3VKxY2KMgjSRJDs37zhwH8FL0+glfOM/Z3T5VALtt6KUhECeTXa2cY6q/tyv7Jw+g8D NWBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689866918; x=1690471718; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IWv9CLtWtTznOku5eHmfJC2LsM6xPb33sZCLyzCmpPY=; b=g2Kbo/C67B5D7+QstJ5b+7QiJu2FckskMP/yBHA6tkvJT2kpxRfNUeFkU0HsBoBYMo UU+GLrWnoQOii07jUDDKoau/GBDUOHej1Yekd0xRg1CGDXPx+VAS1QLHtcrqhEXvxzzo YdYRSVXMR0cg583JUN/gJUMdCBX+jBto7MVuFwY6iQDz9EnvLYbg7aVsYLYRnXNI1Vyb 8nUaI+iHZR2/tqi7crVDVnOKm4AgECiniAwpSxGGfYwXyiiQankN4EMxBhhCjXXi0yff AXLN+LxVel7jIHBAKlzDtbj+4YQkn3w9fAM0t7UxhEiOoUr6YDwbKrljdOS8IZEJcDHk tpXg== X-Gm-Message-State: ABy/qLbM8P/Ag8MldWCPCjorVl4j8y9+evyDsXLzEy/Edgc/gf9J6tjs u9IV11MHXyApsCCy2dA+6zdZGB1/rT3JR1k= X-Received: from aliceryhl.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:6c8]) (user=aliceryhl job=sendgmr) by 2002:a17:906:8a62:b0:98e:78ce:2979 with SMTP id hy2-20020a1709068a6200b0098e78ce2979mr13545ejc.12.1689866918147; Thu, 20 Jul 2023 08:28:38 -0700 (PDT) Date: Thu, 20 Jul 2023 15:28:15 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230720152820.3566078-1-aliceryhl@google.com> Subject: [RFC PATCH v1 0/5] Various Rust bindings for files From: Alice Ryhl To: rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org, Miguel Ojeda , Alexander Viro , Christian Brauner Cc: Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Alice Ryhl , linux-kernel@vger.kernel.org, patches@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 This contains bindings for various file related things that binder needs to use. I would especially like feedback on the SAFETY comments. Particularly, the safety comments in patch 4 and 5 are non-trivial. For example: * In patch 4, I claim that passing POLLHUP|POLLFREE to __wake_up is enough to ensure that we can now destroy the wait_list without risking any use-after-frees, even if we have registered it with epoll. Is that correct? * In patch 5, I implement a utility for closing fds that might be held using `fdget`. This is rather non-trivial, and I would be happy to hear suggestions about alternate solutions. This patch is based on top of https://lore.kernel.org/all/20230426204923.16195-1-amiculas@cisco.com/ which is currently the top commit on rust-next. Alice Ryhl (2): rust: file: add bindings for `poll_table` rust: file: add `DeferredFdCloser` Wedson Almeida Filho (3): rust: file: add bindings for `struct file` rust: cred: add Rust bindings for `struct cred` rust: file: add `FileDescriptorReservation` rust/bindings/bindings_helper.h | 8 + rust/bindings/lib.rs | 1 + rust/helpers.c | 36 ++++ rust/kernel/cred.rs | 66 +++++++ rust/kernel/file.rs | 331 ++++++++++++++++++++++++++++++++ rust/kernel/file/poll_table.rs | 93 +++++++++ rust/kernel/lib.rs | 2 + rust/kernel/sync/condvar.rs | 2 +- 8 files changed, 538 insertions(+), 1 deletion(-) create mode 100644 rust/kernel/cred.rs create mode 100644 rust/kernel/file.rs create mode 100644 rust/kernel/file/poll_table.rs base-commit: 341faf2b45ba266d52c1ca886c4ffca52d666786 -- 2.41.0.255.g8b1d071c50-goog