]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Apr 2012 19:01:37 +0000 (12:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Apr 2012 19:01:37 +0000 (12:01 -0700)
added patches:
mmc-atmel-mci-correct-data-timeout-computation.patch
modpost-fix-modpost-license-checking-of-vmlinux.o.patch
modpost-fix-modpost-s-license-checking-v3.patch
sysctl-fix-write-access-to-dmesg_restrict-kptr_restrict.patch

queue-3.0/mmc-atmel-mci-correct-data-timeout-computation.patch [new file with mode: 0644]
queue-3.0/modpost-fix-modpost-license-checking-of-vmlinux.o.patch [new file with mode: 0644]
queue-3.0/modpost-fix-modpost-s-license-checking-v3.patch [new file with mode: 0644]
queue-3.0/series
queue-3.0/sysctl-fix-write-access-to-dmesg_restrict-kptr_restrict.patch [new file with mode: 0644]

diff --git a/queue-3.0/mmc-atmel-mci-correct-data-timeout-computation.patch b/queue-3.0/mmc-atmel-mci-correct-data-timeout-computation.patch
new file mode 100644 (file)
index 0000000..f4df2ed
--- /dev/null
@@ -0,0 +1,40 @@
+From 66292ad92c6d3f2f1c137a1c826b331ca8595dfd Mon Sep 17 00:00:00 2001
+From: Ludovic Desroches <ludovic.desroches@atmel.com>
+Date: Wed, 28 Mar 2012 12:28:33 +0200
+Subject: mmc: atmel-mci: correct data timeout computation
+
+From: Ludovic Desroches <ludovic.desroches@atmel.com>
+
+commit 66292ad92c6d3f2f1c137a1c826b331ca8595dfd upstream.
+
+The HSMCI operates at a rate of up to Master Clock divided by two.
+Moreover previous calculation can cause overflows and so wrong
+timeouts.
+
+Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
+Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Chris Ball <cjb@laptop.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/host/atmel-mci.c |    9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/mmc/host/atmel-mci.c
++++ b/drivers/mmc/host/atmel-mci.c
+@@ -468,7 +468,14 @@ err:
+ static inline unsigned int ns_to_clocks(struct atmel_mci *host,
+                                       unsigned int ns)
+ {
+-      return (ns * (host->bus_hz / 1000000) + 999) / 1000;
++      /*
++       * It is easier here to use us instead of ns for the timeout,
++       * it prevents from overflows during calculation.
++       */
++      unsigned int us = DIV_ROUND_UP(ns, 1000);
++
++      /* Maximum clock frequency is host->bus_hz/2 */
++      return us * (DIV_ROUND_UP(host->bus_hz, 2000000));
+ }
+ static void atmci_set_timeout(struct atmel_mci *host,
diff --git a/queue-3.0/modpost-fix-modpost-license-checking-of-vmlinux.o.patch b/queue-3.0/modpost-fix-modpost-license-checking-of-vmlinux.o.patch
new file mode 100644 (file)
index 0000000..2d6b688
--- /dev/null
@@ -0,0 +1,70 @@
+From 258f742635360175564e9470eb060ff4d4b984e7 Mon Sep 17 00:00:00 2001
+From: Frank Rowand <frank.rowand@am.sony.com>
+Date: Mon, 9 Apr 2012 17:59:03 -0700
+Subject: modpost: Fix modpost license checking of vmlinux.o
+
+From: Frank Rowand <frank.rowand@am.sony.com>
+
+commit 258f742635360175564e9470eb060ff4d4b984e7 upstream.
+
+Commit f02e8a6596b7 ("module: Sort exported symbols") sorts symbols
+placing each of them in its own elf section.  This sorting and merging
+into the canonical sections are done by the linker.
+
+Unfortunately modpost to generate Module.symvers file parses vmlinux.o
+(which is not linked yet) and all modules object files (which aren't
+linked yet).  These aren't sanitized by the linker yet.  That breaks
+modpost that can't detect license properly for modules.
+
+This patch makes modpost aware of the new exported symbols structure.
+
+[ This above is a slightly corrected version of the explanation of the
+  problem, copied from commit 62a2635610db ("modpost: Fix modpost's
+  license checking V3").  That commit fixed the problem for module
+  object files, but not for vmlinux.o.  This patch fixes modpost for
+  vmlinux.o. ]
+
+Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
+Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ scripts/mod/modpost.c |    7 +++++--
+ scripts/mod/modpost.h |    1 +
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -132,8 +132,10 @@ static struct module *new_module(char *m
+       /* strip trailing .o */
+       s = strrchr(p, '.');
+       if (s != NULL)
+-              if (strcmp(s, ".o") == 0)
++              if (strcmp(s, ".o") == 0) {
+                       *s = '\0';
++                      mod->is_dot_o = 1;
++              }
+       /* add to list */
+       mod->name = p;
+@@ -587,7 +589,8 @@ static void handle_modversions(struct mo
+       unsigned int crc;
+       enum export export;
+-      if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0)
++      if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
++          strncmp(symname, "__ksymtab", 9) == 0)
+               export = export_from_secname(info, get_secindex(info, sym));
+       else
+               export = export_from_sec(info, get_secindex(info, sym));
+--- a/scripts/mod/modpost.h
++++ b/scripts/mod/modpost.h
+@@ -113,6 +113,7 @@ struct module {
+       int has_cleanup;
+       struct buffer dev_table_buf;
+       char         srcversion[25];
++      int is_dot_o;
+ };
+ struct elf_info {
diff --git a/queue-3.0/modpost-fix-modpost-s-license-checking-v3.patch b/queue-3.0/modpost-fix-modpost-s-license-checking-v3.patch
new file mode 100644 (file)
index 0000000..c702656
--- /dev/null
@@ -0,0 +1,76 @@
+From 62a2635610dbc83c5e8d724e00941eee4d18c186 Mon Sep 17 00:00:00 2001
+From: Alessio Igor Bogani <abogani@kernel.org>
+Date: Thu, 14 Jul 2011 08:51:16 +0200
+Subject: modpost: Fix modpost's license checking V3
+
+From: Alessio Igor Bogani <abogani@kernel.org>
+
+commit 62a2635610dbc83c5e8d724e00941eee4d18c186 upstream.
+
+The commit f02e8a6 sorts symbols placing each of them in its own elf section.
+The sorting and merging into the canonical sections are done by the linker.
+Unfortunately modpost to generate Module.symvers file parses vmlinux
+(already linked) and all modules object files (which aren't linked yet).
+These aren't sanitized by the linker yet. That breaks modpost that can't
+detect license properly for modules. This patch makes modpost aware of
+the new exported symbols structure.
+
+Thanks to Arnaud Lacombe <lacombar@gmail.com> and Anders Kaseorg
+<andersk@ksplice.com> for providing useful suggestions about code.
+
+This work was supported by a hardware donation from the CE Linux Forum.
+
+Reported-by: Jan Beulich <jbeulich@novell.com>
+Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
+Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ scripts/mod/modpost.c |   29 ++++++++++++++++++++++++++++-
+ 1 file changed, 28 insertions(+), 1 deletion(-)
+
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -254,6 +254,28 @@ static enum export export_no(const char
+       return export_unknown;
+ }
++static const char *sec_name(struct elf_info *elf, int secindex);
++
++#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
++
++static enum export export_from_secname(struct elf_info *elf, unsigned int sec)
++{
++      const char *secname = sec_name(elf, sec);
++
++      if (strstarts(secname, "___ksymtab+"))
++              return export_plain;
++      else if (strstarts(secname, "___ksymtab_unused+"))
++              return export_unused;
++      else if (strstarts(secname, "___ksymtab_gpl+"))
++              return export_gpl;
++      else if (strstarts(secname, "___ksymtab_unused_gpl+"))
++              return export_unused_gpl;
++      else if (strstarts(secname, "___ksymtab_gpl_future+"))
++              return export_gpl_future;
++      else
++              return export_unknown;
++}
++
+ static enum export export_from_sec(struct elf_info *elf, unsigned int sec)
+ {
+       if (sec == elf->export_sec)
+@@ -563,7 +585,12 @@ static void handle_modversions(struct mo
+                              Elf_Sym *sym, const char *symname)
+ {
+       unsigned int crc;
+-      enum export export = export_from_sec(info, get_secindex(info, sym));
++      enum export export;
++
++      if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0)
++              export = export_from_secname(info, get_secindex(info, sym));
++      else
++              export = export_from_sec(info, get_secindex(info, sym));
+       switch (sym->st_shndx) {
+       case SHN_COMMON:
index e44e01e6ef16c0399c1fcad2ea754980cd22d31f..99231da1688578098286e0c9dcd17db7c7a2258f 100644 (file)
@@ -24,3 +24,7 @@ kgdbts-fix-kernel-oops-with-config_debug_rodata.patch
 kgdbts-1-of-2-fix-single-step-awareness-to-work-correctly-with-smp.patch
 kgdbts-2-of-2-fix-single-step-awareness-to-work-correctly-with-smp.patch
 x86-kgdb-fix-debug_rodata-limitation-using-text_poke.patch
+mmc-atmel-mci-correct-data-timeout-computation.patch
+sysctl-fix-write-access-to-dmesg_restrict-kptr_restrict.patch
+modpost-fix-modpost-s-license-checking-v3.patch
+modpost-fix-modpost-license-checking-of-vmlinux.o.patch
diff --git a/queue-3.0/sysctl-fix-write-access-to-dmesg_restrict-kptr_restrict.patch b/queue-3.0/sysctl-fix-write-access-to-dmesg_restrict-kptr_restrict.patch
new file mode 100644 (file)
index 0000000..d47ec3e
--- /dev/null
@@ -0,0 +1,69 @@
+From 620f6e8e855d6d447688a5f67a4e176944a084e8 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Wed, 4 Apr 2012 11:40:19 -0700
+Subject: sysctl: fix write access to dmesg_restrict/kptr_restrict
+
+From: Kees Cook <keescook@chromium.org>
+
+commit 620f6e8e855d6d447688a5f67a4e176944a084e8 upstream.
+
+Commit bfdc0b4 adds code to restrict access to dmesg_restrict,
+however, it incorrectly alters kptr_restrict rather than
+dmesg_restrict.
+
+The original patch from Richard Weinberger
+(https://lkml.org/lkml/2011/3/14/362) alters dmesg_restrict as
+expected, and so the patch seems to have been misapplied.
+
+This adds the CAP_SYS_ADMIN check to both dmesg_restrict and
+kptr_restrict, since both are sensitive.
+
+Reported-by: Phillip Lougher <plougher@redhat.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
+Acked-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: James Morris <james.l.morris@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/sysctl.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/kernel/sysctl.c
++++ b/kernel/sysctl.c
+@@ -172,7 +172,7 @@ static int proc_taint(struct ctl_table *
+ #endif
+ #ifdef CONFIG_PRINTK
+-static int proc_dmesg_restrict(struct ctl_table *table, int write,
++static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
+                               void __user *buffer, size_t *lenp, loff_t *ppos);
+ #endif
+@@ -709,7 +709,7 @@ static struct ctl_table kern_table[] = {
+               .data           = &dmesg_restrict,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+-              .proc_handler   = proc_dointvec_minmax,
++              .proc_handler   = proc_dointvec_minmax_sysadmin,
+               .extra1         = &zero,
+               .extra2         = &one,
+       },
+@@ -718,7 +718,7 @@ static struct ctl_table kern_table[] = {
+               .data           = &kptr_restrict,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+-              .proc_handler   = proc_dmesg_restrict,
++              .proc_handler   = proc_dointvec_minmax_sysadmin,
+               .extra1         = &zero,
+               .extra2         = &two,
+       },
+@@ -2416,7 +2416,7 @@ static int proc_taint(struct ctl_table *
+ }
+ #ifdef CONFIG_PRINTK
+-static int proc_dmesg_restrict(struct ctl_table *table, int write,
++static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
+                               void __user *buffer, size_t *lenp, loff_t *ppos)
+ {
+       if (write && !capable(CAP_SYS_ADMIN))