From patchwork Wed Jan 24 11:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 13528935 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C26C46CD2 for ; Wed, 24 Jan 2024 11:20:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B302E6B007B; Wed, 24 Jan 2024 06:20:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE0BC6B007D; Wed, 24 Jan 2024 06:20:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A8A96B007E; Wed, 24 Jan 2024 06:20:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8955D6B007B for ; Wed, 24 Jan 2024 06:20:49 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2148280CB6 for ; Wed, 24 Jan 2024 11:20:49 +0000 (UTC) X-FDA: 81713962218.09.5E2F9F2 Received: from mail-lj1-f202.google.com (mail-lj1-f202.google.com [209.85.208.202]) by imf12.hostedemail.com (Postfix) with ESMTP id 3BCA34001D for ; Wed, 24 Jan 2024 11:20:47 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DNKl+dKQ; spf=pass (imf12.hostedemail.com: domain of 3jfKwZQkKCGoITQKMZgPTOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--aliceryhl.bounces.google.com designates 209.85.208.202 as permitted sender) smtp.mailfrom=3jfKwZQkKCGoITQKMZgPTOWWOTM.KWUTQVcf-UUSdIKS.WZO@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=1706095247; 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=Q06qj25A3W72nqjSyyLYpEWv6SpYxc3VbfOrmnq1lmU=; b=Q3kGluonHS1RB7Do7aIOoYT4n24cGxwgerZKxMRU2BNbbZaQPRs5WIrrPeue2GnodPvJaQ i2Yv0OoopJthnSuxNxaRyLDHK1UpS5QZYiyKPzke1tDNB18eQAkA+0KIeeenCbMEIpwH9T Q/Y2N//nR35pmh31AtjF/ucnaj1G1rk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DNKl+dKQ; spf=pass (imf12.hostedemail.com: domain of 3jfKwZQkKCGoITQKMZgPTOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--aliceryhl.bounces.google.com designates 209.85.208.202 as permitted sender) smtp.mailfrom=3jfKwZQkKCGoITQKMZgPTOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706095247; a=rsa-sha256; cv=none; b=HKwG96BtndzxvR45sawu/eF5/Jijvie1B5lg5GY7N8X+/vWFTOotRWs+y28vOhUGX0L9n1 Ema6YV/X6r54rpYTXmba7tovdnaTaTuLSlGlfEJhx8juLuxW8dLfd/aIE/AnkwSaknzIPg JUzK8iZ85jPQj6y4aC2HeSBqk7I5vhY= Received: by mail-lj1-f202.google.com with SMTP id 38308e7fff4ca-2cd64009b59so38580261fa.0 for ; Wed, 24 Jan 2024 03:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706095245; x=1706700045; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Q06qj25A3W72nqjSyyLYpEWv6SpYxc3VbfOrmnq1lmU=; b=DNKl+dKQO94yyd3nDg2Gsw2K+OUE60jrq70us3hSrdT2heHa8ntYDuoB60rjABsvh2 SCFh8bmNUy+jbIRQypU5TwNYurfXyXRrGhMPzmSEuG6qQt4bcaQqMfMp87+/frOXb6FZ kYpzg3RZ09sti69OsrngAK7Nc6OAlMJdyV5wdi4ZCsPEk+FuIHVUnLx5EBPTAOuk6omc hFdc56zUMZESZJ08tmUzLvTVbeK3TMOoh9U7Yte3TjybhPXRq7nMW1oiIovMjHe/v7hf rkbQh5hdKU5BgUg8/laPhpZZeWYhd5/jQW9HXsYu7YxLPmRzhBh3H4vV8nesxgY8af15 NVNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706095245; x=1706700045; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Q06qj25A3W72nqjSyyLYpEWv6SpYxc3VbfOrmnq1lmU=; b=UHtD/kPG7W/2naC0LgyEOEbzG70EQi4u+5ShGr5R2aTQvrMqJi8QUcwA77/dFx0tIm KFvaXVRbGwzGwoVkH2gWTu74zJ5UuxhpbypxEjxUwDbRaRsdEgHytEVFx2lXbYkwdwLF y9rFuhKlioKrpKXhTvHW2+etvqxSTiTDi2QGs6/6uCM/8W+DML8gpvV0Nsk3IJ2RFzuv 249pFLQoyY/fDejWXjgP6WOphq9FSgV33P2C24bSfN+CRsmzKTk98CM9ta4fcjGpgN+M fwVNcm9aT79z4HgGKW/rgxwpRAd4c77leVS7UmU4X6ZCUPvftiSEfo+LhBKzXBqHa4Xz SpNA== X-Gm-Message-State: AOJu0Yxs5/z/r/jh7FpNaAXoQ44ZsOO4U5t4D60GkO9laG3nct/eHm+c JG3bsm9Cv6n3UBmn+ZyuT0mVkZronbAPePKL6vvIuNPowgdXtz3Pkje3zTJ7kAcuEu6D5vKERV3 143JP7F4HxlkvxA== X-Google-Smtp-Source: AGHT+IGtewFNOMp+E7UHcuxspPCn1NHbjZFhNiQV1tQT73RWZ+1gjCDwEDBYZ88PY8GCHXnhdbCRL3PN6v+5eqQ= X-Received: from aliceryhl2.c.googlers.com ([fda3:e722:ac3:cc00:68:949d:c0a8:572]) (user=aliceryhl job=sendgmr) by 2002:a05:6512:348a:b0:50e:7045:686 with SMTP id v10-20020a056512348a00b0050e70450686mr13196lfr.9.1706095245201; Wed, 24 Jan 2024 03:20:45 -0800 (PST) Date: Wed, 24 Jan 2024 11:20:20 +0000 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAHTysGUC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2NDQyML3cSczORU3dxc3aRkU2NjE1Oz5NRUCyWg8oKi1LTMCrBR0bG1tQB gnQXBWgAAAA== X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=2107; i=aliceryhl@google.com; h=from:subject:message-id; bh=kWQZyqAOGP/F6TE9A7tinFjaaoaS7LJ3wiTiWkD4Qns=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBlsPJ0mZUB7ZjFDvGaQmhyq/UORIo20C2j9zcVt YdntYpZ4uKJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCZbDydAAKCRAEWL7uWMY5 RgyDD/9O5nCInCi9N8fvfrgrF46WqPERLsFS23XOKO0HXmazeBbiBDasMKtTtRJTYjY835m8gGc kGptRXU5jX6dSdSywW/bEhqu4AR2K3dXqtWYSVVxU8lhu8e1V4Q8SVfIbZ5NDHq3tdytEJuey4M 25pgYgWsXraIyrYswv8YbroJqEdS/ENClVz6Urn/yoHfNErOkn8ygvXEkhxfSFs5LuIkTEjd6Yb J70MVi02EhC4Ce9fU97PhL1QgEkxmlIY75li8xzxdO2MQWG9R0P0GhcTrO7zKMZOVsAhcuHUkLN mnSUhv2XALVke10eT1bfNkVjS/FrngCJ02mIWRNHoOTCV6wvxla+24DVx8rQqkEyrOXKPRoUjj8 PG5pnmzcLASw2uwhoU6MHLqCkCMEwSEtkyHkAXGP6EZvDZ94Ru5UBk9gdziaVpCnloAqTfZZd2n mmm8nADiG7suUwBJKFfyBw7XBjh1z52aeWYOSTkn1AN/oPAE1gGThS5SrQMe86IMrrBVbWc108i g/iF+I/BLuQTsV2NQQIyFI5Ro4adCA6jMthxZx07tyCcy9qk5EOM2pgotgxrMP05c3o0q836Sy+ G7A3Rh+a+xgLJ4ZcfQ6ejlxWblcrIWQmdNTx0Kj4mNaCuzZuvNZ14nURwD60prjTbSejAbQL4j7 Fpgm1T2lrt1cxWQ== X-Mailer: b4 0.13-dev-26615 Message-ID: <20240124-alice-mm-v1-0-d1abcec83c44@google.com> Subject: [PATCH 0/3] Memory management patches needed by Rust Binder From: Alice Ryhl To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Kees Cook , Al Viro , Andrew Morton Cc: Greg Kroah-Hartman , " =?utf-8?q?Arve_Hj?= =?utf-8?q?=C3=B8nnev=C3=A5g?= " , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Alice Ryhl , Christian Brauner X-Rspamd-Queue-Id: 3BCA34001D X-Rspam-User: X-Stat-Signature: ygxxgej6hepe13rjibqkr5fkc4zjdhn4 X-Rspamd-Server: rspam01 X-HE-Tag: 1706095247-762378 X-HE-Meta: U2FsdGVkX18RWqj6H1wts+i0xlpMDJ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E3EKv7ap6GvrXpt3CggrPLXm9A7kOA2wAhYtEdLM4TOjEG1FLtiJO0whWJlRlvChYQb3fFjQdgp12dSIIxq+VdpUHiGkl+oTghtpGMaIj3tapPMM18FuXeOYms1MCoYlBReGsvVhfpHXQOk8CJAkoUz4mXNycFVFaeXfXtMW3DIwtyb7H9m+Zx6Fc8rguqGTgn9g1ICEtGo8gF6bNrspfUbbtRs9QYyGpimt9KMI7YbaP1CIJaGxqZfhXWFS6BcQdqL7aRRBR6IUOsT0q6OhSp0f6W0cDyTmntdILPL/cS/CY8cG3wkeL3Y3mVgQlo1xwl2xabGv/Feuka/WFQqSAlzOIMnW8ZRwBHGBzow8RIKjWzq5HxUHGckvAEj+6rIJPUVwGT8Z4H+6j2FEuo7EOdr6+vu8CMeRPH85iETtnFefv5w7qwIj055WpghgoL5ZPwmwGoFIKgqTTZ3gwbqbYi9Y+S3V3GmicAujZHE9ELtIaaOJ+C2qHyPLsADhsQTRktlyG9Mplq+kSR1sh2v/1y2NA2q5BlARk6jeFXtpmMrv5c+wgYXCmJU= 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: List-Subscribe: List-Unsubscribe: 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 Especially the second patch with typed accessors needs review. It contains a Rust analogy for when the C-side skips `check_object_size`, and I would be very happy to receive feedback about whether I am going about this in a reasonable way. Links: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f637@google.com/ [1] Signed-off-by: Alice Ryhl --- Alice Ryhl (2): rust: add typed accessors for userspace pointers rust: add abstraction for `struct page` Wedson Almeida Filho (1): rust: add userspace pointers rust/bindings/bindings_helper.h | 1 + rust/helpers.c | 68 ++++++++ rust/kernel/lib.rs | 2 + rust/kernel/page.rs | 176 ++++++++++++++++++++ rust/kernel/user_ptr.rs | 347 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 594 insertions(+) --- base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d change-id: 20231128-alice-mm-bc533456cee8 Best regards,