Commit 6ec708e1 authored by Jan Kiszka's avatar Jan Kiszka

Replace sigset_to/from_compat with post 4.14 versions

...while wrapping for 4.14 and earlier.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 32e115dc
...@@ -38,6 +38,27 @@ ...@@ -38,6 +38,27 @@
* symbol, so that obsolete wrappers can be spotted. * symbol, so that obsolete wrappers can be spotted.
*/ */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
#define get_compat_sigset(set, compat) \
({ \
compat_sigset_t set32; \
int ret; \
\
ret = cobalt_copy_from_user(&set32, compat, sizeof(compat_sigset_t)); \
if (!ret) \
sigset_from_compat(set, &set32); \
ret; \
})
#define put_compat_sigset(compat, set, size) \
({ \
compat_sigset_t set32; \
\
sigset_to_compat(&set32, set); \
cobalt_copy_to_user(compat, &set32, size); \
})
#endif /* < 4.15 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
#define raw_copy_to_user(__to, __from, __n) __copy_to_user_inatomic(__to, __from, __n) #define raw_copy_to_user(__to, __from, __n) __copy_to_user_inatomic(__to, __from, __n)
#define raw_copy_from_user(__to, __from, __n) __copy_from_user_inatomic(__to, __from, __n) #define raw_copy_from_user(__to, __from, __n) __copy_from_user_inatomic(__to, __from, __n)
......
...@@ -313,32 +313,13 @@ EXPORT_SYMBOL_GPL(sys32_get_sigevent); ...@@ -313,32 +313,13 @@ EXPORT_SYMBOL_GPL(sys32_get_sigevent);
int sys32_get_sigset(sigset_t *set, const compat_sigset_t *u_cset) int sys32_get_sigset(sigset_t *set, const compat_sigset_t *u_cset)
{ {
compat_sigset_t cset; return get_compat_sigset(set, u_cset);
int ret;
if (u_cset == NULL)
return -EFAULT;
ret = cobalt_copy_from_user(&cset, u_cset, sizeof(cset));
if (ret)
return ret;
sigset_from_compat(set, &cset);
return 0;
} }
EXPORT_SYMBOL_GPL(sys32_get_sigset); EXPORT_SYMBOL_GPL(sys32_get_sigset);
int sys32_put_sigset(compat_sigset_t *u_cset, const sigset_t *set) int sys32_put_sigset(compat_sigset_t *u_cset, const sigset_t *set)
{ {
compat_sigset_t cset; return put_compat_sigset(u_cset, set, sizeof(*u_cset));
if (u_cset == NULL)
return -EFAULT;
sigset_to_compat(&cset, set);
return cobalt_copy_to_user(u_cset, &cset, sizeof(cset));
} }
EXPORT_SYMBOL_GPL(sys32_put_sigset); EXPORT_SYMBOL_GPL(sys32_put_sigset);
......
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