Hi,
Tomorrow, Tuesday, it's time for another OP-TEE contributors' monthly
meeting. For time and connection details, see the calendar at
https://www.trustedfirmware.org/meetings/
Topics:
- Merging CI updates, and more are coming
- Adding more generic OP-TEE reviewers in MAINTAINERS
Any other topics?
Cheers,
Jens
Qualcomm platforms with a discrete TPM (dTPM) talked to it directly over
a non-secure SPI channel from the kernel. Arm's Base Boot Security
Requirements (BBSR) v1.4 require that access to go through TrustZone
instead, so on affected Qualcomm platforms the TPM 2.0 instance is now
fronted by a Trusted Application (TA) running inside Qualcomm's Trusted
Execution Environment (QTEE), which talks to the dTPM (or implements an
fTPM) on the kernel's behalf.
This series adds a kernel driver for that TA, built on the QCOMTEE
object-IPC transport (drivers/tee/qcomtee/) already used to reach other
QTEE services.
This patch series functionally depends on below(first 5 changes specially)
for qtee service discovery.
- https://lore.kernel.org/lkml/20261105-qcom_uefisecapp_migrate_qcomtee-v6-0-…
Tested on Glymur-crd target with tpm2-tools utility.
Validations:
- Get capabilities
- Random number generator
- RSA key creation, encryption and decryption.
Signed-off-by: Kuldeep Singh <kuldeep.singh(a)oss.qualcomm.com>
---
Changes in v5:
- Rebase on next-20261119.
- Fix qcom_send_command resp_len computation(Amir)
- Use dev_err_probe in _probe and return appropriate failures.
- Propagate dtpm transfer/end error to callers.
- Fix drv_data after tpmm_chip_alloc call.
- Link to v4: https://patch.msgid.link/20261019-tpm_qcom_driver-v4-0-6889b9804ba7@oss.qua…
Changes in v4:
- Add new line before goto label(Jarkko).
- Link to v3: https://patch.msgid.link/20261015-tpm_qcom_driver-v3-0-247c8e50250e@qti.qua…
Changes in v3:
- Merge tpm_qcom.h into tpm_qcom.c(Amir comments)
- Update return values of functions and drop certain error prints.
- Define locality_arg as default value.
- Add Jarkko's tag on all but drop from 2/3 as significant changes done.
- Link to v2: https://patch.msgid.link/20260907-tpm_qcom_driver-v2-0-71a6b1752da8@oss.qua…
Changes in v2:
- Use QCOMTEE_TPM_UID as 81 for service discovery in patch 1.
- Use FIELD_GET, zero initialised array and log improvement (Konrad)
- Improve commit title and other fixes (Jarkko)
- Split MAINTAINERS entry as separate patch.
- Link to v1: https://patch.msgid.link/20260831-tpm_qcom_driver-v1-0-6f16fa6924fa@oss.qua…
To: Amirreza Zarrabi <amirreza.zarrabi(a)oss.qualcomm.com>
To: Jens Wiklander <jenswi(a)kernel.org>
To: Sumit Garg <sumit.garg(a)kernel.org>
To: Peter Huewe <peterhuewe(a)gmx.de>
To: Jarkko Sakkinen <jarkko(a)kernel.org>
To: Jason Gunthorpe <jgg(a)ziepe.ca>
To: Kuldeep Singh <kuldeep.singh(a)oss.qualcomm.com>
Cc: linux-arm-msm(a)vger.kernel.org
Cc: op-tee(a)lists.trustedfirmware.org
Cc: linux-kernel(a)vger.kernel.org
Cc: linux-integrity(a)vger.kernel.org
---
Kuldeep Singh (3):
tee: qcomtee: Register qcom.tz.tpm service for discovery
tpm: Introduce Qualcomm TPM driver
MAINTAINERS: Add Qualcomm TPM driver entry
MAINTAINERS | 6 +
drivers/char/tpm/Kconfig | 9 +
drivers/char/tpm/Makefile | 1 +
drivers/char/tpm/tpm_qcom.c | 410 ++++++++++++++++++++++++++++++++++++++
drivers/tee/qcomtee/call.c | 4 +-
drivers/tee/qcomtee/qcomtee_msg.h | 2 +
6 files changed, 431 insertions(+), 1 deletion(-)
---
base-commit: adcad7f4e6332cff3d6d7165f41584899f598534
change-id: 20260831-tpm_qcom_driver-d21c720e73b2
prerequisite-change-id: 20260408-qcom_uefisecapp_migrate_qcomtee-13869d45e014:v6
prerequisite-patch-id: faf4520d818abf0d7533f71d9c8b9a8aade34626
prerequisite-patch-id: b487dfe2fbc076f4815dc6c73b9e68b0b78c961f
prerequisite-patch-id: 9f2c4ee37ba173bdc860f253d44974379f2cf125
prerequisite-patch-id: e86905ac6289821db30fd9a17f73e276e0a88363
prerequisite-patch-id: 09a86ee4de34e0c9cd2e4664c54a6473d7998299
prerequisite-patch-id: a940a0624f1e130d1fe5213952965aa469bf9547
prerequisite-patch-id: 7be993abea2ca36057d9352381a5890f50996dda
Best regards,
--
Kuldeep Singh <kuldeep.singh(a)oss.qualcomm.com>
From: Arun Iyengar <aiyengar1990(a)gmail.com>
optee_supp_thrd_req() checks supp->ctx without supp->mutex. If the
supplicant is released between the check and queueing, a supp_nowait
request is queued after optee_supp_release() aborted the queue and
waits until a new supplicant opens. For in-kernel clients that can
be forever.
Do the check under supp->mutex, together with queueing the request.
Fixes: 42bf4152d8a7 ("tee: add supp_nowait flag in tee_context struct")
Cc: stable(a)vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990(a)gmail.com>
---
Found by Sashiko in its review of [1]; the race is older than that patch.
Tested on an Orange Pi 5 (7.3-based, KASAN and lockdep) with a test-only
2 ms delay between the check and queueing; 1242 of 2000 supp_nowait
requests stranded without this patch, none with it. A real
tee-supplicant was not tested.
Developed with Claude (Anthropic), which wrote the code and the commit
message. I reviewed it.
[1] https://lore.kernel.org/r/20261115-optee-supp-close-v1-1-4e0b14f3a97c@gmail…
---
drivers/tee/optee/supp.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c
index 06747e90c230..fd8d1f363f2f 100644
--- a/drivers/tee/optee/supp.c
+++ b/drivers/tee/optee/supp.c
@@ -91,13 +91,6 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
struct optee_supp_req *req;
u32 ret;
- /*
- * Return in case there is no supplicant available and
- * non-blocking request.
- */
- if (!supp->ctx && ctx->supp_nowait)
- return TEEC_ERROR_COMMUNICATION;
-
req = kzalloc_obj(*req);
if (!req)
return TEEC_ERROR_OUT_OF_MEMORY;
@@ -109,6 +102,16 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
/* Insert the request in the request list */
mutex_lock(&supp->mutex);
+ /*
+ * Return in case there is no supplicant available and
+ * non-blocking request.
+ */
+ if (!supp->ctx && ctx->supp_nowait) {
+ mutex_unlock(&supp->mutex);
+ kfree(req);
+ return TEEC_ERROR_COMMUNICATION;
+ }
+
req->id = idr_alloc(&supp->idr, req, 1, 0, GFP_KERNEL);
if (req->id < 0) {
mutex_unlock(&supp->mutex);
---
base-commit: e21989d08e0d6abacfff71387d0cb36dd96a4079
change-id: 20261119-optee-supp-toctou-da2c5f097e31
Best regards,
--
Arun Iyengar <aiyengar1990(a)gmail.com>
This RFC proposes a key type, "keycrypt", whose material user space can
use for symmetric operations but never read: AES-256-CBC, HMAC-SHA256
and an authenticated AES-256-GCM stream, through a file descriptor that
KEYCTL_CRYPT_OPEN returns for one key and one operation. The key is held
by a backend: the kernel itself (sealed under a trusted key), an OP-TEE
trusted application, or, as a proposal only, the CAAM. I am asking
whether this is a direction the keyrings, crypto and TEE maintainers
would take, before polishing it further.
Patch 9, the authenticated stream, is a proposal on its own and not
needed by the rest of the series: it is a construction of keycrypt's
own, and patches 1-8 do not depend on it, so it can be discussed, or
left out, apart from them. No user-space consumer uses the stream or
HMAC-SHA256 yet: craf (below) uses CBC only. If this direction is found
acceptable, one of the next steps is to bring craf's keycrypt backend
into craf's main line, with the stream and HMAC-SHA256, as long as
doing so does not stand in the way of this RFC or of the series I hope
will follow it.
The problem
-----------
An embedded product that encrypts its own data (a root filesystem
archive, configuration backups, logs) needs a key that does not sit in
the root filesystem and that a compromised user space cannot copy. Today
user space either reads the key (a user or logon key handed to AF_ALG)
or cannot use it at all (a trusted key serves kernel consumers only).
AF_ALG, the one interface that let user space drive a key the kernel
held, has moved away from that use: v7.2 dropped off-CPU cryptography
from it (7524070f26d8, "crypto: af_alg - Drop support for off-CPU
cryptography"), whose message says "If using an off-CPU accelerator
really does turn out to be a win, a new API should be developed that is
actually a good fit for it", and v7.3 restricted it to allowlisted
generic algorithms by default (2f204fe718f5, the af_alg_restrict
sysctl). One exception was let back in, cbc(paes) with a CAAM blob in
place of the key, because "this crypto operation cannot be implemented
in a userspace library" (285d8204638c, v7.2), for privileged users only
(d9506e82ced5, v7.3): the need is acknowledged, for one driver and
one mode. keycrypt is meant to be the API that 7524070f26d8 asks for,
for keys that stay in a TEE or in hardware, whatever the backend.
The interface
-------------
1. A key type, "keycrypt", created with add_key() from "new <alg>
<purposes> [tier=|min-tier=] [backend=]", "load <blob>
[accepted-min-tier=] [purpose=]" or, when allowed, "import <alg>
<purposes> [tier=|min-tier=] [backend=] <hex>". User space states the
protection a key needs, as a tier, and the kernel chooses the backend
that provides it, unless backend= names one. backend= is a constraint
added to the tier, never one in its place: a named backend that does
not meet tier= or min-tier= gives ENODEV, not a weaker key. It is for
a system with more than one backend, an i.MX8 with both the CAAM and
OP-TEE say, where a program must choose which mechanism holds a key
(the cost of each call, what the key is bound to) and not only how
well; the name chooses among mechanisms that meet the tier asked for,
it never lowers a tier asked for (without one, it takes that backend
at the tier it declares, so a program that needs a tier states it).
Its payload read back is a blob that only that backend can open; the
material itself never reaches user space.
2. Each key is bound, when it is made, to one algorithm and to the
purposes it may serve, checked at every open:
a. encrypt and decrypt, for aes256-cbc and aes256-gcm-stream keys:
a key that may only encrypt lets a device write data it cannot
read back, a key that may only decrypt the reverse;
b. mac and verify, for hmac-sha256 keys: "mac" computes a tag over
data, "verify" only checks a tag given by the caller, so a
component holding a verify-only key can authenticate data (a
configuration, an update) but cannot produce a tag that would
pass. VERIFY takes the expected tag at FINAL and answers 0 or
EBADMSG; the tag it computed never leaves the backend. For
example, a server authenticates the commands it sends to a fleet
of devices with HMAC-SHA256, and every device holds the same key,
imported at the factory as verify-only. With a plain HMAC key,
root on one device could extract it and forge commands for the
whole fleet; with a verify-only keycrypt key held by a tee or hsm
backend, a compromised device can still check commands but can
neither read the key nor compute a tag that passes. It comes
close to what a signature gives (everyone verifies, only the
server signs), with a MAC, as long as no device's TEE or HSM is
broken: the key is the fleet's, so the device that breaks forges
for all of it, which a signature would not allow.
3. KEYCTL_CRYPT_OPEN (keyctl 33) opens an operation context on a key and
returns an fd; ioctls on it: KEYCRYPT_IOC_UPDATE, KEYCRYPT_IOC_FINAL,
KEYCRYPT_IOC_SEGMENT (the GCM stream, patch 9) and KEYCRYPT_IOC_INFO,
which tells a program holding only the fd (passed by SCM_RIGHTS, say)
the operation, the minimum tier it was opened with, and the
algorithm, purposes, tier, origin and backend of the key it is using.
Search permission on the key is the right to open it; the caller may
name the lowest tier it accepts (accepted_min_tier), and a key below
it is refused.
4. Policies: kernel.keys.keycrypt_system_tier and
kernel.keys.keycrypt_import (also the boot parameters
keycrypt.system_tier= and keycrypt.import=), one-way, so that a
system can refuse the use of low-tier keys or clear-key import for
good. The system tier is a floor on use only: keys below it can
still be made and loaded, but KEYCTL_CRYPT_OPEN refuses them. Its
starting value is chosen at build time
(CONFIG_KEYCRYPT_SYSTEM_TIER_*), so a signed kernel image carries a
floor its command line cannot lower; likewise, a kernel built
without CONFIG_KEYCRYPT_IMPORT refuses import whatever its command
line or sysctl say.
5. EOPNOTSUPP from KEYCTL_CRYPT_OPEN means "not a keycrypt key", or a
kernel without keycrypt, so a library may fall back to another
interface on it; ENODEV means no backend can run the key.
Tiers and what a compromised kernel can do
------------------------------------------
Each backend declares a tier, and the open path checks it against the
system tier and the caller's accepted minimum:
tier key in clear purpose enforced by who may use the key
in the kernel
kernel yes the kernel the kernel
engine no the kernel the kernel
tee no the TA the kernel
hsm no the HSM the kernel
The last column is the limit of the mechanism: a compromised kernel can
use a tee or hsm key for the purposes it already has, but cannot extract
it or change its purpose. Documentation/security/keys/keycrypt.rst,
"Backend requirements", is the contract a tee or hsm backend must meet.
1. kernel: the keys are in clear in kernel memory while loaded. It is
there so that the same interface works on a system with no TEE and
no suitable hardware, where it still keeps the key out of user space
and out of the root filesystem; its one backend, sw, is off by
default (CONFIG_KEYCRYPT_SW), and a system that has one of the
other tiers should use it, engine at least, and raise the system
tier accordingly. Raising it stops the use of kernel-tier keys, not
their presence: one created or loaded below it is in clear all the
same, as its trusted master is, so a system that must have none
builds without CONFIG_KEYCRYPT_SW.
2. engine: a crypto engine the kernel drives keeps the key, never in
clear in the kernel, but its use is decided by the kernel only. It
comes in patch 6, on its own, so that patches 1-5 stand without a
tier no backend of theirs declares. The CAAM backend of this series
is an engine, since the CAAM does not check what a key is used for;
an ELE backend (below) would start as an engine too, and could move
to hsm once the firmware is confirmed to enforce a key's purpose. If
more such shades appear, a separate property may fit better than
more tiers, and I would welcome an opinion.
3. tee: the OP-TEE backend; the TA re-checks every operation against
the purposes it bound when the key was sealed.
4. hsm: as tee, in dedicated hardware apart from the CPU running the
kernel (a secure element, a security core of its own such as NXP's
EdgeLock Enclave, a crypto engine with its own policy), the place of
Android KeyMint's StrongBox; no backend in this series.
The backends
------------
1. sw, of the kernel tier (no name is both a tier's and a backend's):
keys sealed with AES-256-GCM under a key derived with HMAC-SHA256
from a trusted key (any trusted-key source); HKDF-derived stream
subkeys; lib/crypto AES. Where the trusted key
comes from a TPM, the TPM only unseals that master when a key is
loaded; the data itself is ciphered on the CPU, never by the TPM.
2. OP-TEE: a trusted application, an early TA, REE kernel login only;
it derives its sealing key from OP-TEE's hardware-unique-key
service. The TA is written (ta/keycrypt, one patch to optee_os) and
is the one that ran on the hardware below, but I have not proposed
it to OP-TEE yet: I would first like to know whether this direction
can go on. I can publish it for anyone who wants to try it and is
willing to support the work.
3. CAAM: patches 7 and 8, a proposal and not to be applied as they
are.
They are based on Richard Weinberger's "crypto: caam" series v1 (see
"Base and prerequisites") and never ran on a CAAM. Questions for the
CAAM maintainers:
a. is an internal cbc(paes) taking the caller's key modifier an
acceptable form;
b. can a job generate a key in the CAAM and keep it black without it
crossing kernel memory;
c. can the use of a key be checked by something a compromised kernel
does not drive: trusted descriptors, which would let the CAAM
itself enforce a key's purpose and make the backend hsm, or a job
ring owned by the secure world, which would make it tee;
d. could cbc(paes) take CCM black keys, which are authenticated where
ECB ones are not, once the driver handles their extra length
(Weinberger's series refuses them, so the backend uses ECB).
4. ELE (i.MX9), not in this series: this is an RFC, and I am not an
expert of the enclave, so I would rather know first what NXP thinks
of it, and whether they would be willing to propose an ELE backend
themselves, as an engine or, better, as an hsm. As far as I can see,
the se_if driver in linux-next gives user space a misc device with a
generic send-and-receive ioctl for the enclave's messages, and offers
nothing to other kernel code. A per-operation in-kernel API exported
by that driver (open a key store reserved to the kernel, generate a
key, import a wrapped one, read a key's attributes, delete it,
AES-CBC and MAC in one call) would let a keycrypt backend use the
enclave. Questions for NXP:
a. does the firmware enforce a key's key_usage and permitted_algo on
every operation, min_mac_length when verifying, and never release
a generated key in clear (yes to all three would make the backend
hsm rather than engine);
b. could a key be exported wrapped under a device-unique key and
imported again, so that a keycrypt blob holds the key itself
rather than a reference to the enclave's key store;
c. is the key that wraps an imported key unique per device;
d. the user-space library has a streaming MAC (hsm_mac() with its
INIT, UPDATE_DATA and FINALIZE flags): would the firmware offer
it to the kernel for a key in its key store;
e. can a key_id be reused after a key is deleted (the library's
documentation does not say);
f. would a per-operation API of this kind answer the objection Arnd
Bergmann raised to the generic passthrough
(<2034fb2f-f169-46a5-85e8-fa723ddb0360(a)app.fastmail.com>).
Base and prerequisites
----------------------
The series is based on mainline v7.4-rc2-92 (067c5c24cef2). Patches
1-6, and patch 9 on top of them, apply on it alone. Patches 7 and 8, the
CAAM proposal, need Richard
Weinberger's "crypto: caam" series v1
(<20260726081504.2182951-1-richard(a)nod.at>, three patches, listed as
prerequisites below) applied first, for example with:
b4 am -o - 20260726081504.2182951-1-richard(a)nod.at | git am
Testing
-------
The series comes without its tests. There are KUnit suites for the
core and the sw, OP-TEE and CAAM backends, and a kselftest for the user
ABI, with a case for every reachable row of keycrypt.rst's error
tables; together they are larger than the code they test, so I am
keeping them for the non-RFC series, once the direction is agreed. The
results below that name them come from the series with the tests in it.
Taking them out removed only the tests and the hooks that let them
reach the code's internals (static functions made visible and exported
to KUnit modules): with CONFIG_KUNIT off, the posted patches build for
arm64 to the same instructions as that series.
On that base, with Weinberger's three patches applied: built for arm64
with W=1 (security/keys/keycrypt/ and drivers/crypto/caam/, no
warning), and, with the tests on top, the KUnit suites pass on UML
but for the one case that needs the system tier above kernel (by
Kconfig or boot parameter). Patches 1-6 and 9 alone, on the base without
Weinberger's patches: the same build of security/keys/keycrypt/, no
warning.
The runs below were made on that series at v7.3 on QEMU, and, without
the CAAM code, backported to NXP's 6.18, on QEMU and on hardware:
1. QEMU (qemuarm64-secureboot, OP-TEE 4.9.0, an fTPM as the source of
the trusted master): the KUnit suites and the kselftest passed on
the sw and OP-TEE backends, a case skipped only where its backend
was absent (the CAAM) or where it needs a one-way policy setting;
the TA's unbind and bind; persistence of a blob across a restart.
QEMU proves function, not secrecy: its hardware unique key is a stub.
2. Hardware: the series, backported to NXP's linux-imx lf-6.18.2-1.0.0
(six upstream prerequisites; the two CAAM patches left out), with the
TA built as an early TA into NXP's imx-optee-os 4.8.0, ran on an
i.MX93 board with secure boot closed (AHAB), where OP-TEE derives the
key that seals the TA's key blobs from the EdgeLock Enclave's
hardware unique key. The KUnit suites and the kselftest passed on
the OP-TEE backend, a case skipped only where its backend was absent
(sw, which 6.18 cannot build for lack of the library AES it needs,
and the CAAM, left out) or where it needs a one-way policy setting.
A key generated in OP-TEE and kept as its blob
was loaded back after a reboot and after a full power-off, and
decrypted a file encrypted before them. The same AES-256-CBC key and
IV through AF_ALG (cbc-aes-ce), through keycrypt and through openssl
gave identical ciphertexts.
3. Cost on that board (Cortex-A55), AES-256-CBC, per call on an open
context: keycrypt with the OP-TEE backend 59-62us up to 256 bytes,
~106us at 4KiB, 880-930us at 64KiB (67-71MiB/s); AF_ALG cbc-aes-ce
6-7, 12-14 and 110-138us (454-570MiB/s). Opening a context costs
~500us, against ~9us for an AF_ALG accept on a keyed socket (~25us
for the whole AF_ALG setup). OP-TEE's own benchmark (xtest
--aes-perf, from user space through libteec) on the same board gives
~64us per call plus ~1.5ns per byte. keycrypt's fixed cost matches
that round trip to the secure world; its remaining ~11ns per byte is
spent in this prototype's own data path (buffer allocation and
copies between user space, kernel, shared memory and the TA); which
part dominates is not yet measured, and it is to be reduced.
A user-space consumer exists: craf, the archive tool of crypto-afalg,
has a keycrypt backend on the keycrypt branch of
https://github.com/giometti/crypto-afalg (tag keycrypt-board-5 is the
version that ran on the hardware above). Its enc command, an openssl
enc that takes its key from the keyring, shows what a keycrypt key
carries. A key made once as
k=$(keyctl add keycrypt demo \
"new aes256-cbc encrypt,decrypt min-tier=tee" @u)
is bound there to AES-256-CBC, to encrypting and decrypting, and to a
backend of tier tee at least, chosen by the kernel; so
craf enc -enc-key $k -iv <hex> < plain > cipher
craf enc -d -enc-key $k -iv <hex> < cipher > plain
need nothing else: the open takes no algorithm and no backend, the key
brings them, and its tier is enforced by the kernel against
-enc-min-tier or the system's tier. Any other key goes to AF_ALG, and
the command line must name the cipher. On the board, craf enc with an
imported keycrypt key and openssl enc with the same key bytes and IV
each decrypted what the other encrypted.
While testing the user-space side of this series, craf's test suite hit
the KEYCTL_PKEY_VERIFY regression of cb481e59ea6c, which lets a short
RSA signature verify: it is fixed by Florian Bauckholt's patch [1], and
the reproducer was reported in [2].
[1] https://lore.kernel.org/keyrings/20261111-keyctl-pkey-fixes-v1-1-934ebaa267…
[2] https://lore.kernel.org/all/0e20f799-e389-40d2-aaee-2f174748faae@enneenne.c…
Why not AF_ALG or KEYCTL_PKEY_*
-------------------------------
They are the two existing interfaces through which user space uses a
key it does not read, so they are the first alternatives a reviewer
will name; keycrypt.rst has a section on them.
1. AF_ALG takes a trusted key by serial (ALG_SET_KEY_BY_KEY_SERIAL),
but copies its payload into the socket, ties it to no algorithm and
no purpose, and runs it on whatever implementation the socket is
bound to, since v7.2 only on the CPU but for cbc(paes); extending it
would mean adding purposes, tiers and off-CPU backends to what it
has just removed.
2. KEYCTL_PKEY_* already lets user space use a key without reading it,
but for asymmetric keys, one operation per call; a symmetric mode
needs state across calls (the CBC chain, the stream's segments),
which an fd holds naturally.
Whether one of them should be extended instead is the first question I
would like answered.
Known limits
------------
Some are limits of the design, kept on purpose:
1. Only the sw backend is self-contained in the tree; every guarantee
against a compromised kernel is a requirement on the other backends,
which "Backend requirements" in keycrypt.rst sets out.
2. Kernel-tier keys are in clear in kernel memory while loaded: that
tier is there for systems with nothing better, and a system that has
more can refuse it (above).
3. The tier is declared by the backend, not proven: the kernel cannot
check what a TEE or a piece of hardware does, so it records and
enforces what the backend declares.
4. A blob is a bearer credential, and a process that possesses a key
can read its blob: what binds the key is the backend's secret,
unique to the device, and the purposes sealed with it, not the blob.
5. CBC is unauthenticated and is a raw AES oracle for its holder: it is
there for the formats that need it, and the GCM stream is the
authenticated choice. The stream is not key-committing, which a
format trying several keys must handle (keycrypt.rst says how), and
is bounded at 2^32-1 segments, 256TiB at 64KiB each.
The others I plan to address if this direction is taken:
6. Checks happen at open only, so an open context survives a raised
policy or removed Search (revocation closes it): raising a policy
would close the contexts it no longer allows, as revocation does.
Whether Search should be the use permission is among the points
below.
7. import moves a clear key through kernel memory: an encrypted import,
wrapped for the backend, would avoid it. Policies are global: they
could follow namespaces, if that is wanted, and stay one-way.
8. The GCM stream has no seek: decryption could start at a given
segment (keycrypt.rst leaves room for it in the open parameters);
encryption never will, so that no counter is used twice.
9. OP-TEE backend: its control session is not reopened after a TA
panic, the TA's session limit is a build constant, and every context
has shared buffers of its own: the session would be reopened, the
limit made configurable, and the buffers taken from a pool, as part
of the work on the per-byte cost above.
10. No keyutils or man-page support yet: to be added.
Other points I would like opinions on:
1. two KDFs and a stream construction living in security/keys rather
than reusable primitives;
2. Search as the use permission;
3. an rwsem held across sleeping backend calls;
4. whether a KEYCTL_CAPS1_* bit telling a process once that keycrypt
is there would help (not in this series).
Not in this RFC: signatures, ECDH, encrypted import, io_uring, other
modes; ELE code; external secure elements as backends.
How this series was made
------------------------
This work comes from a project to strengthen the secure-boot chain of
embedded Linux systems.
I used an AI coding assistant, Anthropic's Claude (claude-opus-5-5 in
Claude Code), in the sense of
Documentation/process/coding-assistants.rst. However, the way the
problem is solved is mine: a new key type, so that user space can go on
using keys it never reads while AF_ALG drops off-CPU cryptography and
restricts what it allows, built on backends that hold the key and on
tiers that say what a backend protects against, the engine one
included. I directed the design and took its decisions, choosing among
the options the assistant set out or bringing my own. The assistant
surveyed the prior art, set out the design options with a
recommendation at each step, and wrote the code, the KUnit tests, the
selftests (not posted, see Testing) and the documentation under my
direction, in plans I approved, partly through lower-tier Claude models
it dispatched for individual tasks; each plan was followed by an AI
review that I read.
Claude also built and ran the QEMU bench and analysed the hardware run,
which another Claude session carried out with me at the board.
I have reviewed every patch and I am responsible for all of it.
Rodolfo Giometti
Rodolfo Giometti (9):
KEYS: keycrypt: Add a key type for keys user space never reads
KEYS: keycrypt: Add the sw backend
KEYS: keycrypt: Add the OP-TEE backend
docs: keycrypt: document keycrypt keys
MAINTAINERS: add KEYS-KEYCRYPT
KEYS: keycrypt: Add the engine tier
crypto: caam - add an internal cbc(paes) taking the blob's key
modifier
KEYS: keycrypt: Add the CAAM backend
KEYS: keycrypt: Add the aes256-gcm-stream algorithm
.../admin-guide/kernel-parameters.txt | 20 +
Documentation/security/keys/index.rst | 1 +
Documentation/security/keys/keycrypt.rst | 1105 +++++++++++++++++
.../userspace-api/ioctl/ioctl-number.rst | 2 +
MAINTAINERS | 18 +
drivers/crypto/caam/caamalg.c | 89 +-
drivers/crypto/caam/caamalg_desc.c | 3 +-
drivers/crypto/caam/caamalg_desc.h | 1 +
include/keys/keycrypt.h | 161 +++
include/soc/fsl/caam-blob.h | 8 +
include/uapi/linux/keycrypt.h | 182 +++
include/uapi/linux/keyctl.h | 1 +
security/keys/Kconfig | 2 +
security/keys/Makefile | 1 +
security/keys/compat.c | 3 +
security/keys/internal.h | 12 +
security/keys/keycrypt/Kconfig | 153 +++
security/keys/keycrypt/Makefile | 9 +
security/keys/keycrypt/caam.c | 346 ++++++
security/keys/keycrypt/caam.h | 30 +
security/keys/keycrypt/core.c | 1077 ++++++++++++++++
security/keys/keycrypt/ctx.c | 667 ++++++++++
security/keys/keycrypt/keycrypt.h | 180 +++
security/keys/keycrypt/optee.c | 489 ++++++++
security/keys/keycrypt/optee.h | 39 +
security/keys/keycrypt/sw.c | 468 +++++++
security/keys/keycrypt/sw.h | 30 +
security/keys/keyctl.c | 5 +
28 files changed, 5090 insertions(+), 12 deletions(-)
create mode 100644 Documentation/security/keys/keycrypt.rst
create mode 100644 include/keys/keycrypt.h
create mode 100644 include/uapi/linux/keycrypt.h
create mode 100644 security/keys/keycrypt/Kconfig
create mode 100644 security/keys/keycrypt/Makefile
create mode 100644 security/keys/keycrypt/caam.c
create mode 100644 security/keys/keycrypt/caam.h
create mode 100644 security/keys/keycrypt/core.c
create mode 100644 security/keys/keycrypt/ctx.c
create mode 100644 security/keys/keycrypt/keycrypt.h
create mode 100644 security/keys/keycrypt/optee.c
create mode 100644 security/keys/keycrypt/optee.h
create mode 100644 security/keys/keycrypt/sw.c
create mode 100644 security/keys/keycrypt/sw.h
base-commit: 067c5c24cef23d913b67eaaf71ae67e7169a6620
prerequisite-patch-id: 6f1c5a861378c58d6adea4e1745794466a9d73d6
prerequisite-patch-id: e1565dff5540351c42ee04e0308649a6d97e9e09
prerequisite-patch-id: 37ed62269bd4b1fcaeeab38f5feb5b0f63608459
--
2.43.0
Shared-memory allocator services (e.g., Android's gralloc)
allocate dma-bufs on behalf of client processes in different
cgroups. Today those allocations are charged to the allocator's
own cgroup, leaving client cgroups with no visibility into their
actual memory consumption and defeating resource limits.
This series adds memory cgroup accounting for dma-buf allocations,
building on T.J. Mercier's earlier series [1] and incorporating
feedback from previous versions and LPC discussions [2].
Patch 1 introduces the MEMCG_DMABUF stat and the
obj_cgroup_reserve_dmabuf()/obj_cgroup_cancel_dmabuf() and
mem_cgroup_commit_dmabuf()/mem_cgroup_uncharge_dmabuf() helpers
in mm/memcontrol.c
Patch 2 wires up the charging policy: dma_buf_export() stores
exp_info.objcg and updates the stat, a new charge_fd field in
DMA_HEAP_IOCTL_ALLOC accepts a pidfd or cgroupfd to identify
the target cgroup, and __GFP_ACCOUNT is removed from system-heap
allocations to avoid double counting.
Patch 3 adds DMA_BUF_IOCTL_XFER_CHARGE, a general ioctl on any
dma-buf fd to transfer charges post-allocation. This covers the
double-hop allocator case (SurfaceFlinger -> gralloc -> kernel)
and works for buffers from any exporter that opts in. Charging
is gated by dmabuf->objcg being set at export time, ensuring that
transfer is only applied for buffers backed by system memory where
size reflects actual bytes. If the receiving cgroup lacks capacity
for the charge, the ioctl returns -ENOMEM and the original charge
is preserved.
Patches 4-7 add access control for cross-cgroup charging. Letting
userspace decide who to charge needs to be a privileged operation
because it has material impact on OOM decision and resource limits.
Charging outside the caller's own memcg subtree requires
CAP_SYS_RESOURCE. On top of that, LSM hooks gate the two charge_fd
flavours: security_memcg_charge_task() gates the pidfd path (target
identified by task credentials) and security_memcg_charge_cgroup()
gates the cgroupfd path (target identified by cgroup directory label),
with SELinux implementations using process2:charge_to and
cgroup:charge_to permissions.
Patch 8 adds selftests. The tests and vmtest script were mostly
written by an LLM, closely following the style of the surrounding
tests and the virtme-ng setup. All code has been reviewed and tested.
Known limitations:
- Single-owner model: a dma-buf carries one memcg charge regardless
of how many processes share it.
- Only memcg accounting. CMA heaps would additionally need dmem
controller integration.
- If a transfer of an uncharged buffer fails, the buffer remains
charged to the original cgroup. The allocator (userspace) is
expected to handle this (retry, free, ...).
- The LSM hooks are intentionally narrow. Broader cgroup access controls
(e.g. for the memfd/kexec handover case [2]) could be a separate effort
reusing the same pattern.
- Only system heap sets exp_info.objcg today. Other exporters
(DRM, V4L2, etc.) can opt in by setting it, but are not
covered by this series.
- Related to the above: lazy backing-store allocation is not supported.
This can be extended later, e.g., by adding a flag on the dma-buf
struct for explicitly marking when memory is committed.
Note on TTM/GPU accounting [3]: that effort charges system memory
allocated for GPU buffers per page, with its own stats (gpu_active
and gpu_reclaim). This series charges at the dma-buf level, for
memory with no memory.stat category of its own; exporters whose
memory is already charged by their allocator must not opt in, so
the two do not overlap.
[1] https://lore.kernel.org/cgroups/20230109213809.418135-1-tjmercier@google.co…
[2] https://lpc.events/event/20/contributions/2416/
[3] https://lore.kernel.org/all/20260706052330.1110909-1-airlied@gmail.com/
Signed-off-by: Albert Esteve <aesteve(a)redhat.com>
---
Changes in v5:
- Reject dma-buf reservations above INT_MAX pages to avoid
nr_pages truncation (Sashiko)
- Require CAP_SYS_RESOURCE for charge requests targeting outside
caller's own memcg subtree (Sashiko)
- Hold an obj_cgroup instead of a memcg in the dma-buf struct (Thomas Hellström)
- Restore mem_cgroup_commit_dmabuf() so dma_buf_export() does not
reach into memcg stat internals
- Resolve the cgroup and run the LSM check against the same file
in get_obj_cgroup_from_fd()
- The cgroupfd hook now takes the file and checks the inode SID,
so genfscon-labeled cgroups are covered
- Rename the LSM hooks to security_memcg_charge_{task,cgroup}()
- Replace dma_buf object class in SELinux with process2:charge_to
and cgroup:charge_to
- Link to v4: https://lore.kernel.org/r/20261104-v2_20230123_tjmercier_google_com-v4-0-18…
Changes in v4:
- Remove memcg_account flag; exp_info.memcg != NULL is the opt-in
- Centralize memcg bookkeeping in dma_buf_export()
- Drop mem_cgroup_commit_dmabuf()
- Make mem_cgroup_transfer_charge() generic (not dma-buf specific)
- Add EXPORT_SYMBOL_GPL for reserve/cancel (system_heap is tristate)
- Reorder: move xfer ioctl before LSM patches
- Serialize dmabuf->memcg updates with the dma-buf resv lock instead of cmpxchg
- Link to v3: https://lore.kernel.org/r/20261027-v2_20230123_tjmercier_google_com-v3-0-78…
Changes in v3:
- Split mem_cgroup_charge_dmabuf() into reserve/commit/cancel three-phase API
- Extract mem_cgroup_get_from_fd() helper shared by allocate and xfer paths
- Rename __padding to flags in struct dma_buf_transfer_charge
- Fix UAF race: move mod_memcg_state() before cmpxchg in transfer
- Add memcg_account opt-in flag; xfer returns -EOPNOTSUPP if unset
- Wrap dma_buf_charge_cgroup hook in #ifdef CONFIG_CGROUPS
- Fix TOCTOU in SELinux charge_cgroup xattr length handling
- Link to v2: https://lore.kernel.org/r/20261021-v2_20230123_tjmercier_google_com-v2-0-ef…
Changes in v2:
- Move charge_pid_fd to charge_fd, accepting cgroupfd in addition
to pidfd per Christian König.
- New DMA_BUF_IOCTL_XFER_CHARGE ioctl for post-allocation charge
transfer on any dma-buf, not just dma-heap buffers per Christian König
and T.J. Mercier.
- Moved __GFP_ACCOUNT removal to patch 1 per Barry Song.
- dma-buf charge/uncharge helpers take struct dma_buf * directly
to avoid the need for caller to manage size calculations.
- Added test_xfer_charge_cgroupfd_self to dmabuf-heap selftests.
- Added LSM and SELinux hooks for cgroupfd-based charging.
- Rebased to v7.3-rc7.
- Link to v1: https://lore.kernel.org/r/20260512-v2_20230123_tjmercier_google_com-v1-0-63…
---
Albert Esteve (7):
dma-heap: charge dma-buf memory via explicit memcg
dma-buf: transfer objcg charges via DMA_BUF_IOCTL_XFER_CHARGE
lsm: Add memcg_charge_task LSM hook
lsm: Add memcg_charge_cgroup LSM hook
selinux: Restrict cross-cgroup memcg charging
selinux: Restrict memcg charging to a cgroupfd target
selftests/dmabuf-heaps: Add dma-buf memcg accounting tests
T.J. Mercier (1):
memcg: Add MEMCG_DMABUF accounting infrastructure
Documentation/admin-guide/cgroup-v2.rst | 6 +
drivers/dma-buf/dma-buf.c | 45 +++
drivers/dma-buf/dma-heap.c | 27 +-
drivers/dma-buf/heaps/cma_heap.c | 3 +-
drivers/dma-buf/heaps/system_heap.c | 19 +-
drivers/tee/tee_heap.c | 3 +-
include/linux/dma-buf.h | 10 +
include/linux/dma-heap.h | 4 +-
include/linux/lsm_hook_defs.h | 2 +
include/linux/memcontrol.h | 56 +++
include/linux/security.h | 15 +
include/uapi/linux/dma-buf.h | 26 ++
include/uapi/linux/dma-heap.h | 7 +
mm/memcontrol.c | 271 +++++++++++++
security/security.c | 35 ++
security/selinux/hooks.c | 17 +
security/selinux/include/classmap.h | 3 +-
tools/testing/selftests/cgroup/Makefile | 2 +-
tools/testing/selftests/cgroup/test_memcontrol.c | 447 ++++++++++++++++++++-
tools/testing/selftests/dmabuf-heaps/config | 1 +
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 237 ++++++++++-
tools/testing/selftests/dmabuf-heaps/vmtest.sh | 226 +++++++++++
22 files changed, 1446 insertions(+), 16 deletions(-)
---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20260508-v2_20230123_tjmercier_google_com-f44fcfb16530
Best regards,
--
Albert Esteve <aesteve(a)redhat.com>
Hi Eric,
On 14-11-2026 03:26 am, Eric Biggers wrote:
> On Wed, Nov 11, 2026 at 07:47:04PM +0530, Harshal Dev wrote:
>> module_tee_client_driver(qcom_ice_tee_driver);
> [...]
>> +module_platform_driver(qcom_ice_plat_driver);
>
> So is this a tee_client_driver or is it a platform_driver? It can't be
> both.
>
> This patch feels like a workaround for issues that could be solved by
> folding this driver's functionality into the existing qcom_ice driver.
> Is there any reason why qcom_ice shouldn't just make the OP-TEE calls
> directly?
>
So this is an attempt at solving the problem I described in the commit
message of patch 4/6. Basically, if the ICE driver is built and probed, it
needs to know that:
1. A TZ is available on the Qualcomm platform. (qcom_scm_is_available)
2. Whether the TZ supports an ICE secure service. (qcom_scm_ice_is_available)
With OP-TEE, there is no way actively check via an API for 1 and 2. Instead
the TEE client driver model probes a driver only if the secure service is
supported by OP-TEE. Which means that you only get notified of the presence of
the secure service, not of its absence.
So currently if you boot with OP-TEE and register a back-end ICE TEE client
driver, and the OP-TEE build doesn't support a secure ICE service, the ICE
driver calling a corresponding qcom_tee_is_available() API on the back-end
driver would forever defer probe.
I suggested another approach for this on a reply on commit 4, where we register
the back-end OPTEE device on the TEE bus once it has registered all its secure
services on the TEE bus, and then the ICE TEE client driver can be probed
when that happens, and subsequently attempt a tee_client_open_session() call
to the ICE secure service, failing which it would have concrete knowledge
that the current OP-TEE build doesn't support the ICE service and so we
can continue storage initialization without inline encryption support.
At the core of it, we have two device-tree probed independent drivers, ICE
and OPTEE that need to talk to each other the way ICE and SCM drivers do.
The right approach here needs debate and alignment.
Regards,
Harshal
> - Eric
Hi,
Building the UUID/GUID id RFC (uid_r v2,
<cover.1792552161.git.jan.koester(a)tuxist.de>) with a distribution
config instead of the one I had tested with turned up three users of
kuid_t/kgid_t it doesn't build with: kuid_t is a tagged union now and
has no .val, and it no longer fits READ_ONCE()/WRITE_ONCE().
1/3 tun: TUNSETOWNER/TUNSETGROUP write the owner and group under RTNL,
tun_fill_info() may read them without it. Mark that read as
data_race() instead of READ_ONCE(). Only classic ids from
make_kuid()/make_kgid() are ever stored there.
2/3 accel/ivpu: the per-user context limits are keyed by
__kuid_val(). UUID and GUID users share the (uid_t)-1 bucket, which
only makes the limit stricter for them.
3/3 tee: the TEE_IOCTL_LOGIN_USER client UUID is derived from the
classic uid. With __kuid_val() alone every UUID or GUID user would
get the same one and could act as any other such user towards the
TEE, so those logins are refused with -EPERM, like ublk refuses
unprivileged devices to them in the series.
These belong into the series before the patch that lets kuid_t and
kgid_t hold a UUID or a GUID and will be folded in there in v3; I'm sending
them now so that the reviewers of these drivers see what uid_r means
for them.
Jan Koester (3):
tun: read the owner and group without READ_ONCE()
accel/ivpu: key user limits by __kuid_val()
tee: refuse user logins of UUID and GUID users
drivers/accel/ivpu/ivpu_drv.c | 2 +-
drivers/net/tun.c | 8 ++++----
drivers/tee/tee_core.c | 13 +++++++++++--
3 files changed, 16 insertions(+), 7 deletions(-)
--
2.53.0
Shared-memory allocator services (e.g., Android's gralloc)
allocate dma-bufs on behalf of client processes in different
cgroups. Today those allocations are charged to the allocator's
own cgroup, leaving client cgroups with no visibility into their
actual memory consumption and defeating resource limits.
This series adds memory cgroup accounting for dma-buf allocations,
building on T.J. Mercier's earlier series [1] and incorporating
feedback from previous versions and LPC discussions [2].
Patch 1 introduces the MEMCG_DMABUF stat and reserve/cancel
and uncharge helpers in mm/memcontrol.c
Patch 2 wires up the charging policy: dma_buf_export() stores
exp_info.memcg and updates the stat, a new charge_fd field in
DMA_HEAP_IOCTL_ALLOC accepts a pidfd or cgroupfd to identify
the target cgroup, and __GFP_ACCOUNT is removed from system-heap
allocations to avoid double counting.
Patch 3 adds DMA_BUF_IOCTL_XFER_CHARGE, a general ioctl on any
dma-buf fd to transfer charges post-allocation. This covers the
double-hop allocator case (SurfaceFlinger -> gralloc -> kernel)
and works for buffers from any exporter (DRM, V4L2, etc.). Charging
is gated by dmabuf->memcg being set at export time, ensuring that
transfer is only applied for buffers backed by system memory where
size reflects actual bytes. If the receiving cgroup lacks capacity
for the charge, the ioctl returns -ENOMEM and the original charge
is preserved.
Patches 4-7 add access control for cross-cgroup charging. Letting
userspace decide who to charge needs to be a privileged operation
because it has material impact on OOM decission and resource limits.
We gate it via LSM hooks for the two charge_fd flavours:
security_dma_buf_charge_task() gates the pidfd path (target
identified by task credentials) and security_dma_buf_charge_cgroup()
gates the cgroupfd path (target identified by cgroup directory label),
with SELinux implementations under a dma_buf object class.
Patch 8 adds selftests.
Known limitations:
- Single-owner model: a dma-buf carries one memcg charge regardless
of how many processes share it.
- Only memcg accounting. CMA heaps would additionally need dmem
controller integration.
- If a transfer of an uncharged buffer fails, the buffer remains
charged to the original cgroup. The allocator (userspace) is
expected to handle this (retry, free, ...).
- The LSM hooks are intentionally narrow. Broader cgroup access controls
(e.g. for the memfd/kexec handover case [2]) could be a separate effort
reusing the same pattern.
- Only system heap sets exp_info.memcg today. Other exporters
(DRM, V4L2, etc.) can opt in by setting it, but are not
covered by this series.
- Related to the above: lazy backing-store allocation is not supported.
This can be extended later, e.g., by adding a flag on the dma-buf
struct for explicitly marking when memory is committed.
[1] https://lore.kernel.org/cgroups/20230109213809.418135-1-tjmercier@google.co…
[2] https://lpc.events/event/20/contributions/2416/
Signed-off-by: Albert Esteve <aesteve(a)redhat.com>
---
Changes in v4:
- Remove memcg_account flag; exp_info.memcg != NULL is the opt-in
- Centralize memcg bookkeeping in dma_buf_export()
- Drop mem_cgroup_commit_dmabuf()
- Make mem_cgroup_transfer_charge() generic (not dma-buf specific)
- Add EXPORT_SYMBOL_GPL for reserve/cancel (system_heap is tristate)
- Reorder: move xfer ioctl before LSM patches
- Serialize dmabuf->memcg updates with the dma-buf resv lock instead of cmpxchg
- Link to v3: https://lore.kernel.org/r/20261027-v2_20230123_tjmercier_google_com-v3-0-78…
Changes in v3:
- Split mem_cgroup_charge_dmabuf() into reserve/commit/cancel three-phase API
- Extract mem_cgroup_get_from_fd() helper shared by allocate and xfer paths
- Rename __padding to flags in struct dma_buf_transfer_charge
- Fix UAF race: move mod_memcg_state() before cmpxchg in transfer
- Add memcg_account opt-in flag; xfer returns -EOPNOTSUPP if unset
- Wrap dma_buf_charge_cgroup hook in #ifdef CONFIG_CGROUPS
- Fix TOCTOU in SELinux charge_cgroup xattr length handling
- Link to v2: https://lore.kernel.org/r/20261021-v2_20230123_tjmercier_google_com-v2-0-ef…
Changes in v2:
- Move charge_pid_fd to charge_fd, accepting cgroupfd in addition
to pidfd per Christian König.
- New DMA_BUF_IOCTL_XFER_CHARGE ioctl for post-allocation charge
transfer on any dma-buf, not just dma-heap buffers per Christian König
and T.J. Mercier.
- Moved __GFP_ACCOUNT removal to patch 1 per Barry Song.
- dma-buf charge/uncharge helpers take struct dma_buf * directly
to avoid the need for caller to manage size calculations.
- Added test_xfer_charge_cgroupfd_self to dmabuf-heap selftests.
- Added LSM and SELinux hooks for cgroupfd-based charging.
- Rebased to v7.3-rc7.
- Link to v1: https://lore.kernel.org/r/20260512-v2_20230123_tjmercier_google_com-v1-0-63…
---
Albert Esteve (7):
dma-heap: charge dma-buf memory via explicit memcg
dma-buf: transfer memcg charges via DMA_BUF_IOCTL_XFER_CHARGE
security: dma-buf: Add dma_buf_charge_task LSM hook
security: dma-buf: Add dma_buf_charge_cgroup LSM hook
selinux: Restrict cross-cgroup dma-buf charging
selinux: Restrict dma-buf direct cgroup charging
selftests/dmabuf-heaps: Add dma-buf memcg accounting tests
T.J. Mercier (1):
memcg: Add MEMCG_DMABUF accounting infrastructure
Documentation/admin-guide/cgroup-v2.rst | 5 +
drivers/dma-buf/dma-buf.c | 50 ++++
drivers/dma-buf/dma-heap.c | 28 +-
drivers/dma-buf/heaps/cma_heap.c | 3 +-
drivers/dma-buf/heaps/system_heap.c | 21 +-
drivers/tee/tee_heap.c | 3 +-
include/linux/dma-buf.h | 9 +
include/linux/dma-heap.h | 3 +-
include/linux/lsm_hook_defs.h | 4 +
include/linux/memcontrol.h | 47 ++++
include/linux/security.h | 18 ++
include/uapi/linux/dma-buf.h | 26 ++
include/uapi/linux/dma-heap.h | 7 +
mm/memcontrol.c | 176 +++++++++++++
security/security.c | 34 +++
security/selinux/hooks.c | 44 ++++
security/selinux/include/classmap.h | 1 +
tools/testing/selftests/cgroup/Makefile | 2 +-
tools/testing/selftests/cgroup/test_memcontrol.c | 290 ++++++++++++++++++++-
tools/testing/selftests/dmabuf-heaps/config | 1 +
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 227 +++++++++++++++-
tools/testing/selftests/dmabuf-heaps/vmtest.sh | 226 ++++++++++++++++
22 files changed, 1210 insertions(+), 15 deletions(-)
---
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
change-id: 20260508-v2_20230123_tjmercier_google_com-f44fcfb16530
Best regards,
--
Albert Esteve <aesteve(a)redhat.com>