2.6.27.44-stable review
Subsystems (5)
PATCH 1/6 kernel/signal.c: fix kernel information leak with print-fatal-signals=1
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andi Kleen <[email protected]>
commit b45c6e76bc2c72f6426c14bed64fdcbc9bf37cb0 upstream.
When print-fatal-signals is enabled it's possible to dump any memory reachable by the kernel to the log by simply jumping to that address from user space.
Or crash the system if there's some hardware with read side effects.
The fatal signals handler will dump 16 bytes at the execution address, which is fully controlled by ring 3.
In addition when something jumps to a unmapped address there will be up to 16 additional useless page faults, which might be potentially slow (and at least is not very efficient)
Fortunately this option is off by default and only there on i386.
But fix it by checking for kernel addresses and also stopping when there's a page fault.
--- kernel/signal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/signal.c +2 -1
@@ -884,7 +884,8 @@ static void print_fatal_signal(struct ptfor (i =0 ; i <16 ; i++) {unsigned char insn; -__get_user (insn, (unsigned char *)(regs->ip + i)); +if (get_user (insn, (unsigned char *)(regs->ip + i))) +break ;printk ("%02x " , insn); } }
PATCH 2/6 netfilter: ebtables: enforce CAP_NET_ADMIN
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Florian Westphal <[email protected]>
commit dce766af541f6605fa9889892c0280bab31c66ab upstream.
normal users are currently allowed to set/modify ebtables rules. Restrict it to processes with CAP_NET_ADMIN.
Note that this cannot be reproduced with unmodified ebtables binary because it uses SOCK_RAW.
--- net/bridge/netfilter/ebtables.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bridge/netfilter/ebtables.c +6 -0
@@ -1436,6 +1436,9 @@ static int do_ebt_set_ctl(struct sock *s {int ret; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +switch (cmd) {case EBT_SO_SET_ENTRIES : ret =do_replace (user, len);
@@ -1455,6 +1458,9 @@ static int do_ebt_get_ctl(struct sock *sstruct ebt_replace tmp;struct ebt_table *t; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (copy_from_user (&tmp, user,sizeof (tmp)))return -EFAULT ;
PATCH 3/6 fix braindamage in audit_tree.c untag_chunk()
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit 6f5d51148921c242680a7a1d9913384a30ab3cbe upstream.
... aka "Al had badly fscked up when writing that thing and nobody noticed until Eric had fixed leaks that used to mask the breakage".
The function essentially creates a copy of old array sans one element and replaces the references to elements of original (they are on cyclic lists) with those to corresponding elements of new one. After that the old one is fair game for freeing.
First of all, there's a dumb braino: when we get to list_replace_init we use indices for wrong arrays - position in new one with the old array and vice versa.
Another bug is more subtle - termination condition is wrong if the element to be excluded happens to be the last one. We shouldn't go until we fill the new array, we should go until we'd finished the old one. Otherwise the element we are trying to kill will remain on the cyclic lists...
That crap used to be masked by several leaks, so it was not quite trivial to hit. Eric had fixed some of those leaks a while ago and the shit had hit the fan...
--- kernel/audit_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/audit_tree.c +2 -2
@@ -276,7 +276,7 @@ static void untag_chunk(struct node *p) owner->root =NULL ; } -for (i = j =0 ; i < size; i++, j++) { +for (i = j =0 ; j <= size; i++, j++) {struct audit_tree *s;if (&chunk->owners[j] == p) {list_del_init (&p->list);
@@ -289,7 +289,7 @@ static void untag_chunk(struct node *p)if (!s)/* result of earlier fallback */ continue ;get_tree (s); -list_replace_init (&chunk->owners[i].list, &new->owners[j].list); +list_replace_init (&chunk->owners[j].list, &new->owners[i].list); }list_replace_rcu (&chunk->hash, &new->hash);
PATCH 4/6 fix more leaks in audit_tree.c tag_chunk()
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit b4c30aad39805902cf5b855aa8a8b22d728ad057 upstream.
Several leaks in audit_tree didn't get caught by commit 318b6d3d7ddbcad3d6867e630711b8a705d873d7, including the leak on normal exit in case of multiple rules refering to the same chunk.
--- kernel/audit_tree.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/audit_tree.c +6 -3
@@ -372,15 +372,17 @@ static int tag_chunk(struct inode *inodefor (n =0 ; n < old->count; n++) {if (old->owners[n].owner == tree) {spin_unlock (&hash_lock); -put_inotify_watch (watch); +put_inotify_watch (&old->watch);return 0 ; } }spin_unlock (&hash_lock); chunk =alloc_chunk (old->count +1 ); -if (!chunk) +if (!chunk) { +put_inotify_watch (&old->watch);return -ENOMEM ; + }mutex_lock (&inode->inotify_mutex);if (inotify_clone_watch (&old->watch, &chunk->watch) <0 ) {
@@ -422,7 +424,8 @@ static int tag_chunk(struct inode *inodespin_unlock (&hash_lock);inotify_evict_watch (&old->watch);mutex_unlock (&inode->inotify_mutex); -put_inotify_watch (&old->watch); +put_inotify_watch (&old->watch);/* pair to inotify_find_watch */ +put_inotify_watch (&old->watch);/* and kill it */ return 0 ; }
PATCH 5/6 powerpc: Disable VSX or current process in giveup_fpu/altivec
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael Neuling <[email protected]>
commit 7e875e9dc8af70d126fa632446e967327ac3fdda upstream.
When we call giveup_fpu, we need to need to turn off VSX for the current process. If we don't, on return to userspace it may execute a VSX instruction before the next FP instruction, and not have its register state refreshed correctly from the thread_struct. Ditto for altivec.
This caused a bug where an unaligned lfs or stfs results in fix_alignment calling giveup_fpu so it can use the FPRs (in order to do a single <-> double conversion), and then returning to userspace with FP off but VSX on. Then if a VSX instruction is executed, before another FP instruction, it will proceed without another exception and hence have the incorrect register state for VSX registers 0-31.
lfs unaligned <- alignment exception turns FP off but leaves VSX on
VSX instruction <- no exception since VSX on, hence we get the
wrong VSX register values for VSX registers 0-31, which overlap the FPRs.
--- arch/powerpc/kernel/fpu.S | 5 +++++ arch/powerpc/kernel/misc_64.S | 8 ++++++++ 2 files changed, 13 insertions(+)
arch/powerpc/kernel/fpu.S +5 -0
@@ -145,6 +145,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX) beq 1f PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5) li r3,MSR_FP|MSR_FE0|MSR_FE1 +#ifdef CONFIG_VSX +BEGIN_FTR_SECTION + oris r3,r3,MSR_VSX@h +END_FTR_SECTION_IFSET(CPU_FTR_VSX) +#endif andc r4,r4,r3 /* disable FP for previous task */ PPC_STL r4,_MSR-STACK_FRAME_OVERHEAD(r5) 1:
arch/powerpc/kernel/misc_64.S +8 -0
@@ -493,7 +493,15 @@ _GLOBAL(giveup_altivec) stvx vr0,r4,r3 beq 1f ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) +#ifdef CONFIG_VSX +BEGIN_FTR_SECTION + lis r3,(MSR_VEC|MSR_VSX)@h +FTR_SECTION_ELSE + lis r3,MSR_VEC@h +ALT_FTR_SECTION_END_IFSET(CPU_FTR_VSX) +#else lis r3,MSR_VEC@h +#endif andc r4,r4,r3 /* disable FP for previous task */ std r4,_MSR-STACK_FRAME_OVERHEAD(r5) 1:
PATCH 6/6 powerpc: Handle VSX alignment faults correctly in little-endian mode
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Neil Campbell <[email protected]>
commit bb7f20b1c639606def3b91f4e4aca6daeee5d80a upstream.
This patch fixes the handling of VSX alignment faults in little-endian mode (the current code assumes the processor is in big-endian mode).
The patch also makes the handlers clear the top 8 bytes of the register when handling an 8 byte VSX load.
This is based on 2.6.32.
--- arch/powerpc/kernel/align.c | 63 ++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 17 deletions(-)
arch/powerpc/kernel/align.c +46 -17
@@ -641,10 +641,14 @@ static int emulate_spe(struct pt_regs *r*/ static int emulate_vsx (unsigned char __user *addr,unsigned int reg,unsigned int areg,struct pt_regs *regs, -unsigned int flags,unsigned int length) +unsigned int flags,unsigned int length, +unsigned int elsize) {char *ptr; +unsigned long *lptr;int ret =0 ; +int sw =0 ; +int i, j;flush_vsx_to_thread (current);
@@ -653,19 +657,35 @@ static int emulate_vsx(unsigned char __u else ptr = (char *) ¤t->thread.vr[reg -32 ]; -if (flags &ST ) - ret =__copy_to_user (addr, ptr, length); -else { -if (flags &SPLT ){ - ret =__copy_from_user (ptr, addr, length); - ptr += length; + lptr = (unsigned long *) ptr; + +if (flags &SW ) + sw = elsize-1 ; + +for (j =0 ; j < length; j += elsize) { +for (i =0 ; i < elsize; ++i) { +if (flags &ST ) + ret |=__put_user (ptr[i^sw], addr + i); +else + ret |=__get_user (ptr[i^sw], addr + i); } - ret |=__copy_from_user (ptr, addr, length); + ptr += elsize; + addr += elsize; } -if (flags &U ) - regs->gpr[areg] = regs->dar; -if (ret) + +if (!ret) { +if (flags &U ) + regs->gpr[areg] = regs->dar; + +/* Splat load copies the same data to top and bottom 8 bytes */ +if (flags &SPLT ) + lptr[1 ] = lptr[0 ]; +/* For 8 byte loads, zero the top 8 bytes */ +else if (!(flags &ST ) && (8 == length)) + lptr[1 ] =0 ; + }else return -EFAULT ; + return 1; }#endif
@@ -764,16 +784,25 @@ int fix_alignment(struct pt_regs *regs)#ifdef CONFIG_VSX if ((instruction &0xfc00003e ) ==0x7c000018 ) { -/* Additional register addressing bit (64 VSX vs 32 FPR/GPR */ +unsigned int elsize; + +/* Additional register addressing bit (64 VSX vs 32 FPR/GPR) */ reg |= (instruction &0x1 ) <<5 ;/* Simple inline decoder instead of a table */ +/* VSX has only 8 and 16 byte memory accesses */ + nb =8 ;if (instruction &0x200 ) nb =16 ; -else if (instruction &0x080 ) - nb =8 ; -else - nb =4 ; + +/* Vector stores in little-endian mode swap individual +elements, so process them separately */ + elsize =4 ; +if (instruction &0x80 ) + elsize =8 ; + flags =0 ; +if (regs->msr &MSR_LE ) + flags |=SW ;if (instruction &0x100 ) flags |=ST ;if (instruction &0x040 )
@@ -783,7 +812,7 @@ int fix_alignment(struct pt_regs *regs) flags |=SPLT ; nb = 8; } -return emulate_vsx (addr, reg, areg, regs, flags, nb); +return emulate_vsx (addr, reg, areg, regs, flags, nb, elsize); }#endif /* A size of 0 indicates an instruction we don't support, with
cover 2.6.27.44-stable review
This is the start of the stable review cycle for the 2.6.27.44 release. There are 6 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Saturday, January 16, 22:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.27.44-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- arch/powerpc/kernel/align.c | 63 ++++++++++++++++++++++++++++---------- arch/powerpc/kernel/fpu.S | 5 +++ arch/powerpc/kernel/misc_64.S | 8 +++++ kernel/audit_tree.c | 13 +++++--- kernel/signal.c | 3 +- net/bridge/netfilter/ebtables.c | 6 ++++ 7 files changed, 76 insertions(+), 24 deletions(-)