Thread (5 messages) 5 messages, 2 authors, 2011-08-12

Re: [PATCH] Alpha: unbreak osf_setsysinfo(SSI_NVPAIRS, [SSIN_UACPROC, UAC_SIGBUS])

From: Sergei Trofimovich <hidden>
Date: 2011-08-12 21:51:28
Subsystem: the rest · Maintainer: Linus Torvalds

I'll build alpha toolchain / qemu root and will try to cook
nicer patch with compile-time safety checks.
Sent reworked patch: http://marc.info/?l=linux-alpha&m=131318270531656&w=2

Yelling at the header I've found minor nit:
...
#define SET_UNALIGN_CTL(task,value)     ({                                   \
        task_thread_info(task)->flags = ((task_thread_info(task)->flags &    \
                ~ALPHA_UAC_MASK)
                | (((value) << ALPHA_UAC_SHIFT)       & (1<<TIF_UAC_NOPRINT))\
                | (((value) << (ALPHA_UAC_SHIFT + 1)) & (1<<TIF_UAC_SIGBUS)) \
                | (((value) << (ALPHA_UAC_SHIFT - 1)) & (1<<TIF_UAC_NOFIX)));\
        0; })

#define GET_UNALIGN_CTL(task,value)     ({                              \
        put_user((task_thread_info(task)->flags & (1 << TIF_UAC_NOPRINT))\
                  >> ALPHA_UAC_SHIFT                                    \
                 | (task_thread_info(task)->flags & (1 << TIF_UAC_SIGBUS))\
                 >> (ALPHA_UAC_SHIFT + 1)                               \
                 | (task_thread_info(task)->flags & (1 << TIF_UAC_NOFIX))\
                 >> (ALPHA_UAC_SHIFT - 1),                              \
                 (int __user *)(value));                                \
        })

The macros SET_UNALIGN_CTL/GET_UNALIGN_CTL are used
only in kernel/sys.c:prctl syscall.
| (((value) << ALPHA_UAC_SHIFT)       & (1<<TIF_UAC_NOPRINT))
prctl.h: # define PR_UNALIGN_NOPRINT     1
|  (((value) << (ALPHA_UAC_SHIFT + 1)) & (1<<TIF_UAC_SIGBUS))
prctl.h: # define PR_UNALIGN_SIGBUS      2
| (((value) << (ALPHA_UAC_SHIFT - 1)) & (1<<TIF_UAC_NOFIX)));
prctl.h: no '4' value

Do you think it's worth adding to userspace interface
or should one just remove it from handled by prctl flags [ABI change]?

Thanks!
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index a3baeb2..f66539a 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -15,6 +15,7 @@
 #define PR_SET_UNALIGN   6
 # define PR_UNALIGN_NOPRINT    1       /* silently fix up unaligned user accesses */
 # define PR_UNALIGN_SIGBUS     2       /* generate SIGBUS on unaligned user access */
+# define PR_UNALIGN_NOFIX      4       /* skip offending instruction and do nothing */

 /* Get/set whether or not to drop capabilities on setuid() away from
  * uid 0 (as per security/commoncap.c) */
-- 

  Sergei

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help