|
9 | 9 | #include <linux/cred.h>
|
10 | 10 | #include <linux/fs.h>
|
11 | 11 | #include <linux/idr.h>
|
| 12 | +#include <linux/mm.h> |
12 | 13 | #include <linux/module.h>
|
13 | 14 | #include <linux/slab.h>
|
14 | 15 | #include <linux/tee_core.h>
|
@@ -222,6 +223,11 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
|
222 | 223 | * For TEEC_LOGIN_GROUP:
|
223 | 224 | * gid=<gid>
|
224 | 225 | *
|
| 226 | + * For TEEC_LOGIN_APPLICATION: |
| 227 | + * path=<command line path> |
| 228 | + * |
| 229 | + * For TEEC_LOGIN_USER_APPLICATION: |
| 230 | + * uid=<uid>,path=<command line path> |
225 | 231 | */
|
226 | 232 |
|
227 | 233 | name = kzalloc(TEE_UUID_NS_NAME_SIZE, GFP_KERNEL);
|
@@ -254,6 +260,38 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
|
254 | 260 | }
|
255 | 261 | break;
|
256 | 262 |
|
| 263 | + case TEE_IOCTL_LOGIN_APPLICATION: |
| 264 | + { |
| 265 | + char path[PATH_MAX]; |
| 266 | + if (get_cmdline(current, path, sizeof(path)) >= sizeof(path)) { |
| 267 | + rc = -E2BIG; |
| 268 | + goto out_free_name; |
| 269 | + } |
| 270 | + name_len = snprintf(name, TEE_UUID_NS_NAME_SIZE, "path=%s", |
| 271 | + path); |
| 272 | + if (name_len >= TEE_UUID_NS_NAME_SIZE) { |
| 273 | + rc = -E2BIG; |
| 274 | + goto out_free_name; |
| 275 | + } |
| 276 | + } |
| 277 | + break; |
| 278 | + |
| 279 | + case TEE_IOCTL_LOGIN_USER_APPLICATION: |
| 280 | + { |
| 281 | + char path[PATH_MAX]; |
| 282 | + if (get_cmdline(current, path, sizeof(path)) >= sizeof(path)) { |
| 283 | + rc = -E2BIG; |
| 284 | + goto out_free_name; |
| 285 | + } |
| 286 | + name_len = snprintf(name, TEE_UUID_NS_NAME_SIZE, "uid=%x,path=%s", |
| 287 | + current_euid().val, path); |
| 288 | + if (name_len >= TEE_UUID_NS_NAME_SIZE) { |
| 289 | + rc = -E2BIG; |
| 290 | + goto out_free_name; |
| 291 | + } |
| 292 | + } |
| 293 | + break; |
| 294 | + |
257 | 295 | default:
|
258 | 296 | rc = -EINVAL;
|
259 | 297 | goto out_free_name;
|
|
0 commit comments