diff options
-rw-r--r-- | fs/compat.c | 3 | ||||
-rw-r--r-- | fs/exec.c | 3 | ||||
-rw-r--r-- | include/linux/sched.h | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/fs/compat.c b/fs/compat.c index 65a070e705ab..25589f8322f2 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1402,6 +1402,7 @@ int compat_do_execve(char * filename, | |||
1402 | retval = mutex_lock_interruptible(¤t->cred_exec_mutex); | 1402 | retval = mutex_lock_interruptible(¤t->cred_exec_mutex); |
1403 | if (retval < 0) | 1403 | if (retval < 0) |
1404 | goto out_free; | 1404 | goto out_free; |
1405 | current->in_execve = 1; | ||
1405 | 1406 | ||
1406 | retval = -ENOMEM; | 1407 | retval = -ENOMEM; |
1407 | bprm->cred = prepare_exec_creds(); | 1408 | bprm->cred = prepare_exec_creds(); |
@@ -1454,6 +1455,7 @@ int compat_do_execve(char * filename, | |||
1454 | goto out; | 1455 | goto out; |
1455 | 1456 | ||
1456 | /* execve succeeded */ | 1457 | /* execve succeeded */ |
1458 | current->in_execve = 0; | ||
1457 | mutex_unlock(¤t->cred_exec_mutex); | 1459 | mutex_unlock(¤t->cred_exec_mutex); |
1458 | acct_update_integrals(current); | 1460 | acct_update_integrals(current); |
1459 | free_bprm(bprm); | 1461 | free_bprm(bprm); |
@@ -1470,6 +1472,7 @@ out_file: | |||
1470 | } | 1472 | } |
1471 | 1473 | ||
1472 | out_unlock: | 1474 | out_unlock: |
1475 | current->in_execve = 0; | ||
1473 | mutex_unlock(¤t->cred_exec_mutex); | 1476 | mutex_unlock(¤t->cred_exec_mutex); |
1474 | 1477 | ||
1475 | out_free: | 1478 | out_free: |
@@ -1278,6 +1278,7 @@ int do_execve(char * filename, | |||
1278 | retval = mutex_lock_interruptible(¤t->cred_exec_mutex); | 1278 | retval = mutex_lock_interruptible(¤t->cred_exec_mutex); |
1279 | if (retval < 0) | 1279 | if (retval < 0) |
1280 | goto out_free; | 1280 | goto out_free; |
1281 | current->in_execve = 1; | ||
1281 | 1282 | ||
1282 | retval = -ENOMEM; | 1283 | retval = -ENOMEM; |
1283 | bprm->cred = prepare_exec_creds(); | 1284 | bprm->cred = prepare_exec_creds(); |
@@ -1331,6 +1332,7 @@ int do_execve(char * filename, | |||
1331 | goto out; | 1332 | goto out; |
1332 | 1333 | ||
1333 | /* execve succeeded */ | 1334 | /* execve succeeded */ |
1335 | current->in_execve = 0; | ||
1334 | mutex_unlock(¤t->cred_exec_mutex); | 1336 | mutex_unlock(¤t->cred_exec_mutex); |
1335 | acct_update_integrals(current); | 1337 | acct_update_integrals(current); |
1336 | free_bprm(bprm); | 1338 | free_bprm(bprm); |
@@ -1349,6 +1351,7 @@ out_file: | |||
1349 | } | 1351 | } |
1350 | 1352 | ||
1351 | out_unlock: | 1353 | out_unlock: |
1354 | current->in_execve = 0; | ||
1352 | mutex_unlock(¤t->cred_exec_mutex); | 1355 | mutex_unlock(¤t->cred_exec_mutex); |
1353 | 1356 | ||
1354 | out_free: | 1357 | out_free: |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 2127e959e0f4..397c20cfb6a5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1158,6 +1158,8 @@ struct task_struct { | |||
1158 | /* ??? */ | 1158 | /* ??? */ |
1159 | unsigned int personality; | 1159 | unsigned int personality; |
1160 | unsigned did_exec:1; | 1160 | unsigned did_exec:1; |
1161 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an | ||
1162 | * execve */ | ||
1161 | pid_t pid; | 1163 | pid_t pid; |
1162 | pid_t tgid; | 1164 | pid_t tgid; |
1163 | 1165 | ||