Commit c8da96e8 authored by Ben Hutchings's avatar Ben Hutchings Committed by James Morris

TOMOYO: Don't abuse sys_getpid(), sys_getppid()

System call entry functions sys_*() are never to be called from
general kernel code.  The fact that they aren't declared in header
files should have been a clue.  These functions also don't exist on
Alpha since it has sys_getxpid() instead.
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Acked-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 91e71c12
...@@ -1416,15 +1416,19 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r) ...@@ -1416,15 +1416,19 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
const pid_t gpid = task_pid_nr(current); const pid_t gpid = task_pid_nr(current);
static const int tomoyo_buffer_len = 4096; static const int tomoyo_buffer_len = 4096;
char *buffer = kmalloc(tomoyo_buffer_len, GFP_NOFS); char *buffer = kmalloc(tomoyo_buffer_len, GFP_NOFS);
pid_t ppid;
if (!buffer) if (!buffer)
return NULL; return NULL;
do_gettimeofday(&tv); do_gettimeofday(&tv);
rcu_read_lock();
ppid = task_tgid_vnr(current->real_parent);
rcu_read_unlock();
snprintf(buffer, tomoyo_buffer_len - 1, snprintf(buffer, tomoyo_buffer_len - 1,
"#timestamp=%lu profile=%u mode=%s (global-pid=%u)" "#timestamp=%lu profile=%u mode=%s (global-pid=%u)"
" task={ pid=%u ppid=%u uid=%u gid=%u euid=%u" " task={ pid=%u ppid=%u uid=%u gid=%u euid=%u"
" egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }", " egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
tv.tv_sec, r->profile, tomoyo_mode[r->mode], gpid, tv.tv_sec, r->profile, tomoyo_mode[r->mode], gpid,
(pid_t) sys_getpid(), (pid_t) sys_getppid(), task_tgid_vnr(current), ppid,
current_uid(), current_gid(), current_euid(), current_uid(), current_gid(), current_euid(),
current_egid(), current_suid(), current_sgid(), current_egid(), current_suid(), current_sgid(),
current_fsuid(), current_fsgid()); current_fsuid(), current_fsgid());
......
...@@ -689,9 +689,6 @@ struct tomoyo_profile { ...@@ -689,9 +689,6 @@ struct tomoyo_profile {
/********** Function prototypes. **********/ /********** Function prototypes. **********/
extern asmlinkage long sys_getpid(void);
extern asmlinkage long sys_getppid(void);
/* Check whether the given string starts with the given keyword. */ /* Check whether the given string starts with the given keyword. */
bool tomoyo_str_starts(char **src, const char *find); bool tomoyo_str_starts(char **src, const char *find);
/* Get tomoyo_realpath() of current process. */ /* Get tomoyo_realpath() of current process. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment