On Thu, Apr 30, 2020 at 03:37:08PM +0300, Vesa Jääskeläinen wrote:
> TEE Client API defines that from user space only information needed for
> specified login operations is group identifier for group based logins.
>
> REE kernel is expected to formulate trustworthy client UUID and pass that
> to TEE environment. REE kernel is required to verify that provided group
> identifier for group based logins matches calling processes group
> memberships.
>
> TEE specification only defines that the information passed from REE
> environment to TEE environment is encoded into on UUID.
>
> In order to guarantee trustworthiness of client UUID user space is not
> allowed to freely pass client UUID.
>
> Vesa Jääskeläinen (3):
> tee: add support for session's client UUID generation
> tee: optee: Add support for session login client UUID generation
I'm picking up these two patches.
> [RFC] tee: add support for app id for client UUID generation
I'm waiting with this patch until we've reached some conclusion.
Thanks,
Jens
>
> drivers/tee/Kconfig | 1 +
> drivers/tee/optee/call.c | 6 +-
> drivers/tee/tee_core.c | 211 +++++++++++++++++++++++++++++++++++++++
> include/linux/tee_drv.h | 16 +++
> 4 files changed, 233 insertions(+), 1 deletion(-)
>
> --
> 2.17.1
>
> Changes v1->v2:
>
> * Changed goto labels to be more logical
> * Capture error if formatted string for UUIDv5 does not fit into buffer
>
> Notes:
>
> This patcheset has been designed so that it can be iteratively intergrated
> meaning that the application ID (RFC patch) part can be left for later when
> there is agreed solution for that.
>
> TEE specification leaves Linux behavior undefined. It does not define any
> UUID value for name space. UUID in here is randomly generated with uuidgen
> tool.
>
> I have also include amdtee people as this method probably should also be
> applied in there.
>
> Using op-tee(a)lists.trustedfirmware.org instead of tee-dev(a)lists.linaro.org as
> latter is deprecated old list.
>
> Original issue in OP-TEE OS tracker:
> https://github.com/OP-TEE/optee_os/issues/3642
>
> Related reviews and demonstration for the concept:
> https://github.com/linaro-swg/linux/pull/74
> https://github.com/OP-TEE/optee_client/pull/195
> https://github.com/OP-TEE/optee_test/pull/406
Currently {get|pin}_user_pages_fast() have 3 return value 0, -errno
and no of pinned pages. The only case where these two functions will
return 0, is for nr_pages <= 0, which doesn't find a valid use case.
But if at all any, then a -ERRNO will be returned instead of 0, which
means {get|pin}_user_pages_fast() will have 2 return values -errno &
no of pinned pages.
Update all the callers which deals with return value 0 accordingly.
Signed-off-by: Souptick Joarder <jrdr.linux(a)gmail.com>
---
arch/ia64/kernel/err_inject.c | 2 +-
drivers/platform/goldfish/goldfish_pipe.c | 2 +-
drivers/staging/gasket/gasket_page_table.c | 4 ++--
drivers/tee/tee_shm.c | 2 +-
mm/gup.c | 6 +++---
net/rds/rdma.c | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 8b5b8e6b..fd72218 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -143,7 +143,7 @@ static DEVICE_ATTR(name, 0644, show_##name, store_##name)
int ret;
ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
- if (ret<=0) {
+ if (ret < 0) {
#ifdef ERR_INJ_DEBUG
printk("Virtual address %lx is not existing.\n",virt_addr);
#endif
diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index 1ab207e..831449d 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -277,7 +277,7 @@ static int goldfish_pin_pages(unsigned long first_page,
ret = pin_user_pages_fast(first_page, requested_pages,
!is_write ? FOLL_WRITE : 0,
pages);
- if (ret <= 0)
+ if (ret < 0)
return -EFAULT;
if (ret < requested_pages)
*iter_last_page_size = PAGE_SIZE;
diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index f6d7157..1d08e1d 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -489,11 +489,11 @@ static int gasket_perform_mapping(struct gasket_page_table *pg_tbl,
ret = get_user_pages_fast(page_addr - offset, 1,
FOLL_WRITE, &page);
- if (ret <= 0) {
+ if (ret < 0) {
dev_err(pg_tbl->device,
"get user pages failed for addr=0x%lx, offset=0x%lx [ret=%d]\n",
page_addr, offset, ret);
- return ret ? ret : -ENOMEM;
+ return ret;
}
++pg_tbl->num_active_pages;
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index bd679b7..2706a1f 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -230,7 +230,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
if (rc > 0)
shm->num_pages = rc;
if (rc != num_pages) {
- if (rc >= 0)
+ if (rc > 0)
rc = -ENOMEM;
ret = ERR_PTR(rc);
goto err;
diff --git a/mm/gup.c b/mm/gup.c
index 50681f0..8d293ed 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2760,7 +2760,7 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,
end = start + len;
if (end <= start)
- return 0;
+ return -EINVAL;
if (unlikely(!access_ok((void __user *)start, len)))
return -EFAULT;
@@ -2805,8 +2805,8 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,
* calling get_user_pages().
*
* Returns number of pages pinned. This may be fewer than the number requested.
- * If nr_pages is 0 or negative, returns 0. If no pages were pinned, returns
- * -errno.
+ * If nr_pages is 0 or negative, returns -errno. If no pages were pinned,
+ * returns -errno.
*/
int get_user_pages_fast(unsigned long start, int nr_pages,
unsigned int gup_flags, struct page **pages)
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index a7ae118..44b96e6 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -161,7 +161,7 @@ static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages,
gup_flags |= FOLL_WRITE;
ret = pin_user_pages_fast(user_addr, nr_pages, gup_flags, pages);
- if (ret >= 0 && ret < nr_pages) {
+ if (ret > 0 && ret < nr_pages) {
unpin_user_pages(pages, ret);
ret = -EFAULT;
}
--
1.9.1
Hello arm-soc maintainers,
Please pull this small fix for a Smatch warning in tee_shm_alloc().
Thanks,
Jens
The following changes since commit ae83d0b416db002fe95601e7f97f64b59514d936:
Linux 5.7-rc2 (2020-04-19 14:35:30 -0700)
are available in the Git repository at:
git://git.linaro.org/people/jens.wiklander/linux-tee.git tags/tee-smatch-for-5.8
for you to fetch changes up to 1115899e7aad71bc36100c3fa1d0b99cff9263e6:
tee: remove unnecessary NULL check in tee_shm_alloc() (2020-04-20 13:12:01 +0200)
----------------------------------------------------------------
tee: remove unnecessary NULL check in tee_shm_alloc()
----------------------------------------------------------------
Dan Carpenter (1):
tee: remove unnecessary NULL check in tee_shm_alloc()
drivers/tee/tee_shm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Hello arm-soc maintainers,
Please pull these small tee subsystem patches.
Thanks,
Jens
The following changes since commit ae83d0b416db002fe95601e7f97f64b59514d936:
Linux 5.7-rc2 (2020-04-19 14:35:30 -0700)
are available in the Git repository at:
git://git.linaro.org/people/jens.wiklander/linux-tee.git tags/tee-subsys-for-5.8
for you to fetch changes up to 104edb94cc4b3101bab33161cd861de13e85610b:
tee: add private login method for kernel clients (2020-04-20 16:18:14 +0200)
----------------------------------------------------------------
TEE subsystem work
- Reserve GlobalPlatform implementation defined logon method range
- Add support to register kernel memory with TEE to allow TEE bus drivers
to register memory references.
----------------------------------------------------------------
Sumit Garg (2):
tee: enable support to register kernel memory
tee: add private login method for kernel clients
drivers/tee/tee_core.c | 7 +++++++
drivers/tee/tee_shm.c | 28 +++++++++++++++++++++++++---
include/linux/tee_drv.h | 1 +
include/uapi/linux/tee.h | 9 +++++++++
4 files changed, 42 insertions(+), 3 deletions(-)
There is export_uuid() function which exports uuid_t to the u8 array.
Use it instead of open coding variant.
This allows to hide the uuid_t internals.
Signed-off-by: Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
---
drivers/char/hw_random/optee-rng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
index ddfbabaa5f8f6..49b2e02537ddb 100644
--- a/drivers/char/hw_random/optee-rng.c
+++ b/drivers/char/hw_random/optee-rng.c
@@ -226,7 +226,7 @@ static int optee_rng_probe(struct device *dev)
return -ENODEV;
/* Open session with hwrng Trusted App */
- memcpy(sess_arg.uuid, rng_device->id.uuid.b, TEE_IOCTL_UUID_LEN);
+ export_uuid(sess_arg.uuid, &rng_device->id.uuid);
sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC;
sess_arg.num_params = 0;
--
2.26.1
This patchset creates the DT property /chosen/kaslr-seed which is used
by the OS for Address Space Layout Randomization. If the machine is
secure, a similar property is created under /secure-chosen.
Changes since v1:
- Move creation of /secure-chosen to create_fdt()
- Use qemu_guest_getrandom() instead of qcrypto_random_bytes()
- Create kaslr-seed for the non-secure OS too
Jerome Forissier (2):
hw/arm/virt: dt: move creation of /secure-chosen to create_fdt()
hw/arm/virt: dt: add kaslr-seed property
hw/arm/virt.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
--
2.20.1
V2:
Fix several build issues reported by kbuild test robot:
- patch 1/6: fix erroneous ';' in inline functions;
- patch 5/6: fix bad function label used;
- patch 6/6: fix bad function label used.
Reported-by: kbuild test robot <lkp(a)intel.com>
Fix function stubs to return -ENXIO not -EINVAL when SMCCC is not supported.
Few rephrasing in commit message for all patches of the series.
Add an empty line between a trace and a return instruction in patch 1/6.
Add argument label in arm_smccc_1_0_set_conduit() prototype in patch 1/6.
Fix typo in inline description comments in patch 1/6.
These changes propose helper functions and macros to consolidate choice of
the conduit method among devices communicating with a secure world that
complies with SMCCC v1.0 but not SMCCC v1.1 or later. The new helper
functions mimic arm_smccc_1_1_*() function but for SMCCC v1.0 compliant
firmwares.
This series of changes updates several firmware drivers that each define a
conduit method whereas kernel drivers are expected to use the very same
conduit. This series obviously does not enforce these drivers to apply the
proposed changes but the interest of the first patch is this series is that
at least the PSCI driver upgrades as it will allow new drivers to benefit
from the early initialized PSCI conduit method.
Etienne Carriere (6):
firmware: helper functions for SMCCC v1.0 invocation conduit
firmware: psci: set SMCCC v1.0 conduit and use helpers functions
tee: optee: use SMCCC v1.0 helper functions
firmware: arm_sdei: use SMCCC v1.0 helper functions
firmware: stratix10: use SMCCC v1.0 helper functions
firmware: zynqmp: use SMCCC v1.0 helper functions
drivers/firmware/Makefile | 1 +
drivers/firmware/arm_sdei.c | 79 +++++---------
drivers/firmware/arm_smccc_conduit.c | 148 +++++++++++++++++++++++++++
drivers/firmware/psci/psci.c | 60 ++---------
drivers/firmware/stratix10-svc.c | 97 ++----------------
drivers/firmware/xilinx/zynqmp.c | 87 ++--------------
drivers/tee/optee/call.c | 14 +--
drivers/tee/optee/core.c | 85 ++++-----------
drivers/tee/optee/optee_private.h | 4 +-
include/linux/arm-smccc.h | 106 +++++++++++++++++++
include/linux/psci.h | 1 -
11 files changed, 338 insertions(+), 344 deletions(-)
create mode 100644 drivers/firmware/arm_smccc_conduit.c
--
2.17.1
Earlier this patch-set was part of TEE Trusted keys patch-set [1]. But
since these are completely independent enhancements for TEE kernel
client interface which can be merged separately while TEE Trusted keys
discussions are ongoing.
Patch #1 enables support for registered kernel shared memory with TEE.
Patch #2 enables support for private kernel login method required for
cases like trusted keys where we don't wan't user-space to directly
access TEE service.
[1] https://lkml.org/lkml/2019/10/31/430
Changes in v6:
- Reserve only half of GP implementation defined range for kernel space.
Changes in v5:
- Misc. renaming of variables.
Sumit Garg (2):
tee: enable support to register kernel memory
tee: add private login method for kernel clients
drivers/tee/tee_core.c | 7 +++++++
drivers/tee/tee_shm.c | 28 +++++++++++++++++++++++++---
include/linux/tee_drv.h | 1 +
include/uapi/linux/tee.h | 9 +++++++++
4 files changed, 42 insertions(+), 3 deletions(-)
--
2.7.4