Skip to content

Commit a267ac0

Browse files
committed
Implements LOGIN_APPLICATION and LOGIN_USER_APPLICATION
Acked-by: Jerome Forissier <[email protected]> Signed-off-by: Oleg Kharitonov <[email protected]>
1 parent 4da2533 commit a267ac0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

drivers/tee/tee_core.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/cred.h>
1010
#include <linux/fs.h>
1111
#include <linux/idr.h>
12+
#include <linux/mm.h>
1213
#include <linux/module.h>
1314
#include <linux/slab.h>
1415
#include <linux/tee_core.h>
@@ -222,6 +223,11 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
222223
* For TEEC_LOGIN_GROUP:
223224
* gid=<gid>
224225
*
226+
* For TEEC_LOGIN_APPLICATION:
227+
* path=<command line path>
228+
*
229+
* For TEEC_LOGIN_USER_APPLICATION:
230+
* uid=<uid>,path=<command line path>
225231
*/
226232

227233
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,
254260
}
255261
break;
256262

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+
257295
default:
258296
rc = -EINVAL;
259297
goto out_free_name;

0 commit comments

Comments
 (0)