Message ID | 20240404-alice-mm-v4-0-49a84242cf02@google.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53D7ECD1292 for <linux-mm@archiver.kernel.org>; Thu, 4 Apr 2024 12:32:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1F796B0089; Thu, 4 Apr 2024 08:32:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACFAA6B008A; Thu, 4 Apr 2024 08:32:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 996E16B0098; Thu, 4 Apr 2024 08:32:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7BA036B0089 for <linux-mm@kvack.org>; Thu, 4 Apr 2024 08:32:05 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 18CDE40BD9 for <linux-mm@kvack.org>; Thu, 4 Apr 2024 12:32:05 +0000 (UTC) X-FDA: 81971786610.20.9B1EFD3 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf25.hostedemail.com (Postfix) with ESMTP id 34A83A002F for <linux-mm@kvack.org>; Thu, 4 Apr 2024 12:32:02 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=2kt+0y9s; spf=pass (imf25.hostedemail.com: domain of 3wp0OZgkKCG8NYVPRelUYTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--aliceryhl.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3wp0OZgkKCG8NYVPRelUYTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712233923; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=BdH/gdE1nY5fzXt07x1io7y2LA29YSrbMxYZzDwB1DA=; b=TMmoTKUe0nCBNCPR8cmDsTbeP/jtpa8BfeKqpXu3FzPtDVym9l3uXiFIZs37fbpyrz8HoS gsI5gtMOZUrroWO+OwRoSGQhNC7JYBLYWwIqP24yhPYXOfwvAH4JTvS7X93eH5b1c4KABg yVVawqeYIYdgNnGqWNs9YYKSNnlwtkw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712233923; a=rsa-sha256; cv=none; b=g+4v0xgDlHLcme58eKU+zSaVLQ5mOYaYkXndrE7OgYeEMNrMh6tVmVr3tC1WSNJOQpM7sh 8SZfQK8IM6Qvo4Zl2RC3HT9T8lWSS9JQo0g5Eka0U+zzpSyAtIwTxzVb0U74S5rkgaALxy cYrJ/Cf+CTO4FjqEqAlXgTsb8///Njs= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=2kt+0y9s; spf=pass (imf25.hostedemail.com: domain of 3wp0OZgkKCG8NYVPRelUYTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--aliceryhl.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3wp0OZgkKCG8NYVPRelUYTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60cc8d4e1a4so16549727b3.3 for <linux-mm@kvack.org>; Thu, 04 Apr 2024 05:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712233922; x=1712838722; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=BdH/gdE1nY5fzXt07x1io7y2LA29YSrbMxYZzDwB1DA=; b=2kt+0y9sHtpJxTAOmZSowodB3mGGqfVd3D+eoZ5fDITXjE7qBV1amXtMIbaXsw/UWl kHM6osumXZEW0JTnDCVHS4mOkg2GUriXgXKCYVfaKjkDY5jUs45flOAfN1ZVJK6FKAo0 iTkack2MPIXur3BqPjZdkblo4p7xV6sWHxm8NJ5d284J3JayyogZCl6djJ3izAD0RXZG 5aVxhb71IfFdTzbK5L0wyevucL6KyMg3qgLgtYhHieLzZJABTEvPrFME25GsXBfcLAp3 PO4gFt0l1ue7UHxtQHP9lyA0qb0ArpWaQV7NNWR6pJbfsuE3HXWfetUlbA9mmyXM2ShN iQuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712233922; x=1712838722; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=BdH/gdE1nY5fzXt07x1io7y2LA29YSrbMxYZzDwB1DA=; b=Wwv52OKwUjMvq5C4avSkPvhTcCBrpD0SEIDEDxQkjsp6KxyhcFw6/nGmpC7AQOTOC0 JkaHQH8+lt8iK3mrElx82bbzG3QushXv+wbdBl9l2eRlrmiaIqFyM81JHdDyiVTezIXz XenVqb2QD4G34pYLKEaaQueppedDLdiXlQbmaFLSjHVdbfysZLdw8oUcsqSH2MGId9Rn K2IV29YZx8RH5pFbZhkvssWgaqZM/AyljqxGo4Jz7Y6WvMwwJxU/zHFSzx0h16O8N0GO XZkrOXSLfDc/VM1re82xFdv0ZeIkmvxOqPkNuNjAl7072xV1l1FqTFIgC4kqTgwjEBa0 2j4A== X-Forwarded-Encrypted: i=1; AJvYcCXDcHYnN2Sh4zmDpXKBLVzbFxOPQC/YyfCufhDyxK2lobGNypuLgUsH+4ufWjEqmyp08kfjRHXUKFx00bIpvdReuP4= X-Gm-Message-State: AOJu0YyQJtSrkPpG9/gTlmMzNTzVg/lZcAh6IXgouIpO7FHbDrDWyJ6Y Jk9o7iif/oV8cbv0Tb14SRFXe/I7RB5ecQd0az06f8cGrRtU+kerLDt35KEUzFcsYRh+LTnhriE OTMbySw6y2QJMOA== X-Google-Smtp-Source: AGHT+IEzh3qIzx1LAGE4XI7mt8DeGvKPiyuxF8I3px9EKzj/18nnGCvXVL454agqVBa79GQD+n0YaBC4Ds3u/dA= X-Received: from aliceryhl2.c.googlers.com ([fda3:e722:ac3:cc00:68:949d:c0a8:572]) (user=aliceryhl job=sendgmr) by 2002:a05:6902:124e:b0:dc6:e8a7:fdba with SMTP id t14-20020a056902124e00b00dc6e8a7fdbamr667777ybu.4.1712233922217; Thu, 04 Apr 2024 05:32:02 -0700 (PDT) Date: Thu, 04 Apr 2024 12:31:38 +0000 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAKqdDmYC/2WOQQ6CMBBFr2K6tqadFkRX3sO4KMMATYCa1jQaw t1t2YBx+Wf+ezMzC+QtBXY9zMxTtMG6KQV9PDDszdQRt03KDAQoKaHiZrBIfBx5jYVSuiiRqGK p/vTU2vequj9S7m14Of9ZzVHmaZZoIUFvkii54I00NRJWCrW+dc51A53QjSxbImwkiN35CJmsQ EKRFtqUf6TayPT6jlSJxKY918ok8oI/5LIsX2UGH+EVAQAA X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=3421; i=aliceryhl@google.com; h=from:subject:message-id; bh=uGUdk3e/USR45wu9+IdS0MgK8dBh31QXCZ/leMk0cGw=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBmDp2toiRNy364oNYICcJk/sSU/qgF/S+vB+KAC UcWEIQPVMSJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCZg6drQAKCRAEWL7uWMY5 RmGtD/9vmmD8rIAtTMInumhoyT6YIjXsYoBFdWkL/6yRQu4cwHvlSnwGi/7bAKtHK9ovPJuVjs+ cFAsn7y2j9s/jvGA/97N7qdXTQNKoMd0ojcC6TA11XTbYV4uWTrQYfHbmi8wjKIZv6cgnL6kRo8 5tqHWOucZdduDrD/g8vWVxmrYB7m3iC0p0YOdLxHdft5TIyLQKm/wClid7hQApy72nDYBSui86w 5CkhiLUmjPDnYvAy2ITx6esrLBP5xBqMpUb6u2aDaR/i4JS9bor0V6PEDL83WhO78Qb+S+RKAtV q4W0dCNR7gBwPDJ2ATUHXLyInmbKotvd1eYGTf+gE/KOTVigNYMBPIQL4ooywsVxzu5DxVPou4T ONXWnG/keiMZDxuzZxLUGnU/0n8AFvxowwb7xsUoG2FH9d1yXI5f8L5yAW2Mamt/7lEyqjhLX/u eEJVe0PTVF+SBl+3eTvUMF2uAuNU4nm1456lbiD9nJDfsLOu1AWUtGsfYVNaiok3BsYKcqkRbu4 u1eiy6ldcFaoXum6iHL0QvK9rX+MZPcjQNBQl1G4ALfrZTn32Jhk8q7G9Rd39g4shyHf9NRZJsd X1GsmLB2LJw7V9dwvNLv3DQa2hIMig3gIFyjq4lCwv+TR1yolDb0nvONC/B9UMwNLNjk9OuN+mW +l3Qxg8RtTX6c/Q== X-Mailer: b4 0.13-dev-26615 Message-ID: <20240404-alice-mm-v4-0-49a84242cf02@google.com> Subject: [PATCH v4 0/4] Memory management patches needed by Rust Binder From: Alice Ryhl <aliceryhl@google.com> To: Miguel Ojeda <ojeda@kernel.org>, Matthew Wilcox <willy@infradead.org>, Al Viro <viro@zeniv.linux.org.uk>, Andrew Morton <akpm@linux-foundation.org>, Kees Cook <keescook@chromium.org> Cc: Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Andreas Hindborg <a.hindborg@samsung.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, " =?utf-8?q?Arve_Hj=C3=B8?= =?utf-8?q?nnev=C3=A5g?= " <arve@android.com>, Todd Kjos <tkjos@android.com>, Martijn Coenen <maco@android.com>, Joel Fernandes <joel@joelfernandes.org>, Carlos Llamas <cmllamas@google.com>, Suren Baghdasaryan <surenb@google.com>, Arnd Bergmann <arnd@arndb.de>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Alice Ryhl <aliceryhl@google.com>, Christian Brauner <brauner@kernel.org> Content-Type: text/plain; charset="utf-8" X-Rspamd-Queue-Id: 34A83A002F X-Rspam-User: X-Stat-Signature: byxqxrb79h1uwsugknk8y68zq9434oqf X-Rspamd-Server: rspam03 X-HE-Tag: 1712233922-529153 X-HE-Meta: U2FsdGVkX18qzEwP7GqmAp//nKuzIspR2Lm+VTgTiJF2LiJE/QzJZrHZ3QHcHhg/VVQ9I03KFQZpudOyqBinZSXXGAZoC8ZN0HmH4bhbvHF7LUpnQlftGpSY7o0V/nNXpoqVQHI4ZYkNHtCnOv2DjSASVUqRWAOQFcoAlB2DR144l/hxkmB/idRqo6AMycYK9eI9x8bgcsx0bt96+xHybCPBJ8Mo/EGV1+x4k91lRjAmYkVlVut5Fy/rgIWy5eurXK5gSjAxskuORXQo4Z46VgJTZtMtOkdvSkSvgPFs/R7zfG4vgky7LOHwxCsyw2sgqAIsP8g/uFZ2Oy3RlxwTW4X2EgAG+NlyW90XzugCKx1DLXYGDVM9UTUuYAnhz0KLVKx/VwpKG5cPQQB51vypSdqcVmkHUpT8Qa85Un/b8QPPcL2MACKS40UfkVHlU/euKLHowYHrZ3QHOfg4dOoawW8c3yICF2fD2SxCo7bWM2M15CVDotOKIbGjaue15X+TfSOTVPwqu7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sO6EjvA3ODy4gboFwLQWRTHXXXvm2a/vQWm14/9aCRO2+bMdSDFEl8ZrJjL4UEco2Nuqq9A5Smr4YqX21qffU6LYmYDXD2cxEMuS5vMsmxLmqo08Yb/+1Hy/cjUlcLX+5EefwAzNH3BQ4ZRCTglTvmPhIdbF X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Memory management patches needed by Rust Binder
|
expand
|
This patchset contains some abstractions needed by the Rust implementation of the Binder driver for passing data between userspace, kernelspace, and directly into other processes. These abstractions do not exactly match what was included in the Rust Binder RFC - I have made various improvements and simplifications since then. Nonetheless, please see the Rust Binder RFC [1] to get an understanding for how this will be used: Users of "rust: add userspace pointers" and "rust: add typed accessors for userspace pointers": rust_binder: add binderfs support to Rust binder rust_binder: add threading support rust_binder: add nodes and context managers rust_binder: add oneway transactions rust_binder: add death notifications rust_binder: send nodes in transactions rust_binder: add BINDER_TYPE_PTR support rust_binder: add BINDER_TYPE_FDA support rust_binder: add process freezing Users of "rust: add abstraction for `struct page`": rust_binder: add oneway transactions rust_binder: add vma shrinker Links: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f637@google.com/ [1] Signed-off-by: Alice Ryhl <aliceryhl@google.com> --- Changes in v4: - Rephrase when we fail with EFAULT. - Remove `pub` from examples. - Use slices for raw uaccess methods. - Fix PAGE_MASK constant. - Rephrase most safety comments in Page abstraction. - Make with_pointer_into_page and with_page_mapped private. - Explain how raw pointers into pages are used correctly. - Other minor doc improvements. - Link to v3: https://lore.kernel.org/rust-for-linux/20240311-alice-mm-v3-0-cdf7b3a2049c@google.com/ Changes in v3: - Fix bug in read_all. - Add missing `#include <linux/nospec.h>`. - Mention that the second patch passes CONFIG_TEST_USER_COPY. - Add gfp flags for Page. - Minor documentation adjustments. - Link to v2: https://lore.kernel.org/rust-for-linux/20240208-alice-mm-v2-0-d821250204a6@google.com/ Changes in v2: - Rename user_ptr module to uaccess. - Use srctree-relative links. - Improve documentation. - Rename UserSlicePtr to UserSlice. - Make read_to_end append to the buffer. - Use named fields for uaccess types. - Add examples. - Use _copy_from/to_user to skip check_object_size. - Rename traits and move to kernel::types. - Remove PAGE_MASK constant. - Rename page methods to say _raw. - Link to v1: https://lore.kernel.org/rust-for-linux/20240124-alice-mm-v1-0-d1abcec83c44@google.com/ --- Alice Ryhl (2): rust: uaccess: add typed accessors for userspace pointers rust: add abstraction for `struct page` Arnd Bergmann (1): uaccess: always export _copy_[from|to]_user with CONFIG_RUST Wedson Almeida Filho (1): rust: uaccess: add userspace pointers include/linux/uaccess.h | 38 ++-- lib/usercopy.c | 30 +--- rust/bindings/bindings_helper.h | 2 + rust/helpers.c | 34 ++++ rust/kernel/lib.rs | 2 + rust/kernel/page.rs | 259 +++++++++++++++++++++++++++ rust/kernel/types.rs | 67 +++++++ rust/kernel/uaccess.rs | 383 ++++++++++++++++++++++++++++++++++++++++ 8 files changed, 775 insertions(+), 40 deletions(-) --- base-commit: 4cece764965020c22cff7665b18a012006359095 change-id: 20231128-alice-mm-bc533456cee8 Best regards,