Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1048042rdb; Wed, 24 Jan 2024 03:22:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6eYt3gI4gP8y1tQESCG3nj+tEbHKaUhanQmWhwpJlzBVJzjS1jsDluvfGxW/KxPIY6FQm X-Received: by 2002:a17:906:f6cb:b0:a30:fcbb:cc41 with SMTP id jo11-20020a170906f6cb00b00a30fcbbcc41mr820703ejb.64.1706095352308; Wed, 24 Jan 2024 03:22:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095352; cv=pass; d=google.com; s=arc-20160816; b=jczObqQ5CF7g6YQfC5lwVyFpUp/ck4pKgG9sIwvBJQZ6TafC/NW74XuF5kxFp9I1Pr 2TjW+mcyhTt4iB/1W6WjIZc2U2oR8LSdF3naMbIZVTAFTDYyE7jKmKPAWq5UE0CN+o3M LndSuY5yta+58ZUKT+FlSWV9exAQKAj7Hrcjv9nw0cQC0nF1cglfoSR0Wp51bICBVInj mE9DWwm0CGBlQ3klD8j5QvUcaRYuBzGMA9o181eMKl5W8jduDatdxragwpnLRhBPCeWo k0CMzZsJW07tL4pFDF4Q/dnTD7kfnve40V8j84rMcn7O9NYB8tP5AdPzFgi8XRNK+uSX Fxuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=Q06qj25A3W72nqjSyyLYpEWv6SpYxc3VbfOrmnq1lmU=; fh=pbMQvrklqG6GdVdPzj2FmnXVkDYvQuGdRzCBEiIMecQ=; b=oEdnR8a/uBWQFLFaXPV+28MZco4LdqpHKX3Yi04/FFTnS6DMgSnJQGDcSsynkL0/wE fEcGM21s7c5CcCBvORW5sXNOvI/aCoqy6T17ftb9e3CMTtPWMn8n4RZFJ3hFsW6Vpegg 6UetBn2pndN0oyaMInRq9Tb2yGup64ms+zzEW9D10ZA/PWg8/Q9Cq/THeZjcA5qctJEl JOPA9trE0BhU/OhG3uKHErfO+mLPzN/w7PYSSIrR1bo5WY/7bYlzrXtL+ntwGfQxfxjm Y+gYv7I3Sz7RXHMfsBTto+fPYMYsMccO0+95bfVHNrjJYFdVbMEub/avaGXEsNO0KyFl G4+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Bzn9Q1K3; arc=pass (i=1 spf=pass spfdomain=flex--aliceryhl.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-36846-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e2-20020a170906080200b00a3113e20846si590370ejd.833.2024.01.24.03.22.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36846-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Bzn9Q1K3; arc=pass (i=1 spf=pass spfdomain=flex--aliceryhl.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-36846-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CAB7C1F2653C for ; Wed, 24 Jan 2024 11:21:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10D5B2BAF3; Wed, 24 Jan 2024 11:20:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Bzn9Q1K3" Received: from mail-lf1-f74.google.com (mail-lf1-f74.google.com [209.85.167.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 625A01B801 for ; Wed, 24 Jan 2024 11:20:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706095249; cv=none; b=usTWAA7jBGT4htx0ncPS7d1uzXaB8Jo4hVxMgnuNsfbkRR0PHJGQXksXHauIDIDv8sAX9ol/R0i454e+ApER7H8+6xyesTX6wbgJl4mGNmVrizt+bFrTuoFU/WaX+sf7RMyavcv8qcPboMTnlkE/WlWo7/J/fetsv6QzTn1W7AQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706095249; c=relaxed/simple; bh=kWQZyqAOGP/F6TE9A7tinFjaaoaS7LJ3wiTiWkD4Qns=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=gm4KnnaQO9w6J4MHAIKdQ/yAVIo+Wg//XBH67HkGBdiqjFvcy4nJeC5kd28kUQ92CCAguAugoP3BNZaBxqIkWWomtXsrIYCaYB+QDvfoqvTxN31mp/f+L2MQOZRF9K26EU0JwxstWj27s1P+HjRzQegeORwq6ljchFVDrXJl7O4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Bzn9Q1K3; arc=none smtp.client-ip=209.85.167.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Received: by mail-lf1-f74.google.com with SMTP id 2adb3069b0e04-50e55a909baso4520886e87.1 for ; Wed, 24 Jan 2024 03:20:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706095245; x=1706700045; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Q06qj25A3W72nqjSyyLYpEWv6SpYxc3VbfOrmnq1lmU=; b=Bzn9Q1K3f2EtWJMt/tOLFdvg3ouqm07N26C7RQ0a7XAJKeRg3yoSMFGO/dq+y6zDjZ 3pK1AOnzSCZlDlUZICm1qy/05qU3wN2g3pPTFHUcpvwLzSxK0uu2o8M0h+pR+ekPDyME 7EDMPGK+zgZL2Kdw/GGZ02pC2HWN34A4h/5gTTsdB7WPI9EnDGeGjowMvRutdnFt7DjF hKyHr00K4S13zgiQ5dTUaAD8sIH4R1ubqLOz/f7S5CN8j07MD9T3S8FN0lmZDOeWsksz XNJwHn8dp8Zv8I2IhPPlz7u0yjRRk5PDY1nTWzAcJ9tOrMiMmNQvYHv8fPC76C8QGbrY 1j4A== 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=ZUyTmgex2Xw8DYiG8Ad3xuk2AGXpFxYqEjpg2D5tSdRqlE2ozLpJQ1zdnAVI+tL8zr 2wxhqL+HloH10ensYPZEyHGqLadoE5Yzo6l+mW7i75HU/tQFbcqr2SNKRh/K/bVRpYJ4 su1byPVV9LZkxR0RvSKPo7GmdRuQiMH4Rson5K90uVbfScElss7esYXWWi3YIpI3DnVt hWoPwWporjlWOjlDBYGbC/Fauwv25VKQPItZS7Vv8+qG3ZdEY93W4EwWTRT5e3l7+3lQ 41oD+gZExX/ISat11LNPVmcTrnnglKFGYMYm6kPW2trYSeONWqdoigyfdUAz/fUGDr1O OocQ== X-Gm-Message-State: AOJu0YxsP4EVQFmL7caWsSJz+fgsZH2pdhVjI0jrJeA6dawwnJ92Usyt zhkDTL+yL75YP1N37Oh/OeWkulkEpEtZXbxr7khe1FhxH2+p9Np+ztgPwsU4AgpTViYiX5dnAVX hdT0LbimtYp3vlA== 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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=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 Content-Type: text/plain; charset="utf-8" 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, -- Alice Ryhl