[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kernel-hardening
Subject:    [PATCH 05/12] seq_file: set the seq_file->f_cred during seq_open()
From:       Djalal Harouni <tixxdz () opendz ! org>
Date:       2013-09-25 20:14:38
Message-ID: 1380140085-29712-6-git-send-email-tixxdz () opendz ! org
[Download RAW message or body]

The f_cred field of the file struct contains the cred of current at
open time. This field can be used to get the context of open, and track
current's cred changes after.
The procfs is one of those fs that need to track current cred changes
in order to implement proper permission checks on each system call.

Set the seq_file->f_cred to file->f_cred during seq_open().

Cc: Kees Cook <keescook@chromium.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
---
 fs/seq_file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index 3135c25..a5e5b98 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -57,6 +57,7 @@ int seq_open(struct file *file, const struct seq_operations *op)
 	memset(p, 0, sizeof(*p));
 	mutex_init(&p->lock);
 	p->op = op;
+	p->f_cred = file->f_cred;
 #ifdef CONFIG_USER_NS
 	p->user_ns = file->f_cred->user_ns;
 #endif
-- 
1.7.11.7


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic