Commit f920bb6f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'audit.b49' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current

* 'audit.b49' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
  [PATCH] export sessionid alongside the loginuid in procfs
parents d3246691 1e0bd755
...@@ -1036,6 +1036,26 @@ static const struct file_operations proc_loginuid_operations = { ...@@ -1036,6 +1036,26 @@ static const struct file_operations proc_loginuid_operations = {
.read = proc_loginuid_read, .read = proc_loginuid_read,
.write = proc_loginuid_write, .write = proc_loginuid_write,
}; };
static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
struct inode * inode = file->f_path.dentry->d_inode;
struct task_struct *task = get_proc_task(inode);
ssize_t length;
char tmpbuf[TMPBUFLEN];
if (!task)
return -ESRCH;
length = scnprintf(tmpbuf, TMPBUFLEN, "%u",
audit_get_sessionid(task));
put_task_struct(task);
return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
}
static const struct file_operations proc_sessionid_operations = {
.read = proc_sessionid_read,
};
#endif #endif
#ifdef CONFIG_FAULT_INJECTION #ifdef CONFIG_FAULT_INJECTION
...@@ -2319,6 +2339,7 @@ static const struct pid_entry tgid_base_stuff[] = { ...@@ -2319,6 +2339,7 @@ static const struct pid_entry tgid_base_stuff[] = {
REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
REG("loginuid", S_IWUSR|S_IRUGO, loginuid), REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
REG("sessionid", S_IRUSR, sessionid),
#endif #endif
#ifdef CONFIG_FAULT_INJECTION #ifdef CONFIG_FAULT_INJECTION
REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
...@@ -2649,6 +2670,7 @@ static const struct pid_entry tid_base_stuff[] = { ...@@ -2649,6 +2670,7 @@ static const struct pid_entry tid_base_stuff[] = {
REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
REG("loginuid", S_IWUSR|S_IRUGO, loginuid), REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
REG("sessionid", S_IRUSR, sessionid),
#endif #endif
#ifdef CONFIG_FAULT_INJECTION #ifdef CONFIG_FAULT_INJECTION
REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
......
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