* [PATCH] sns: add syscall to check signed state of a process [4/4]
@ 2007-06-21 16:02 Alexander Wuerstlein
2007-06-21 16:34 ` Akinobu Mita
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Wuerstlein @ 2007-06-21 16:02 UTC (permalink / raw)
To: linux-kernel; +Cc: Alexander Wuerstlein, Johannes Schlumberger
Makes it possible for a userspace process to ask for the trustworthiness of
another process.
Signed-off-by: Johannes Schlumberger <spjsschl@cip.informatik.uni-erlangen.de>
---
arch/i386/kernel/syscall_table.S | 1 +
include/asm-i386/unistd.h | 3 ++-
security/sns.c | 15 +++++++++++++++
3 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index bf6adce..e8ba35a 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -323,3 +323,4 @@ ENTRY(sys_call_table)
.long sys_signalfd
.long sys_timerfd
.long sys_eventfd
+ .long sys_sns_is_trusted /* 320 */
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index e84ace1..3f8df3e 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -329,10 +329,11 @@
#define __NR_signalfd 321
#define __NR_timerfd 322
#define __NR_eventfd 323
+#define __NR_sns_is_trusted 324
#ifdef __KERNEL__
-#define NR_syscalls 324
+#define NR_syscalls 325
#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
diff --git a/security/sns.c b/security/sns.c
index 3192a90..1978f7c 100644
--- a/security/sns.c
+++ b/security/sns.c
@@ -112,3 +112,18 @@ int sns_signature_valid(struct file *file)
crypto_free_hash(tfm);
return ret;
}
+
+asmlinkage int sys_sns_is_trusted(pid_t p)
+{
+ struct task_struct *t;
+ rcu_read_lock();
+ t = find_task_by_pid(p);
+ if (IS_ERR(t)) {
+ rcu_read_unlock();
+ return -EINVAL;
+ }
+ p = t->sns_valid_sig; /*locking needed*/
+ rcu_read_unlock();
+ return p;
+}
+EXPORT_SYMBOL_GPL(sys_sns_is_trusted);
--
1.5.2.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sns: add syscall to check signed state of a process [4/4]
2007-06-21 16:02 [PATCH] sns: add syscall to check signed state of a process [4/4] Alexander Wuerstlein
@ 2007-06-21 16:34 ` Akinobu Mita
2007-06-21 16:49 ` Alexander Wuerstlein
0 siblings, 1 reply; 5+ messages in thread
From: Akinobu Mita @ 2007-06-21 16:34 UTC (permalink / raw)
To: Alexander Wuerstlein; +Cc: linux-kernel, Johannes Schlumberger
2007/6/22, Alexander Wuerstlein <arw@arw.name>:
> +asmlinkage int sys_sns_is_trusted(pid_t p)
> +{
> + struct task_struct *t;
> + rcu_read_lock();
> + t = find_task_by_pid(p);
> + if (IS_ERR(t)) {
Shouldn't it be:
if (!t) {
...
?
find_task_by_pid() returns NULL on failure.
> + rcu_read_unlock();
> + return -EINVAL;
> + }
> + p = t->sns_valid_sig; /*locking needed*/
> + rcu_read_unlock();
> + return p;
> +}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sns: add syscall to check signed state of a process [4/4]
2007-06-21 16:34 ` Akinobu Mita
@ 2007-06-21 16:49 ` Alexander Wuerstlein
2007-06-23 18:03 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Wuerstlein @ 2007-06-21 16:49 UTC (permalink / raw)
To: Akinobu Mita; +Cc: Alexander Wuerstlein, linux-kernel, Johannes Schlumberger
On 070621 18:34, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> 2007/6/22, Alexander Wuerstlein <arw@arw.name>:
>
>> +asmlinkage int sys_sns_is_trusted(pid_t p)
>> +{
>> + struct task_struct *t;
>> + rcu_read_lock();
>> + t = find_task_by_pid(p);
>> + if (IS_ERR(t)) {
>
> Shouldn't it be:
> if (!t) {
> ...
> ?
>
> find_task_by_pid() returns NULL on failure.
You seem to be right, the rest of the kernel just does 'if (!t)'. We just used
IS_ERR() as the 'check for evil pointers' function.
Ciao,
Alexander Wuerstlein.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sns: add syscall to check signed state of a process [4/4]
2007-06-21 16:49 ` Alexander Wuerstlein
@ 2007-06-23 18:03 ` Jan Engelhardt
0 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-06-23 18:03 UTC (permalink / raw)
To: Alexander Wuerstlein
Cc: Akinobu Mita, Alexander Wuerstlein, linux-kernel, Johannes Schlumberger
On Jun 21 2007 18:49, Alexander Wuerstlein wrote:
>
>You seem to be right, the rest of the kernel just does 'if (!t)'. We just used
>IS_ERR() as the 'check for evil pointers' function.
But NULL is not covered by IS_ERR.
Jan
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] sns: add syscall to check signed state of a process [4/4]
2007-06-21 15:55 [PATCH] signed binaries support [0/4] Johannes Schlumberger
@ 2007-06-22 18:25 ` Alexander Wuerstlein
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Wuerstlein @ 2007-06-22 18:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Alexander Wuerstlein, Johannes Schlumberger
Makes it possible for a userspace process to ask for the trustworthiness of
another process.
Signed-off-by: Johannes Schlumberger <spjsschl@cip.informatik.uni-erlangen.de>
---
arch/i386/kernel/syscall_table.S | 1 +
include/asm-i386/unistd.h | 3 ++-
security/sns.c | 15 +++++++++++++++
3 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index bf6adce..e8ba35a 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -323,3 +323,4 @@ ENTRY(sys_call_table)
.long sys_signalfd
.long sys_timerfd
.long sys_eventfd
+ .long sys_sns_is_trusted /* 320 */
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index e84ace1..3f8df3e 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -329,10 +329,11 @@
#define __NR_signalfd 321
#define __NR_timerfd 322
#define __NR_eventfd 323
+#define __NR_sns_is_trusted 324
#ifdef __KERNEL__
-#define NR_syscalls 324
+#define NR_syscalls 325
#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
diff --git a/security/sns.c b/security/sns.c
index 3192a90..1978f7c 100644
--- a/security/sns.c
+++ b/security/sns.c
@@ -112,3 +112,18 @@ int sns_signature_valid(struct file *file)
crypto_free_hash(tfm);
return ret;
}
+
+asmlinkage int sys_sns_is_trusted(pid_t p)
+{
+ struct task_struct *t;
+ rcu_read_lock();
+ t = find_task_by_pid(p);
+ if (IS_ERR(t)) {
+ rcu_read_unlock();
+ return -EINVAL;
+ }
+ p = t->sns_valid_sig; /*locking needed*/
+ rcu_read_unlock();
+ return p;
+}
+EXPORT_SYMBOL_GPL(sys_sns_is_trusted);
--
1.5.2.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-23 18:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-21 16:02 [PATCH] sns: add syscall to check signed state of a process [4/4] Alexander Wuerstlein
2007-06-21 16:34 ` Akinobu Mita
2007-06-21 16:49 ` Alexander Wuerstlein
2007-06-23 18:03 ` Jan Engelhardt
-- strict thread matches above, loose matches on Subject: below --
2007-06-21 15:55 [PATCH] signed binaries support [0/4] Johannes Schlumberger
2007-06-22 18:25 ` [PATCH] sns: add syscall to check signed state of a process [4/4] Alexander Wuerstlein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®