signalfd/timerfd v3 - signalfd compat code ...
PATCH 5/9 signalfd/timerfd v3 - signalfd compat code ...
This patch implement the necessary compat code for the signalfd system call.
- Davide
fs/compat.c +22 -0
@@ -46,6 +46,7 @@#include <linux/rwsem.h> #include <linux/tsacct_kern.h> #include <linux/highmem.h> +#include <linux/signal.h> #include <linux/poll.h> #include <linux/mm.h>
@@ -2235,3 +2236,24 @@ return sys_ni_syscall(); }#endif + +asmlinkage long compat_sys_signalfd (int ufd, +const compat_sigset_t __user *sigmask, +compat_size_t sigsetsize) +{ +compat_sigset_t ss32; +sigset_t tmp; +sigset_t __user *ksigmask; + +if (sigsetsize !=sizeof (compat_sigset_t)) +return -EINVAL ; +if (copy_from_user (&ss32, sigmask,sizeof (ss32))) +return -EFAULT ; +sigset_from_compat (&tmp, &ss32); + ksigmask =compat_alloc_user_space (sizeof (sigset_t)); +if (copy_to_user (ksigmask, &tmp,sizeof (sigset_t))) +return -EFAULT ; + +return sys_signalfd (ufd, ksigmask,sizeof (sigset_t)); +} +
On Monday 12 March 2007 20:19:27 Davide Libenzi wrote:
Hi,
i'm not (at least until yet) really that familiar with the kernel, but currently trying to get into it also via reading of code and patches here. So please don't take my comments in this (and posibly following) mails to serious. ;-)
Quoted 2 lines
+asmlinkage long compat_sys_signalfd(int ufd,
+ constcompat_sigset_t__user
*sigmask,
fs/compat.c line 2247
Quoted 6 lines
+ compat_size_t sigsetsize)
fs/compat.c +5
-0+{ + compat_sigset_t ss32; + sigset_t tmp; + sigset_t __user *ksigmask; +
Would it be good to put this in a
if (sigmask) {
like its e.g. done in compat_sys_epoll_pwait or would this be totally useless here?
Quoted 5 lines
+ if (sigsetsize !=
sizeof(compat_sigset_t)) + return-EINVAL;
+ if (copy_from_user(&ss32, sigmask, sizeof(ss32))) + return-EFAULT;
...
Have fun,
Frank
Quoted 18 lines · Frank Seidel
On Monday 12 March 2007 20:19:27 Davide Libenzi wrote:
Hi,
i'm not (at least until yet) really that familiar with the kernel, but currently trying to get into it also via reading of code and patches here. So please don't take my comments in this (and posibly following) mails to serious. ;-)Quoted 2 lines
+asmlinkage long compat_sys_signalfd(int ufd,
+ constcompat_sigset_t__user*sigmask,
fs/compat.c line 2247
Quoted 6 lines
+ compat_size_t sigsetsize)
fs/compat.c +5
-0+{ + compat_sigset_t ss32; + sigset_t tmp; + sigset_t __user *ksigmask; +Would it be good to put this in a
Quoted 4 lines
if (sigmask) {
like its e.g. done in
compat_sys_epoll_pwaitor would this be totally useless here?
On the contrary or epoll_pwait (same family of ppoll/pselect), the sigmask is needed here, by the API definition.
- Davide