wok-backports rev 4

linux: add CVE-2013-2929 fix
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 19 11:38:24 2013 +0000 (2013-12-19)
parents 76e02aa1ee77
children b3f60b195d7a
files linux-kvm/receipt linux/receipt linux/stuff/linux-CVE-2013-2929.u linux/stuff/linux-subroot.u2
line diff
     1.1 --- a/linux-kvm/receipt	Thu Dec 19 00:21:19 2013 +0100
     1.2 +++ b/linux-kvm/receipt	Thu Dec 19 11:38:24 2013 +0000
     1.3 @@ -21,6 +21,7 @@
     1.4      export _pkg
     1.5      $wanted_stuff/list_modules.sh arch/x86/kvm drivers/virtio drivers/lguest \
     1.6      drivers/char/hw_random/virtio-rng.ko.xz \
     1.7 +    drivers/char/virtio_console.ko.xz \
     1.8      drivers/net/virtio_net.ko.xz drivers/block/virtio_blk.ko.xz | \
     1.9      while read module; do
    1.10      	dir=$path/$(dirname $module)
     2.1 --- a/linux/receipt	Thu Dec 19 00:21:19 2013 +0100
     2.2 +++ b/linux/receipt	Thu Dec 19 11:38:24 2013 +0000
     2.3 @@ -135,6 +135,7 @@
     2.4  $PACKAGE-header.u
     2.5  $PACKAGE-freeinitrd.u
     2.6  $PACKAGE-subroot.u
     2.7 +$PACKAGE-CVE-2013-2929.u
     2.8  aufs3-base.patch
     2.9  aufs3-standalone.patch
    2.10  aufs3-loopback.patch
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/linux/stuff/linux-CVE-2013-2929.u	Thu Dec 19 11:38:24 2013 +0000
     3.3 @@ -0,0 +1,47 @@
     3.4 +https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=4004afd5f51ad0a86be405522b1ecf28ba66f4e5
     3.5 +--- linux-3.2.53/arch/ia64/include/asm/processor.h
     3.6 ++++ linux-3.2.53/arch/ia64/include/asm/processor.h
     3.7 +@@ -320,7 +320,7 @@
     3.8 + 	regs->loadrs = 0;									\
     3.9 + 	regs->r8 = get_dumpable(current->mm);	/* set "don't zap registers" flag */		\
    3.10 + 	regs->r12 = new_sp - 16;	/* allocate 16 byte scratch area */			\
    3.11 +-	if (unlikely(!get_dumpable(current->mm))) {							\
    3.12 ++	if (unlikely(get_dumpable(current->mm) != SUID_DUMP_USER)) {							\
    3.13 + 		/*										\
    3.14 + 		 * Zap scratch regs to avoid leaking bits between processes with different	\
    3.15 + 		 * uid/privileges.								\
    3.16 +--- linux-3.2.53/include/linux/binfmts.h
    3.17 ++++ linux-3.2.53/include/linux/binfmts.h
    3.18 +@@ -112,9 +112,6 @@
    3.19 + extern void would_dump(struct linux_binprm *, struct file *);
    3.20 + 
    3.21 + extern int suid_dumpable;
    3.22 +-#define SUID_DUMP_DISABLE	0	/* No setuid dumping */
    3.23 +-#define SUID_DUMP_USER		1	/* Dump as user of process */
    3.24 +-#define SUID_DUMP_ROOT		2	/* Dump as root */
    3.25 + 
    3.26 + /* Stack area protections */
    3.27 + #define EXSTACK_DEFAULT   0	/* Whatever the arch defaults to */
    3.28 +--- linux-3.2.53/include/linux/sched.h
    3.29 ++++ linux-3.2.53/include/linux/sched.h
    3.30 +@@ -402,6 +402,9 @@
    3.31 + 
    3.32 + extern void set_dumpable(struct mm_struct *mm, int value);
    3.33 + extern int get_dumpable(struct mm_struct *mm);
    3.34 ++#define SUID_DUMP_DISABLE	0	/* No setuid dumping */
    3.35 ++#define SUID_DUMP_USER		1	/* Dump as user of process */
    3.36 ++#define SUID_DUMP_ROOT		2	/* Dump as root */
    3.37 + 
    3.38 + /* mm flags */
    3.39 + /* dumpable bits */
    3.40 +--- linux-3.2.53/kernel/ptrace.c
    3.41 ++++ linux-3.2.53/kernel/ptrace.c
    3.42 +@@ -246,7 +246,7 @@
    3.43 + 	smp_rmb();
    3.44 + 	if (task->mm)
    3.45 + 		dumpable = get_dumpable(task->mm);
    3.46 +-	if (!dumpable && !task_ns_capable(task, CAP_SYS_PTRACE))
    3.47 ++	if (dumpable != SUID_DUMP_USER && !task_ns_capable(task, CAP_SYS_PTRACE))
    3.48 + 		return -EPERM;
    3.49 + 
    3.50 + 	return security_ptrace_access_check(task, mode);
     4.1 --- a/linux/stuff/linux-subroot.u2	Thu Dec 19 00:21:19 2013 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,61 +0,0 @@
     4.4 -Allow to boot on any directories in a filesystem. You will be able to :
     4.5 -- have several distributions in one partition
     4.6 -- use effectively the disk space between several distributions
     4.7 -- deduplicate files across several distributions
     4.8 -
     4.9 -The bad news : you can't remount /
    4.10 -
    4.11 -example: bzImage rw root=/dev/sda1:/var/os/slitaz-4.0 screen=1024x768x24
    4.12 -
    4.13 -Signed-off-by: Pascal Bellard <pascal.bellard@slitaz.org>
    4.14 ---- linux-3.2.40/Documentation/kernel-parameters.txt
    4.15 -+++ linux-3.2.40/Documentation/kernel-parameters.txt
    4.16 -@@ -2304,8 +2304,9 @@
    4.17 - 
    4.18 - 	ro		[KNL] Mount root device read-only on boot
    4.19 - 
    4.20 --	root=		[KNL] Root filesystem
    4.21 -+	root=		[KNL] Root filesystem and root directory
    4.22 - 			See name_to_dev_t comment in init/do_mounts.c.
    4.23 -+			Format: <root_filesystem>[:root_directory]
    4.24 - 
    4.25 - 	rootdelay=	[KNL] Delay (in seconds) to pause before attempting to
    4.26 - 			mount the root filesystem
    4.27 ---- linux-3.2.40/init/do_mounts.c
    4.28 -+++ linux-3.2.40/init/do_mounts.c
    4.29 -@@ -28,6 +28,7 @@
    4.30 - int root_mountflags = MS_RDONLY | MS_SILENT;
    4.31 - static char * __initdata root_device_name;
    4.32 - static char __initdata saved_root_name[64];
    4.33 -+static char __initdata saved_root_directory[256];
    4.34 - static int root_wait;
    4.35 - 
    4.36 - dev_t ROOT_DEV;
    4.37 -@@ -255,7 +256,20 @@
    4.38 - 
    4.39 - static int __init root_dev_setup(char *line)
    4.40 - {
    4.41 -+	char *s;
    4.42 -+
    4.43 -+	strcpy(saved_root_directory, ".");
    4.44 - 	strlcpy(saved_root_name, line, sizeof(saved_root_name));
    4.45 -+	s = strchr(saved_root_name, ':');
    4.46 -+	if (s) {
    4.47 -+		*s = '\0';
    4.48 -+		s = strchr(line, ':') + 1;
    4.49 -+		while (*s == '/')
    4.50 -+			s++;
    4.51 -+		if (*s)
    4.52 -+			strlcpy(saved_root_directory, s,
    4.53 -+				sizeof(saved_root_directory));
    4.54 -+	}
    4.55 - 	return 1;
    4.56 - }
    4.57 - 
    4.58 -@@ -554,5 +568,5 @@
    4.59 - out:
    4.60 - 	devtmpfs_mount("dev");
    4.61 - 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
    4.62 --	sys_chroot((const char __user __force *)".");
    4.63 -+	sys_chroot((const char __user __force *)saved_root_directory);
    4.64 - }