<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.linux.kernel.cross-arch">
    <title>gmane.linux.kernel.cross-arch</title>
    <link>http://blog.gmane.org/gmane.linux.kernel.cross-arch</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14289"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14269"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14255"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14252"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14236"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14235"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14234"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14233"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14215"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14212"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14211"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14198"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14098"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14050"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14043"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14033"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13996"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13971"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13963"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13937"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14289">
    <title>Mostly portable strnlen_user()</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14289</link>
    <description>&lt;pre&gt;
Ok, so I'm going to merge the appended commit into mainline at some point 
here soon, and I thought maybe the BE people wanted to pipe up.

This does *not* use the generic "find zero" or "count bytes" logic that 
David used for strncpy_from_user(), because quite frankly, that one is 
suboptimal on x86 and causes conditionals and crap.

So it's not truly generic, but it's in lib/strnlen_user.c and under the 
CONFIG_GENERIC_STRNLEN_USER config option, because I'm convinced it should 
be possible to do something that does the right thing for everybody. 
Eventually.

But "the right thing" definitely involves arch-specific helpers for doing 
the byte counting, because it *is* going to occasionally be a popcount 
instruction or similar. And it *is* going to take advantage of the fact 
that things are sometimes simply easier on little-endian.

So this isn't truly generic, but without a BE machine I simply cannot care 
enough about the BE case. So I'm posting this as a heads-up before I 
actually merge it, to see.. Maybe the existing lib/strncpy_from_user.c 
could also be improved sufficiently that it would generate the fairly 
optimal code on x86 that our x86 code currently does.. I'll take a look at 
that at some point.

Comments? What's the appropriate *clean* interface to allow architectures 
to tweak the little details?

                      Linus
---
From: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
Date: Fri, 25 May 2012 15:02:46 -0700
Subject: [PATCH] lib: add a generic str[n]len_user() implementation, use it on x86

This is reasonably generic, but unlike the strncpy_from_user() function
it requires the bytemask counting functions from word-at-a-time.h that
only x86 does right now, and still does some things that only work on
little-endian.

With a bit of tweaking, the BE people could use it though, and unlike
the dcache hashing or the strncpy implementation, this has no issues
with architectures that require aligned accesses, since doing
pre-alignment is simple and thus worthwhile even on architectures that
do efficient aligned word accesses.

Signed-off-by: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
---
 arch/x86/Kconfig                  |   1 +
 arch/x86/include/asm/uaccess.h    |   4 ++
 arch/x86/include/asm/uaccess_32.h |  17 -----
 arch/x86/include/asm/uaccess_64.h |   3 -
 arch/x86/lib/usercopy.c           |   2 +-
 arch/x86/lib/usercopy_32.c        |  41 -----------
 arch/x86/lib/usercopy_64.c        |  48 -------------
 lib/Kconfig                       |   3 +
 lib/Makefile                      |   1 +
 lib/strnlen_user.c                | 143 ++++++++++++++++++++++++++++++++++++++
 10 files changed, 153 insertions(+), 110 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 81c3e8be789a..54bbfac5b91a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -93,6 +93,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; config X86
 select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 &amp;amp;&amp;amp; X86_LOCAL_APIC)
 select GENERIC_TIME_VSYSCALL if X86_64
 select KTIME_SCALAR if X86_32
+select GENERIC_STRNLEN_USER
 
 config INSTRUCTION_DECODER
 def_bool (KPROBES || PERF_EVENTS || UPROBES)
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 851fe0dc13bc..04cd6882308e 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -32,6 +32,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 #define segment_eq(a, b)((a).seg == (b).seg)
 
+#define user_addr_max() (current_thread_info()-&amp;gt;addr_limit.seg)
 #define __addr_ok(addr)\
 ((unsigned long __force)(addr) &amp;lt;\
  (current_thread_info()-&amp;gt;addr_limit.seg))
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -565,6 +566,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; copy_from_user_nmi(void *to, const void __user *from, unsigned long n);
 extern __must_check long
 strncpy_from_user(char *dst, const char __user *src, long count);
 
+extern __must_check long strlen_user(const char __user *str);
+extern __must_check long strnlen_user(const char __user *str, long n);
+
 /*
  * movsl can be slow when source and dest are not both 8-byte aligned
  */
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index 8084bc73b18c..576e39bca6ad 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -213,23 +213,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline unsigned long __must_check copy_from_user(void *to,
 return n;
 }
 
-/**
- * strlen_user: - Get the size of a string in user space.
- * &amp;lt; at &amp;gt;str: The string to measure.
- *
- * Context: User context only.  This function may sleep.
- *
- * Get the size of a NUL-terminated string in user space.
- *
- * Returns the size of the string INCLUDING the terminating NUL.
- * On exception, returns 0.
- *
- * If there is a limit on the length of a valid string, you may wish to
- * consider using strnlen_user() instead.
- */
-#define strlen_user(str) strnlen_user(str, LONG_MAX)
-
-long strnlen_user(const char __user *str, long n);
 unsigned long __must_check clear_user(void __user *mem, unsigned long len);
 unsigned long __must_check __clear_user(void __user *mem, unsigned long len);
 
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index fcd4b6f3ef02..8e796fbbf9c6 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -208,9 +208,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
 }
 }
 
-__must_check long strnlen_user(const char __user *str, long n);
-__must_check long __strnlen_user(const char __user *str, long n);
-__must_check long strlen_user(const char __user *str);
 __must_check unsigned long clear_user(void __user *mem, unsigned long len);
 __must_check unsigned long __clear_user(void __user *mem, unsigned long len);
 
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
index 2e4e4b02c37a..4239f063f6ac 100644
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -131,7 +131,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; strncpy_from_user(char *dst, const char __user *src, long count)
 if (unlikely(count &amp;lt;= 0))
 return 0;
 
-max_addr = current_thread_info()-&amp;gt;addr_limit.seg;
+max_addr = user_addr_max();
 src_addr = (unsigned long)src;
 if (likely(src_addr &amp;lt; max_addr)) {
 unsigned long max = max_addr - src_addr;
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index 883b216c60b2..1781b2f950e2 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -95,47 +95,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __clear_user(void __user *to, unsigned long n)
 }
 EXPORT_SYMBOL(__clear_user);
 
-/**
- * strnlen_user: - Get the size of a string in user space.
- * &amp;lt; at &amp;gt;s: The string to measure.
- * &amp;lt; at &amp;gt;n: The maximum valid length
- *
- * Get the size of a NUL-terminated string in user space.
- *
- * Returns the size of the string INCLUDING the terminating NUL.
- * On exception, returns 0.
- * If the string is too long, returns a value greater than &amp;lt; at &amp;gt;n.
- */
-long strnlen_user(const char __user *s, long n)
-{
-unsigned long mask = -__addr_ok(s);
-unsigned long res, tmp;
-
-might_fault();
-
-__asm__ __volatile__(
-"testl %0, %0\n"
-"jz 3f\n"
-"andl %0,%%ecx\n"
-"0:repne; scasb\n"
-"setne %%al\n"
-"subl %%ecx,%0\n"
-"addl %0,%%eax\n"
-"1:\n"
-".section .fixup,\"ax\"\n"
-"2:xorl %%eax,%%eax\n"
-"jmp 1b\n"
-"3:movb $1,%%al\n"
-"jmp 1b\n"
-".previous\n"
-_ASM_EXTABLE(0b,2b)
-:"=&amp;amp;r" (n), "=&amp;amp;D" (s), "=&amp;amp;a" (res), "=&amp;amp;c" (tmp)
-:"0" (n), "1" (s), "2" (0), "3" (mask)
-:"cc");
-return res &amp;amp; mask;
-}
-EXPORT_SYMBOL(strnlen_user);
-
 #ifdef CONFIG_X86_INTEL_USERCOPY
 static unsigned long
 __copy_user_intel(void __user *to, const void *from, unsigned long size)
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index 0d0326f388c0..e5b130bc2d0e 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -52,54 +52,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; unsigned long clear_user(void __user *to, unsigned long n)
 }
 EXPORT_SYMBOL(clear_user);
 
-/*
- * Return the size of a string (including the ending 0)
- *
- * Return 0 on exception, a value greater than N if too long
- */
-
-long __strnlen_user(const char __user *s, long n)
-{
-long res = 0;
-char c;
-
-while (1) {
-if (res&amp;gt;n)
-return n+1;
-if (__get_user(c, s))
-return 0;
-if (!c)
-return res+1;
-res++;
-s++;
-}
-}
-EXPORT_SYMBOL(__strnlen_user);
-
-long strnlen_user(const char __user *s, long n)
-{
-if (!access_ok(VERIFY_READ, s, 1))
-return 0;
-return __strnlen_user(s, n);
-}
-EXPORT_SYMBOL(strnlen_user);
-
-long strlen_user(const char __user *s)
-{
-long res = 0;
-char c;
-
-for (;;) {
-if (get_user(c, s))
-return 0;
-if (!c)
-return res+1;
-res++;
-s++;
-}
-}
-EXPORT_SYMBOL(strlen_user);
-
 unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len)
 {
 if (access_ok(VERIFY_WRITE, to, len) &amp;amp;&amp;amp; access_ok(VERIFY_READ, from, len)) { 
diff --git a/lib/Kconfig b/lib/Kconfig
index 98230ac3db29..64ddc44d0b81 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,6 +19,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; config RATIONAL
 config GENERIC_STRNCPY_FROM_USER
 bool
 
+config GENERIC_STRNLEN_USER
+bool
+
 config GENERIC_FIND_FIRST_BIT
 bool
 
diff --git a/lib/Makefile b/lib/Makefile
index b98df505f335..77937a7dd5ce 100644
--- a/lib/Makefile
+++ b/lib/Makefile
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -126,6 +126,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; obj-$(CONFIG_CLZ_TAB) += clz_tab.o
 obj-$(CONFIG_DDR) += jedec_ddr_data.o
 
 obj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) += strncpy_from_user.o
+obj-$(CONFIG_GENERIC_STRNLEN_USER) += strnlen_user.o
 
 hostprogs-y:= gen_crc32table
 clean-files:= crc32table.h
diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c
new file mode 100644
index 000000000000..3dc78a846b1a
--- /dev/null
+++ b/lib/strnlen_user.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,143 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
+#include &amp;lt;linux/export.h&amp;gt;
+#include &amp;lt;linux/uaccess.h&amp;gt;
+
+/*
+ * Currently this requires the word-at-a-time
+ * macros for the "generic" part.
+ */
+#include &amp;lt;asm/word-at-a-time.h&amp;gt;
+
+/* Set bits in the first 'n' bytes when loaded from memory */
+#ifdef __LITTLE_ENDIAN
+#  define aligned_byte_mask(n) ((1ul &amp;lt;&amp;lt; 8*(n))-1)
+#else
+#  define aligned_byte_mask(n) (~0xfful &amp;lt;&amp;lt; 8*(7-(n)))
+#endif
+
+/*
+ * Do a strnlen, return length of string *with* final '\0'.
+ * 'count' is the user-supplied count, while 'max' is the
+ * address space maximum.
+ *
+ * Return 0 for exceptions (which includes hitting the address
+ * space maximum), or 'count+1' if hitting the user-supplied
+ * maximum count.
+ *
+ * NOTE! We can sometimes overshoot the user-supplied maximum
+ * if it fits in a aligned 'long'. The caller needs to check
+ * the return value against "&amp;gt; max".
+ */
+static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)
+{
+long align, res = 0;
+unsigned long c;
+
+/*
+ * Truncate 'max' to the user-specified limit, so that
+ * we only have one limit we need to check in the loop
+ */
+if (max &amp;gt; count)
+max = count;
+
+/*
+ * Do everything aligned. But that means that we
+ * need to also expand the maximum..
+ */
+align = (sizeof(long) - 1) &amp;amp; (unsigned long)src;
+src -= align;
+max += align;
+
+if (unlikely(__get_user(c,(unsigned long __user *)src)))
+return 0;
+c |= aligned_byte_mask(align);
+
+for (;;) {
+unsigned long mask;
+
+mask = has_zero(c);
+if (mask) {
+mask = (mask - 1) &amp;amp; ~mask;
+mask &amp;gt;&amp;gt;= 7;
+return res + count_masked_bytes(mask) + 1 - align;
+}
+res += sizeof(unsigned long);
+if (unlikely(max &amp;lt; sizeof(unsigned long)))
+break;
+max -= sizeof(unsigned long);
+if (unlikely(__get_user(c,(unsigned long __user *)(src+res))))
+return 0;
+}
+res -= align;
+
+/*
+ * Uhhuh. We hit 'max'. But was that the user-specified maximum
+ * too? If so, return the marker for "too long".
+ */
+if (res &amp;gt;= count)
+return count+1;
+
+/*
+ * Nope: we hit the address space limit, and we still had more
+ * characters the caller would have wanted. That's 0.
+ */
+return 0;
+}
+
+/**
+ * strnlen_user: - Get the size of a user string INCLUDING final NUL.
+ * &amp;lt; at &amp;gt;str: The string to measure.
+ * &amp;lt; at &amp;gt;count: Maximum count (including NUL character)
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Get the size of a NUL-terminated string in user space.
+ *
+ * Returns the size of the string INCLUDING the terminating NUL.
+ * If the string is too long, returns 'count+1'.
+ * On exception (or invalid count), returns 0.
+ */
+long strnlen_user(const char __user *str, long count)
+{
+unsigned long max_addr, src_addr;
+
+if (unlikely(count &amp;lt;= 0))
+return 0;
+
+max_addr = user_addr_max();
+src_addr = (unsigned long)str;
+if (likely(src_addr &amp;lt; max_addr)) {
+unsigned long max = max_addr - src_addr;
+return do_strnlen_user(str, count, max);
+}
+return 0;
+}
+EXPORT_SYMBOL(strnlen_user);
+
+/**
+ * strlen_user: - Get the size of a user string INCLUDING final NUL.
+ * &amp;lt; at &amp;gt;str: The string to measure.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Get the size of a NUL-terminated string in user space.
+ *
+ * Returns the size of the string INCLUDING the terminating NUL.
+ * On exception, returns 0.
+ *
+ * If there is a limit on the length of a valid string, you may wish to
+ * consider using strnlen_user() instead.
+ */
+long strlen_user(const char __user *str)
+{
+unsigned long max_addr, src_addr;
+
+max_addr = user_addr_max();
+src_addr = (unsigned long)str;
+if (likely(src_addr &amp;lt; max_addr)) {
+unsigned long max = max_addr - src_addr;
+return do_strnlen_user(str, ~0ul, max);
+}
+return 0;
+}
+EXPORT_SYMBOL(strlen_user);
&lt;/pre&gt;</description>
    <dc:creator>Linus Torvalds</dc:creator>
    <dc:date>2012-05-25T22:35:38</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14269">
    <title>[PATCH 01/20] arm: Do not call do_signal() with irqs disabled</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14269</link>
    <description>&lt;pre&gt;get_signal_to_deliver() calls try_to_freeze() which might sleep.

Cc: Russell King &amp;lt;linux&amp;lt; at &amp;gt;arm.linux.org.uk&amp;gt;
Cc: linux-arm-kernel&amp;lt; at &amp;gt;lists.infradead.org
Signed-off-by: Richard Weinberger &amp;lt;richard&amp;lt; at &amp;gt;nod.at&amp;gt;
---
 arch/arm/kernel/signal.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 4e5fdd9..434a1f3 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -13,6 +13,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;linux/freezer.h&amp;gt;
 #include &amp;lt;linux/uaccess.h&amp;gt;
 #include &amp;lt;linux/tracehook.h&amp;gt;
+#include &amp;lt;linux/irqflags.h&amp;gt;
 
 #include &amp;lt;asm/elf.h&amp;gt;
 #include &amp;lt;asm/cacheflush.h&amp;gt;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -722,6 +723,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void do_signal(struct pt_regs *regs, int syscall)
 asmlinkage void
 do_notify_resume(struct pt_regs *regs, unsigned int thread_flags, int syscall)
 {
+local_irq_enable();
+
 if (thread_flags &amp;amp; _TIF_SIGPENDING)
 do_signal(regs, syscall);
 
&lt;/pre&gt;</description>
    <dc:creator>Richard Weinberger</dc:creator>
    <dc:date>2012-05-25T22:04:17</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14255">
    <title>[PATCH 1/1] openrisc: use generic strncpy_from_user</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14255</link>
    <description>&lt;pre&gt;
As per commits 2922585b93294d47172a765115e0dbc1bfe1be19
("lib: Sparc's strncpy_from_user is generic enough, move under lib/"),
92ae03f2ef99fbc23bfa9080d6b58f25227bd7ef ("x86: merge 32/64-bit versions
of 'strncpy_from_user()' and speed it up"), and corresponding
discussion on linux-arch.

Signed-off-by: Jonas Bonn &amp;lt;jonas&amp;lt; at &amp;gt;southpole.se&amp;gt;
---

Hi Linus,

Here's a single patch update to the OpenRISC arch to use the new
strncpy_from_user implementation.  Hope it's ok to send it as a
single patch and not as a pull request; let me know otherwise.

Thanks,
Jonas

 arch/openrisc/Kconfig               |    1 +
 arch/openrisc/include/asm/uaccess.h |   10 ++-----
 arch/openrisc/lib/string.S          |   52 -----------------------------------
 3 files changed, 4 insertions(+), 59 deletions(-)

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index da4ccd1..ee4d124 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -19,6 +19,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; config OPENRISC
 select GENERIC_CPU_DEVICES
 select GENERIC_ATOMIC64
 select GENERIC_CLOCKEVENTS
+select GENERIC_STRNCPY_FROM_USER
 
 config MMU
 def_bool y
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h
index f5abaa0..04b93de 100644
--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -313,14 +313,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; clear_user(void *addr, unsigned long size)
 return size;
 }
 
-extern int __strncpy_from_user(char *dst, const char *src, long count);
+#define user_addr_max() \
+(segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
 
-static inline long strncpy_from_user(char *dst, const char *src, long count)
-{
-if (access_ok(VERIFY_READ, src, 1))
-return __strncpy_from_user(dst, src, count);
-return -EFAULT;
-}
+extern long strncpy_from_user(char *dest, const char __user *src, long count);
 
 /*
  * Return the size of a string (including the ending 0)
diff --git a/arch/openrisc/lib/string.S b/arch/openrisc/lib/string.S
index 465f04b..8ceb11e 100644
--- a/arch/openrisc/lib/string.S
+++ b/arch/openrisc/lib/string.S
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -104,58 +104,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __clear_user:
 .long 9b, 99b// write fault
 .previous
 
-/*
- * long strncpy_from_user(char *dst, const char *src, long count)
- *
- *
- */
-.global__strncpy_from_user
-__strncpy_from_user:
-l.addi  r1,r1,-16
-l.sw    0(r1),r6
-l.sw    4(r1),r5
-l.sw    8(r1),r4
-l.sw    12(r1),r3
-
-l.addi  r11,r5,0
-2:  l.sfeq  r5,r0
-l.bf    1f
-l.addi  r5,r5,-1
-8:    l.lbz   r6,0(r4)
-l.sfeq  r6,r0
-l.bf    1f
-9:    l.sb    0(r3),r6
-l.addi  r3,r3,1
-l.j     2b
-l.addi  r4,r4,1
-1:
-l.lwz   r6,0(r1)
-l.addi  r5,r5,1
-l.sub   r11,r11,r5              // r11 holds the return value
-
-l.lwz   r6,0(r1)
-l.lwz   r5,4(r1)
-l.lwz   r4,8(r1)
-l.lwz   r3,12(r1)
-l.jr    r9
-l.addi  r1,r1,16
-
-.section .fixup, "ax"
-99:
-l.movhi r11,hi(-EFAULT)
-l.ori   r11,r11,lo(-EFAULT)
-
-l.lwz   r6,0(r1)
-l.lwz   r5,4(r1)
-l.lwz   r4,8(r1)
-l.lwz   r3,12(r1)
-l.jrr9
-l.addi  r1,r1,16
-.previous
-
-.section __ex_table, "a"
-.long 8b, 99b// read fault
-.previous
 
 /*
  * extern int __strnlen_user(const char *str, long len, unsigned long top);
&lt;/pre&gt;</description>
    <dc:creator>Jonas Bonn</dc:creator>
    <dc:date>2012-05-25T06:24:49</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14252">
    <title>[PATCH 2/3 v2] kernel: Move REPEAT_BYTE definition into linux/kernel.h</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14252</link>
    <description>&lt;pre&gt;
And make sure that everything using it explicitly includes
that header file.

Signed-off-by: David S. Miller &amp;lt;davem&amp;lt; at &amp;gt;davemloft.net&amp;gt;
---
 arch/sparc/lib/usercopy.c             |    3 +--
 arch/x86/include/asm/word-at-a-time.h |    4 ++--
 fs/namei.c                            |    1 +
 include/linux/kernel.h                |    2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
index f61ed82..0b12e91 100644
--- a/arch/sparc/lib/usercopy.c
+++ b/arch/sparc/lib/usercopy.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;linux/module.h&amp;gt;
 #include &amp;lt;linux/uaccess.h&amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
 #include &amp;lt;linux/errno.h&amp;gt;
 #include &amp;lt;linux/bug.h&amp;gt;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -11,8 +12,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void copy_from_user_overflow(void)
 }
 EXPORT_SYMBOL(copy_from_user_overflow);
 
-#define REPEAT_BYTE(x)((~0ul / 0xff) * (x))
-
 static inline long find_zero(unsigned long mask)
 {
 long byte = 0;
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h
index e58f03b..ae03fac 100644
--- a/arch/x86/include/asm/word-at-a-time.h
+++ b/arch/x86/include/asm/word-at-a-time.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,6 +1,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #ifndef _ASM_WORD_AT_A_TIME_H
 #define _ASM_WORD_AT_A_TIME_H
 
+#include &amp;lt;linux/kernel.h&amp;gt;
+
 /*
  * This is largely generic for little-endian machines, but the
  * optimal byte mask counting is probably going to be something
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -35,8 +37,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline long count_masked_bytes(long mask)
 
 #endif
 
-#define REPEAT_BYTE(x)((~0ul / 0xff) * (x))
-
 /* Return the high bit set in the first byte that is a zero */
 static inline unsigned long has_zero(unsigned long a)
 {
diff --git a/fs/namei.c b/fs/namei.c
index f9e883c..8d2ba42 100644
--- a/fs/namei.c
+++ b/fs/namei.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -16,6 +16,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 #include &amp;lt;linux/init.h&amp;gt;
 #include &amp;lt;linux/export.h&amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
 #include &amp;lt;linux/slab.h&amp;gt;
 #include &amp;lt;linux/fs.h&amp;gt;
 #include &amp;lt;linux/namei.h&amp;gt;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 645231c..fbe9bfa 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -38,6 +38,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 #define STACK_MAGIC0xdeadbeef
 
+#define REPEAT_BYTE(x)((~0ul / 0xff) * (x))
+
 #define ALIGN(x, a)__ALIGN_KERNEL((x), (a))
 #define __ALIGN_MASK(x, mask)__ALIGN_KERNEL_MASK((x), (mask))
 #define PTR_ALIGN(p, a)((typeof(p))ALIGN((unsigned long)(p), (a)))
&lt;/pre&gt;</description>
    <dc:creator>David Miller</dc:creator>
    <dc:date>2012-05-24T20:26:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14236">
    <title>[PATCH 3/3] lib: Sparc's strncpy_from_user is generic enough, move under lib/</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14236</link>
    <description>&lt;pre&gt;
To use this, an architecture simply needs to:

1) Provide a user_addr_max() implementation via asm/uaccess.h

2) Add "select GENERIC_STRNCPY_FROM_USER" to their arch Kcnfig

3) Remove the existing strncpy_from_user() implementation and symbol
   exports their architecture had.

Signed-off-by: David S. Miller &amp;lt;davem&amp;lt; at &amp;gt;davemloft.net&amp;gt;
---
 arch/sparc/Kconfig        |    1 +
 arch/sparc/lib/usercopy.c |  138 --------------------------------------------
 lib/Kconfig               |    3 +
 lib/Makefile              |    2 +
 lib/strncpy_from_user.c   |  140 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 146 insertions(+), 138 deletions(-)
 create mode 100644 lib/strncpy_from_user.c

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 051af37..2247423 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -32,6 +32,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; config SPARC
 select HAVE_NMI_WATCHDOG if SPARC64
 select HAVE_BPF_JIT
 select GENERIC_SMP_IDLE_THREAD
+select GENERIC_STRNCPY_FROM_USER
 
 config SPARC32
 def_bool !64BIT
diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
index 3d3bef9..5c4284c 100644
--- a/arch/sparc/lib/usercopy.c
+++ b/arch/sparc/lib/usercopy.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,147 +1,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;linux/module.h&amp;gt;
-#include &amp;lt;linux/uaccess.h&amp;gt;
 #include &amp;lt;linux/kernel.h&amp;gt;
-#include &amp;lt;linux/errno.h&amp;gt;
 #include &amp;lt;linux/bug.h&amp;gt;
 
-#include &amp;lt;asm/byteorder.h&amp;gt;
-
 void copy_from_user_overflow(void)
 {
 WARN(1, "Buffer overflow detected!\n");
 }
 EXPORT_SYMBOL(copy_from_user_overflow);
-
-static inline long find_zero(unsigned long mask)
-{
-long byte = 0;
-
-#ifdef __BIG_ENDIAN
-#ifdef CONFIG_64BIT
-if (mask &amp;gt;&amp;gt; 32)
-mask &amp;gt;&amp;gt;= 32;
-else
-byte = 4;
-#endif
-if (mask &amp;gt;&amp;gt; 16)
-mask &amp;gt;&amp;gt;= 16;
-else
-byte += 2;
-return (mask &amp;gt;&amp;gt; 8) ? byte : byte + 1;
-#else
-#ifdef CONFIG_64BIT
-if (!((unsigned int) mask)) {
-mask &amp;gt;&amp;gt;= 32;
-byte = 4;
-}
-#endif
-if (!(mask &amp;amp; 0xffff)) {
-mask &amp;gt;&amp;gt;= 16;
-byte += 2;
-}
-return (mask &amp;amp; 0xff) ? byte : byte + 1;
-#endif
-}
-
-/*
- * Do a strncpy, return length of string without final '\0'.
- * 'count' is the user-supplied count (return 'count' if we
- * hit it), 'max' is the address space maximum (and we return
- * -EFAULT if we hit it).
- */
-static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max)
-{
-const unsigned long high_bits = REPEAT_BYTE(0xfe) + 1;
-const unsigned long low_bits = REPEAT_BYTE(0x7f);
-long res = 0;
-
-/*
- * Truncate 'max' to the user-specified limit, so that
- * we only have one limit we need to check in the loop
- */
-if (max &amp;gt; count)
-max = count;
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-if (((long) dst | (long) src) &amp;amp; (sizeof(long) - 1))
-goto byte_at_a_time;
-#endif
-while (max &amp;gt;= sizeof(unsigned long)) {
-unsigned long c, v, rhs;
-
-/* Fall back to byte-at-a-time if we get a page fault */
-if (unlikely(__get_user(c,(unsigned long __user *)(src+res))))
-break;
-rhs = c | low_bits;
-v = (c + high_bits) &amp;amp; ~rhs;
-*(unsigned long *)(dst+res) = c;
-if (v) {
-v = (c &amp;amp; low_bits) + low_bits;;
-v = ~(v | rhs);
-return res + find_zero(v);
-}
-res += sizeof(unsigned long);
-max -= sizeof(unsigned long);
-}
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-byte_at_a_time:
-#endif
-while (max) {
-char c;
-
-if (unlikely(__get_user(c,src+res)))
-return -EFAULT;
-dst[res] = c;
-if (!c)
-return res;
-res++;
-max--;
-}
-
-/*
- * Uhhuh. We hit 'max'. But was that the user-specified maximum
- * too? If so, that's ok - we got as much as the user asked for.
- */
-if (res &amp;gt;= count)
-return res;
-
-/*
- * Nope: we hit the address space limit, and we still had more
- * characters the caller would have wanted. That's an EFAULT.
- */
-return -EFAULT;
-}
-
-/**
- * strncpy_from_user: - Copy a NUL terminated string from userspace.
- * &amp;lt; at &amp;gt;dst:   Destination address, in kernel space.  This buffer must be at
- *         least &amp;lt; at &amp;gt;count bytes long.
- * &amp;lt; at &amp;gt;src:   Source address, in user space.
- * &amp;lt; at &amp;gt;count: Maximum number of bytes to copy, including the trailing NUL.
- *
- * Copies a NUL-terminated string from userspace to kernel space.
- *
- * On success, returns the length of the string (not including the trailing
- * NUL).
- *
- * If access to userspace fails, returns -EFAULT (some data may have been
- * copied).
- *
- * If &amp;lt; at &amp;gt;count is smaller than the length of the string, copies &amp;lt; at &amp;gt;count bytes
- * and returns &amp;lt; at &amp;gt;count.
- */
-long strncpy_from_user(char *dst, const char __user *src, long count)
-{
-unsigned long max_addr, src_addr;
-
-if (unlikely(count &amp;lt;= 0))
-return 0;
-
-max_addr = user_addr_max();
-src_addr = (unsigned long)src;
-if (likely(src_addr &amp;lt; max_addr)) {
-unsigned long max = max_addr - src_addr;
-return do_strncpy_from_user(dst, src, count, max);
-}
-return -EFAULT;
-}
-EXPORT_SYMBOL(strncpy_from_user);
diff --git a/lib/Kconfig b/lib/Kconfig
index 4a8aba2..49cb463 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -16,6 +16,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; config BITREVERSE
 config RATIONAL
 boolean
 
+config GENERIC_STRNCPY_FROM_USER
+bool
+
 config GENERIC_FIND_FIRST_BIT
 bool
 
diff --git a/lib/Makefile b/lib/Makefile
index 18515f0..57538b4 100644
--- a/lib/Makefile
+++ b/lib/Makefile
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -123,6 +123,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; obj-$(CONFIG_SIGNATURE) += digsig.o
 
 obj-$(CONFIG_CLZ_TAB) += clz_tab.o
 
+obj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) += strncpy_from_user.o
+
 hostprogs-y:= gen_crc32table
 clean-files:= crc32table.h
 
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
new file mode 100644
index 0000000..278de4a
--- /dev/null
+++ b/lib/strncpy_from_user.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,140 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#include &amp;lt;linux/module.h&amp;gt;
+#include &amp;lt;linux/uaccess.h&amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
+#include &amp;lt;linux/errno.h&amp;gt;
+
+#include &amp;lt;asm/byteorder.h&amp;gt;
+
+static inline long find_zero(unsigned long mask)
+{
+long byte = 0;
+
+#ifdef __BIG_ENDIAN
+#ifdef CONFIG_64BIT
+if (mask &amp;gt;&amp;gt; 32)
+mask &amp;gt;&amp;gt;= 32;
+else
+byte = 4;
+#endif
+if (mask &amp;gt;&amp;gt; 16)
+mask &amp;gt;&amp;gt;= 16;
+else
+byte += 2;
+return (mask &amp;gt;&amp;gt; 8) ? byte : byte + 1;
+#else
+#ifdef CONFIG_64BIT
+if (!((unsigned int) mask)) {
+mask &amp;gt;&amp;gt;= 32;
+byte = 4;
+}
+#endif
+if (!(mask &amp;amp; 0xffff)) {
+mask &amp;gt;&amp;gt;= 16;
+byte += 2;
+}
+return (mask &amp;amp; 0xff) ? byte : byte + 1;
+#endif
+}
+
+/*
+ * Do a strncpy, return length of string without final '\0'.
+ * 'count' is the user-supplied count (return 'count' if we
+ * hit it), 'max' is the address space maximum (and we return
+ * -EFAULT if we hit it).
+ */
+static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max)
+{
+const unsigned long high_bits = REPEAT_BYTE(0xfe) + 1;
+const unsigned long low_bits = REPEAT_BYTE(0x7f);
+long res = 0;
+
+/*
+ * Truncate 'max' to the user-specified limit, so that
+ * we only have one limit we need to check in the loop
+ */
+if (max &amp;gt; count)
+max = count;
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+if (((long) dst | (long) src) &amp;amp; (sizeof(long) - 1))
+goto byte_at_a_time;
+#endif
+while (max &amp;gt;= sizeof(unsigned long)) {
+unsigned long c, v, rhs;
+
+/* Fall back to byte-at-a-time if we get a page fault */
+if (unlikely(__get_user(c,(unsigned long __user *)(src+res))))
+break;
+rhs = c | low_bits;
+v = (c + high_bits) &amp;amp; ~rhs;
+*(unsigned long *)(dst+res) = c;
+if (v) {
+v = (c &amp;amp; low_bits) + low_bits;;
+v = ~(v | rhs);
+return res + find_zero(v);
+}
+res += sizeof(unsigned long);
+max -= sizeof(unsigned long);
+}
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+byte_at_a_time:
+#endif
+while (max) {
+char c;
+
+if (unlikely(__get_user(c,src+res)))
+return -EFAULT;
+dst[res] = c;
+if (!c)
+return res;
+res++;
+max--;
+}
+
+/*
+ * Uhhuh. We hit 'max'. But was that the user-specified maximum
+ * too? If so, that's ok - we got as much as the user asked for.
+ */
+if (res &amp;gt;= count)
+return res;
+
+/*
+ * Nope: we hit the address space limit, and we still had more
+ * characters the caller would have wanted. That's an EFAULT.
+ */
+return -EFAULT;
+}
+
+/**
+ * strncpy_from_user: - Copy a NUL terminated string from userspace.
+ * &amp;lt; at &amp;gt;dst:   Destination address, in kernel space.  This buffer must be at
+ *         least &amp;lt; at &amp;gt;count bytes long.
+ * &amp;lt; at &amp;gt;src:   Source address, in user space.
+ * &amp;lt; at &amp;gt;count: Maximum number of bytes to copy, including the trailing NUL.
+ *
+ * Copies a NUL-terminated string from userspace to kernel space.
+ *
+ * On success, returns the length of the string (not including the trailing
+ * NUL).
+ *
+ * If access to userspace fails, returns -EFAULT (some data may have been
+ * copied).
+ *
+ * If &amp;lt; at &amp;gt;count is smaller than the length of the string, copies &amp;lt; at &amp;gt;count bytes
+ * and returns &amp;lt; at &amp;gt;count.
+ */
+long strncpy_from_user(char *dst, const char __user *src, long count)
+{
+unsigned long max_addr, src_addr;
+
+if (unlikely(count &amp;lt;= 0))
+return 0;
+
+max_addr = user_addr_max();
+src_addr = (unsigned long)src;
+if (likely(src_addr &amp;lt; max_addr)) {
+unsigned long max = max_addr - src_addr;
+return do_strncpy_from_user(dst, src, count, max);
+}
+return -EFAULT;
+}
+EXPORT_SYMBOL(strncpy_from_user);
&lt;/pre&gt;</description>
    <dc:creator>David Miller</dc:creator>
    <dc:date>2012-05-24T03:34:40</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14235">
    <title>[PATCH 1/3] sparc: Increase portability of strncpy_from_user() implementation.</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14235</link>
    <description>&lt;pre&gt;
Hide details of maximum user address calculation in a new
asm/uaccess.h interface named user_addr_max().

Provide little-endian implementation in find_zero(), which should work
but can probably be improved.

Guard alignment check using CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.

Signed-off-by: David S. Miller &amp;lt;davem&amp;lt; at &amp;gt;davemloft.net&amp;gt;
---
 arch/sparc/include/asm/uaccess.h |    3 +++
 arch/sparc/lib/usercopy.c        |   28 ++++++++++++++++++++++------
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h
index 42a28cf..20c2acb 100644
--- a/arch/sparc/include/asm/uaccess.h
+++ b/arch/sparc/include/asm/uaccess.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -6,6 +6,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;asm/uaccess_32.h&amp;gt;
 #endif
 
+#define user_addr_max() \
+(segment_eq(get_fs(), USER_DS) ? STACK_TOP : ~0UL)
+
 extern long strncpy_from_user(char *dest, const char __user *src, long count);
 
 #endif
diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
index 87f9645..9ba59ef 100644
--- a/arch/sparc/lib/usercopy.c
+++ b/arch/sparc/lib/usercopy.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3,6 +3,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;linux/errno.h&amp;gt;
 #include &amp;lt;linux/bug.h&amp;gt;
 
+#include &amp;lt;asm/byteorder.h&amp;gt;
+
 void copy_from_user_overflow(void)
 {
 WARN(1, "Buffer overflow detected!\n");
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -14,6 +16,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; EXPORT_SYMBOL(copy_from_user_overflow);
 static inline long find_zero(unsigned long mask)
 {
 long byte = 0;
+
+#ifdef __BIG_ENDIAN
 #ifdef CONFIG_64BIT
 if (mask &amp;gt;&amp;gt; 32)
 mask &amp;gt;&amp;gt;= 32;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -25,6 +29,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline long find_zero(unsigned long mask)
 else
 byte += 2;
 return (mask &amp;gt;&amp;gt; 8) ? byte : byte + 1;
+#else
+#ifdef CONFIG_64BIT
+if (!((unsigned int) mask)) {
+mask &amp;gt;&amp;gt;= 32;
+byte = 4;
+}
+#endif
+if (!(mask &amp;amp; 0xffff)) {
+mask &amp;gt;&amp;gt;= 16;
+byte += 2;
+}
+return (mask &amp;amp; 0xff) ? byte : byte + 1;
+#endif
 }
 
 /*
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -45,10 +62,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline long do_strncpy_from_user(char *dst, const char __user *src, long
  */
 if (max &amp;gt; count)
 max = count;
-
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 if (((long) dst | (long) src) &amp;amp; (sizeof(long) - 1))
 goto byte_at_a_time;
-
+#endif
 while (max &amp;gt;= sizeof(unsigned long)) {
 unsigned long c, v, rhs;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -66,8 +83,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline long do_strncpy_from_user(char *dst, const char __user *src, long
 res += sizeof(unsigned long);
 max -= sizeof(unsigned long);
 }
-
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 byte_at_a_time:
+#endif
 while (max) {
 char c;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -119,9 +137,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; long strncpy_from_user(char *dst, const char __user *src, long count)
 if (unlikely(count &amp;lt;= 0))
 return 0;
 
-max_addr = ~0UL;
-if (likely(segment_eq(get_fs(), USER_DS)))
-max_addr = STACK_TOP;
+max_addr = user_addr_max();
 src_addr = (unsigned long)src;
 if (likely(src_addr &amp;lt; max_addr)) {
 unsigned long max = max_addr - src_addr;
&lt;/pre&gt;</description>
    <dc:creator>David Miller</dc:creator>
    <dc:date>2012-05-24T03:34:30</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14234">
    <title>[PATCH 2/3] kernel: Move REPEAT_BYTE definition into linux/kernel.h</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14234</link>
    <description>&lt;pre&gt;
And make sure that everything using it explicitly includes
that header file.

Signed-off-by: David S. Miller &amp;lt;davem&amp;lt; at &amp;gt;davemloft.net&amp;gt;
---
 arch/sparc/lib/usercopy.c             |    3 +--
 arch/x86/include/asm/word-at-a-time.h |    4 ++--
 fs/namei.c                            |    1 +
 include/linux/kernel.h                |    2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
index 9ba59ef..3d3bef9 100644
--- a/arch/sparc/lib/usercopy.c
+++ b/arch/sparc/lib/usercopy.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;linux/module.h&amp;gt;
 #include &amp;lt;linux/uaccess.h&amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
 #include &amp;lt;linux/errno.h&amp;gt;
 #include &amp;lt;linux/bug.h&amp;gt;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -11,8 +12,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void copy_from_user_overflow(void)
 }
 EXPORT_SYMBOL(copy_from_user_overflow);
 
-#define REPEAT_BYTE(x)((~0ul / 0xff) * (x))
-
 static inline long find_zero(unsigned long mask)
 {
 long byte = 0;
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h
index e58f03b..ae03fac 100644
--- a/arch/x86/include/asm/word-at-a-time.h
+++ b/arch/x86/include/asm/word-at-a-time.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,6 +1,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #ifndef _ASM_WORD_AT_A_TIME_H
 #define _ASM_WORD_AT_A_TIME_H
 
+#include &amp;lt;linux/kernel.h&amp;gt;
+
 /*
  * This is largely generic for little-endian machines, but the
  * optimal byte mask counting is probably going to be something
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -35,8 +37,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline long count_masked_bytes(long mask)
 
 #endif
 
-#define REPEAT_BYTE(x)((~0ul / 0xff) * (x))
-
 /* Return the high bit set in the first byte that is a zero */
 static inline unsigned long has_zero(unsigned long a)
 {
diff --git a/fs/namei.c b/fs/namei.c
index f9e883c..8d2ba42 100644
--- a/fs/namei.c
+++ b/fs/namei.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -16,6 +16,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 #include &amp;lt;linux/init.h&amp;gt;
 #include &amp;lt;linux/export.h&amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
 #include &amp;lt;linux/slab.h&amp;gt;
 #include &amp;lt;linux/fs.h&amp;gt;
 #include &amp;lt;linux/namei.h&amp;gt;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 645231c..fbe9bfa 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -38,6 +38,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 #define STACK_MAGIC0xdeadbeef
 
+#define REPEAT_BYTE(x)((~0ul / 0xff) * (x))
+
 #define ALIGN(x, a)__ALIGN_KERNEL((x), (a))
 #define __ALIGN_MASK(x, mask)__ALIGN_KERNEL_MASK((x), (mask))
 #define PTR_ALIGN(p, a)((typeof(p))ALIGN((unsigned long)(p), (a)))
&lt;/pre&gt;</description>
    <dc:creator>David Miller</dc:creator>
    <dc:date>2012-05-24T03:34:35</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14233">
    <title>[PATCH 0/3] Make sparc's strncpy_from_user() generic.</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14233</link>
    <description>&lt;pre&gt;
Ok, this is against my current sparc GIT tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git

After these changes it should definitely be usable by any
architecture.

If there are no major objections I can push this out to my sparc tree
and ask Linus to pull all of this work in.

Afterwards we can tweak it to use the x86 word-at-a-time tricks if we
want.

Thanks.
&lt;/pre&gt;</description>
    <dc:creator>David Miller</dc:creator>
    <dc:date>2012-05-24T03:34:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14215">
    <title>[git pull] signals, the first series</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14215</link>
    <description>&lt;pre&gt;This is just the first part of the queue (about a half of it);
assorted fixes all over the place in signals' handling.  This one ends
with all sigsuspend() implementations switched to generic one
(-&amp;gt;saved_sigmask-based), a bunch of assorted old buglets fixed and most
of the missing bits of NOTIFY_RESUME hookup in place (two more sit in
arm and um trees resp. and there's a couple of broken ones that need
obvious fixes - parisc and avr32 check TIF_NOTIFY_RESUME only on one of
two codepaths; that'll go in the next series).  Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal.git for-linus

Shortlog:
Al Viro (35):
      new helper: sigsuspend()
      parisc: resetting -&amp;gt;restart_block.fn needs to be done on rt_sigreturn()
      c6x: -&amp;gt;restart_block.fn needs to be reset on rt_sigreturn
      hexagon: -&amp;gt;restart_block.fn needs to be reset on rt_sigreturn
      microblaze: -&amp;gt;restart_block.fn needs to be reset on rt_sigreturn
      score: -&amp;gt;restart_block.fn needs to be reset on rt_sigreturn
      xtensa: -&amp;gt;restart_block.fn needs to be reset on rt_sigreturn
      avr32: -&amp;gt;restart_block.fn needs to be reset on rt_sigreturn
      xtensa: switch to generic rt_sigsuspend(2)
      sh: switch to saved_sigmask-based sigsuspend()/rt_sigsuspend()
      h8300: don't change blocked signals' mask if setting frame up fails
      h8300: switch to saved_sigmask-based sigsuspend/rt_sigsuspend
      cris: SA_ONESHOT handling is done by get_signal_to_deliver()
      microblaze: bury sys_rt_sigsuspend_wrapper in nommu case too
      avr32: need to clear RESTORE_SIGMASK on successful signal delivery
      blackfin: don't open-code force_sigsegv()
      cris: don't open-code force_sigsegv()
      score: don't open-code force_sigsegv()
      alpha: tidy signal delivery up
      xtensa: xtensa_sigaction doesn't exist
      m32r: struct old_sigaction is never used
      avr32: struct old_sigaction is never used
      sparc: missing checks of __get_user()/__put_user() return values
      sh: missing checks of __get_user()/__put_user() return values
      powerpc: missing checks of __get_user()/__put_user() return values
      cris: missing checks of __get_user()/__put_user() return values
      frv: missing checks of __get_user()/__put_user() return values
      h8300: missing checks of __get_user()/__put_user() return values
      sparc: kill ancient comment in sparc_sigaction()
      m68k: add TIF_NOTIFY_RESUME and handle it.
      score: add handling of NOTIFY_RESUME to do_notify_resume()
      microblaze: handle TIF_NOTIFY_RESUME
      microblaze: drop 'oldset' argument of do_notify_resume()
      xtensa: add handling of TIF_NOTIFY_RESUME
      unicore32: if there's no handler we need to restore sigmask, syscall or no syscall

Matt Fleming (18):
      parisc: use set_current_blocked() and block_sigmask()
      frv: use set_current_blocked() and block_sigmask()
      blackfin: use set_current_blocked() and block_sigmask()
      unicore32: use block_sigmask()
      h8300: use set_current_blocked() and block_sigmask()
      score: don't mask signals if we fail to setup signal stack
      score: use set_current_blocked() and block_sigmask()
      microblaze: don't reimplement force_sigsegv()
      microblaze: no need to reset handler if SA_ONESHOT
      microblaze: fix signal masking
      microblaze: use set_current_blocked() and block_sigmask()
      ia64: use set_current_blocked() and block_sigmask()
      cris: use set_current_blocked() and block_sigmask()
      mn10300: use set_current_blocked() and block_sigmask()
      m32r: use set_current_blocked() and block_sigmask()
      avr32: don't mask signals in the error path
      avr32: use block_sigmask()
      m68k: use set_current_blocked() and block_sigmask()

Oleg Nesterov (2):
      avr32: use set_current_blocked() in handle_signal/sys_rt_sigreturn
      hexagon: do_notify_resume() needs tracehook_notify_resume()

Diffstat:
 arch/alpha/kernel/signal.c            |   80 +++++++--------------
 arch/arm/kernel/signal.c              |   11 +---
 arch/avr32/include/asm/signal.h       |    7 --
 arch/avr32/kernel/signal.c            |   30 +++-----
 arch/blackfin/kernel/signal.c         |   21 ++----
 arch/c6x/kernel/signal.c              |    3 +
 arch/cris/arch-v10/kernel/signal.c    |   50 ++++---------
 arch/cris/arch-v32/kernel/signal.c    |   66 ++++-------------
 arch/frv/kernel/signal.c              |   47 ++++---------
 arch/h8300/include/asm/unistd.h       |    1 +
 arch/h8300/kernel/signal.c            |  122 +++++++++++----------------------
 arch/h8300/kernel/syscalls.S          |    6 --
 arch/hexagon/kernel/signal.c          |    4 +
 arch/ia64/kernel/signal.c             |   15 +----
 arch/m32r/include/asm/signal.h        |    7 --
 arch/m32r/kernel/signal.c             |   12 +---
 arch/m68k/include/asm/thread_info.h   |    1 +
 arch/m68k/kernel/entry_mm.S           |    6 +-
 arch/m68k/kernel/signal.c             |   41 ++++++------
 arch/m68k/platform/68328/entry.S      |    2 +-
 arch/m68k/platform/68360/entry.S      |    2 +-
 arch/m68k/platform/coldfire/entry.S   |    2 +-
 arch/microblaze/kernel/entry-nommu.S  |   20 ++----
 arch/microblaze/kernel/entry.S        |   30 ++++-----
 arch/microblaze/kernel/signal.c       |   85 ++++++++++++-----------
 arch/mips/kernel/signal.c             |   20 +-----
 arch/mips/kernel/signal32.c           |   20 +-----
 arch/mips/kernel/signal_n32.c         |   10 +---
 arch/mn10300/kernel/signal.c          |   35 ++--------
 arch/parisc/kernel/signal.c           |   15 +---
 arch/powerpc/kernel/signal_32.c       |   17 +----
 arch/s390/kernel/signal.c             |    9 +--
 arch/score/kernel/signal.c            |   29 ++++----
 arch/sh/include/asm/syscalls_32.h     |    4 +-
 arch/sh/include/asm/unistd.h          |    4 +-
 arch/sh/kernel/signal_32.c            |   53 ++++++--------
 arch/sh/kernel/signal_64.c            |   84 ++++------------------
 arch/sparc/kernel/signal32.c          |   10 ++-
 arch/sparc/kernel/signal_32.c         |   12 +---
 arch/sparc/kernel/signal_64.c         |   13 +---
 arch/sparc/kernel/sys_sparc_32.c      |   17 ++---
 arch/um/kernel/signal.c               |    9 +--
 arch/unicore32/kernel/signal.c        |   18 ++---
 arch/x86/ia32/ia32_signal.c           |   12 +---
 arch/x86/kernel/signal.c              |   12 +---
 arch/xtensa/include/asm/signal.h      |    7 --
 arch/xtensa/include/asm/syscall.h     |    4 -
 arch/xtensa/include/asm/thread_info.h |    1 +
 arch/xtensa/include/asm/unistd.h      |    2 +-
 arch/xtensa/kernel/entry.S            |    6 +-
 arch/xtensa/kernel/signal.c           |   73 +++++++++-----------
 include/linux/signal.h                |    1 +
 kernel/compat.c                       |   10 +---
 kernel/signal.c                       |   25 ++++---
 54 files changed, 386 insertions(+), 817 deletions(-)
&lt;/pre&gt;</description>
    <dc:creator>Al Viro</dc:creator>
    <dc:date>2012-05-22T04:35:25</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14212">
    <title>Arch maintainers Ahoy! (was Re: x86: faster strncpy_from_user())</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14212</link>
    <description>&lt;pre&gt;Ok, several weeks ago I sent out an email about the x86
strncpy_from_user() patch I did, and cc'd linux-arch because the
second stage might well affect other architectures.

Nobody reacted to it, and today that second stage was merged into
mainline, so I thought I'd re-do the notice. The relevant part of the
original explanation is appended, but I'll explain once more..

On x86, we *used* to be very lazy about strncpy_from_user(), and not
actually do the full proper error handling: the code was (for
historical reasons) using inline asms where it was very inconvenient
to actually check the proper end of the address space. And nobody had
really ever bothered to fix it up. As a result, the main user
(getname()) had its own special magic workarounds for this.

Until 3.4. We now do strncpy_from_user() properly, with all the
appropriate error cases of hitting the end of the user address space
etc handled.

And now that the 3.5 merge window is open, some of the first merging I
did was my own branches that had been pending. Including the one that
removes all the hackery from getname(), and expects
strncpy_from_user() to just work right.

If any architecture copied the lazy x86 strncpy_from_user(), they
really do need to fix themselves now. You can actually take the new
all-C x86 implementation, and just strip away the word-at-a-time
optimizations, and it should be pretty generic (if perhaps not
optimal).

The thing to really look out for is when the top of the user address
space abuts the kernel address space. If you *only* rely on page
faults, the user can read kernel addresses by mapping the very last
page and then putting a non-terminated string at the end of that page,
and trying to open a file using that name. So you need to either have
a guard page (guaranteeing a fault), or you need to take TASK_SIZE or
similar into account. Because getname() no longer does the TASK_SIZE
games for you.

                       Linus

On Fri, Apr 6, 2012 at 2:32 PM, Linus Torvalds
&amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt; wrote:
&lt;/pre&gt;</description>
    <dc:creator>Linus Torvalds</dc:creator>
    <dc:date>2012-05-21T16:50:34</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14211">
    <title>免交40万留学保证金，打造平民化的出国留学服务，爱尔兰名校等您来深造</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14211</link>
    <description>&lt;pre&gt;您还在为家庭不够富裕，而不能让品学兼优的孩子出国深造而苦恼吗？
您还在为国内教育资源分配严重不均，而不能让自己的孩子获得理想的教育环境而发愁吗？

免交40万留学保证金，打造平民化的出国留学服务！
让工薪家庭孩子也可以一圆出国留学梦！

爱尔兰名校等您来深造！
想了解详情的请联系QQ: 2636882155   或者立即回复邮箱: 2636882155&amp;lt; at &amp;gt;qq.com
想了解详情的请联系QQ: 2636882155   或者立即回复邮箱: 2636882155&amp;lt; at &amp;gt;qq.com
想了解详情的请联系QQ: 2636882155   或者立即回复邮箱: 2636882155&amp;lt; at &amp;gt;qq.com
 
 
现诚招全国各地出国留学顾问。
零风险！高回报！共享朝阳般的教育产业大蛋糕！
请联系QQ: 2636882155
请联系QQ: 2636882155
请联系QQ: 2636882155
&lt;/pre&gt;</description>
    <dc:creator>平民化的出国留学服务</dc:creator>
    <dc:date>2012-05-21T13:09:13</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14198">
    <title>hexagon: signal bugs</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14198</link>
    <description>&lt;pre&gt;1) spot the braino:
void do_trap0(struct pt_regs *regs)
...
        unsigned long syscallret = 0;
...
                if ((unsigned long) regs-&amp;gt;syscall_nr &amp;gt;= __NR_syscalls) {
                        regs-&amp;gt;r00 = -1;
                } else {
                        syscall = (syscall_fn)
                                  (sys_call_table[regs-&amp;gt;syscall_nr]);
                        syscallret = syscall(regs-&amp;gt;r00, regs-&amp;gt;r01,
                                   regs-&amp;gt;r02, regs-&amp;gt;r03,
                                   regs-&amp;gt;r04, regs-&amp;gt;r05);
                }

                if (regs-&amp;gt;syscall_nr != __NR_rt_sigreturn)
                        regs-&amp;gt;r00 = syscallret;
IOW, the last if () should've been inside the "syscall_nr is not too high"
branch of the if () just above...

2) you do _not_ want syscall restarts to happen on sigreturn().
Whatever adjustment needed to be done had already been done back before
we'd saved the registers into sigcontext.  So doing
        regs-&amp;gt;syscall_nr = __NR_rt_sigreturn;
in sys_rt_sigreturn() is exactly the wrong thing - for syscall restart
purposes you want it to look like a non-syscall (i.e. it should be
regs-&amp;gt;syscall_nr = -1 to make your check in handle_signal() work).
Incidentally, I would suggest just having that thing return regs-&amp;gt;r00;
then you can avoid all special-casing for "do we want to put the
return value of sys_...() into regs-&amp;gt;r00?" in do_trap0().

3) if you have multiple pending signals, you need to handle all
of them before returning to userland.  And you need to make sure that
syscall restart logics does not trigger on anything past the first time
around.

4) checking for !user_mode(regs) needs to be done in the loop (created
while fixing #3) in vm_entry.S where you are calling do_notify_resume();
you need to leave the loop if it's true (if you can get there on return
to kernel in the first place).
&lt;/pre&gt;</description>
    <dc:creator>Al Viro</dc:creator>
    <dc:date>2012-05-19T21:09:11</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14098">
    <title>[PATCHv10 00/11] ARM: DMA-mapping framework redesign</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14098</link>
    <description>&lt;pre&gt;Hello,

This is another update on dma-mapping redesign patches for ARM. I
integrated a few minor fixes that were needed to solve the issues
reported after putting these patches for testing in linux-next branch.

The patches are also available on my git repository at:
git://git.linaro.org/people/mszyprowski/linux-dma-mapping.git 3.4-rc7-arm-dma-v10

History of the development:

v1: (initial version of the DMA-mapping redesign patches):
http://www.spinics.net/lists/linux-mm/msg21241.html

v2:
http://lists.linaro.org/pipermail/linaro-mm-sig/2011-September/000571.html
http://lists.linaro.org/pipermail/linaro-mm-sig/2011-September/000577.html

v3:
http://www.spinics.net/lists/linux-mm/msg25490.html

v4 and v5:
http://www.spinics.net/lists/arm-kernel/msg151147.html
http://www.spinics.net/lists/arm-kernel/msg154889.html

v6:
http://www.spinics.net/lists/linux-mm/msg29903.html

v7:
http://www.spinics.net/lists/arm-kernel/msg162149.html

v8:
http://www.spinics.net/lists/arm-kernel/msg168478.html

v9:
http://www.spinics.net/lists/linux-arch/msg17443.html

Best regards
Marek Szyprowski
Samsung Poland R&amp;amp;D Center


Patch summary:

Marek Szyprowski (11):
  common: add dma_mmap_from_coherent() function
  ARM: dma-mapping: use dma_mmap_from_coherent()
  ARM: dma-mapping: use pr_* instread of printk
  ARM: dma-mapping: introduce DMA_ERROR_CODE constant
  ARM: dma-mapping: remove offset parameter to prepare for generic
    dma_ops
  ARM: dma-mapping: use asm-generic/dma-mapping-common.h
  ARM: dma-mapping: implement dma sg methods on top of any generic dma
    ops
  ARM: dma-mapping: move all dma bounce code to separate dma ops
    structure
  ARM: dma-mapping: remove redundant code and do the cleanup
  ARM: dma-mapping: use alloc, mmap, free from dma_ops
  ARM: dma-mapping: add support for IOMMU mapper

 arch/arm/Kconfig                   |    9 +
 arch/arm/common/dmabounce.c        |   84 ++-
 arch/arm/include/asm/device.h      |    4 +
 arch/arm/include/asm/dma-iommu.h   |   34 ++
 arch/arm/include/asm/dma-mapping.h |  407 ++++-----------
 arch/arm/mm/dma-mapping.c          | 1015 ++++++++++++++++++++++++++++++------
 arch/arm/mm/vmregion.h             |    2 +-
 drivers/base/dma-coherent.c        |   42 ++
 include/asm-generic/dma-coherent.h |    4 +-
 9 files changed, 1134 insertions(+), 467 deletions(-)
 create mode 100644 arch/arm/include/asm/dma-iommu.h

&lt;/pre&gt;</description>
    <dc:creator>Marek Szyprowski</dc:creator>
    <dc:date>2012-05-17T13:13:50</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14050">
    <title>[PATCH] clkdev: Add default clkdev.h</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14050</link>
    <description>&lt;pre&gt;Ease the deployment of clkdev by providing a default asm/clkdev.h which
will be used if the arch does not have an include/asm/clkdev.h.

Signed-off-by: Mark Brown &amp;lt;broonie&amp;lt; at &amp;gt;opensource.wolfsonmicro.com&amp;gt;
---
 include/asm-generic/Kbuild.asm |    4 ++++
 include/asm-generic/clkdev.h   |   26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 include/asm-generic/clkdev.h

diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index c5d2e5d..da121e0 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -13,6 +13,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
 header-y += a.out.h
 endif
 
+ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/clkdev.h),)
+generic-y += clkdev.h
+endif
+
 header-y += auxvec.h
 header-y += bitsperlong.h
 header-y += byteorder.h
diff --git a/include/asm-generic/clkdev.h b/include/asm-generic/clkdev.h
new file mode 100644
index 0000000..c362a9d
--- /dev/null
+++ b/include/asm-generic/clkdev.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/*
+ *  include/asm-generic/clkdev.h
+ *
+ * Based on the ARM clkdev.h:
+ *  Copyright (C) 2008 Russell King.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Helper for the clk API to assist looking up a struct clk.
+ */
+#ifndef __ASM_CLKDEV_H
+#define __ASM_CLKDEV_H
+
+#include &amp;lt;linux/slab.h&amp;gt;
+
+#define __clk_get(clk)({ 1; })
+#define __clk_put(clk)do { } while (0)
+
+static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
+{
+return kzalloc(size, GFP_KERNEL);
+}
+
+#endif
&lt;/pre&gt;</description>
    <dc:creator>Mark Brown</dc:creator>
    <dc:date>2012-05-14T14:19:27</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14043">
    <title>Do we use runtime patching of function calls somewhere?</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14043</link>
    <description>&lt;pre&gt;Do we have any archs that does runtime patching of function calls?

On sparc32 we have infrastructure to do so but this
requires an additional step after the final link
that I like to get rid of.

Basically what is required is to locate all
call-sites that for example call:

     cache_flush_all();

and replace this with a

    srmmu_cache_flush_all();

sparc32 has ~30 calls that is eligble for runtime patching.
sparc-next has seen some nice cleanup in this area,
so your regular kernel has much more.

We know early on the what to patch with as the only
paramters involved are platform and MMU type.

I could try to come up with something myself - but if we already
have it somewhere maybe there is something to be inspired by.

Sam
&lt;/pre&gt;</description>
    <dc:creator>Sam Ravnborg</dc:creator>
    <dc:date>2012-05-13T12:16:00</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/14033">
    <title>haalloo,</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/14033</link>
    <description>&lt;pre&gt;haalloo,
how are you doing,i hope you are fine,my name is miss abi okom i got your
contact and want us to be a good friend,
please try and write back to me so that i will give you my pictures and tell
you more about me,
&lt;/pre&gt;</description>
    <dc:creator>abi</dc:creator>
    <dc:date>2012-05-12T17:04:35</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13996">
    <title>[PATCHv2] bitops: add _local bitops</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/13996</link>
    <description>&lt;pre&gt;kvm needs to update some hypervisor variables atomically
in a sense that the operation can't be interrupted
in the middle. However the hypervisor always runs
on the same CPU so it does not need any memory
barrier or lock prefix.

Add _local bitops for this purpose: define them
as non-atomics for x86 and (for now) atomics for
everyone else.

Uses are not restricted to virtualization: they
might be useful to communicate with an interrupt
handler if we know that it's running on the same CPU.

Signed-off-by: Michael S. Tsirkin &amp;lt;mst&amp;lt; at &amp;gt;redhat.com&amp;gt;
Acked-by: Arnd Bergmann &amp;lt;arnd&amp;lt; at &amp;gt;arndb.de&amp;gt;
---

Changes from v1:
- Fix x86 version so it includes optimization barriers
  as suggested by Peter Anvin
- Fix documentation as suggested by Avi Kivity
- Remove duplicate files as suggested by Arnd Bergmann

Link to discussion preceding v1:
http://www.spinics.net/lists/kvm/msg72241.html



 Documentation/atomic_ops.txt              |   19 ++++
 arch/x86/include/asm/bitops.h             |  132 +++++++++++++++++++++++++++++
 include/asm-generic/bitops.h              |    1 +
 include/asm-generic/bitops/local-atomic.h |  114 +++++++++++++++++++++++++
 include/linux/bitops.h                    |    8 ++
 5 files changed, 274 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/bitops/local-atomic.h

diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index 27f2b21..b45eb12 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -520,6 +520,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; The __clear_bit_unlock version is non-atomic, however it still implements
 unlock barrier semantics. This can be useful if the lock itself is protecting
 the other bits in the word.
 
+Local versions of the bitmask operations are also provided.  They are used in
+contexts where the operations need to be performed atomically with respect to
+the local CPU, but no other CPU accesses the bitmask.  This assumption makes it
+possible to avoid the need for SMP protection and use less expensive atomic
+operations in the implementation.
+They have names similar to the above bitmask operation interfaces,
+except that _local is appended to the interface name.
+
+void set_bit_local(unsigned long nr, volatile unsigned long *addr);
+void clear_bit_local(unsigned long nr, volatile unsigned long *addr);
+void change_bit_local(unsigned long nr, volatile unsigned long *addr);
+int test_and_set_bit_local(unsigned long nr, volatile unsigned long *addr);
+int test_and_clear_bit_local(unsigned long nr, volatile unsigned long *addr);
+int test_and_change_bit_local(unsigned long nr, volatile unsigned long *addr);
+
+These local variants are useful for example if the bitmask may be accessed from
+a local intrerrupt, or from a hypervisor on the same CPU if running in a VM.
+These local variants also do not have any special memory barrier semantics.
+
 Finally, there are non-atomic versions of the bitmask operations
 provided.  They are used in contexts where some other higher-level SMP
 locking scheme is being used to protect the bitmask, and thus less
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index b97596e..4e6d900 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -41,6 +41,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #define CONST_MASK_ADDR(nr, addr)BITOP_ADDR((void *)(addr) + ((nr)&amp;gt;&amp;gt;3))
 #define CONST_MASK(nr)(1 &amp;lt;&amp;lt; ((nr) &amp;amp; 7))
 
+/*
+ * x86 has its own version of local atomic operations.  These operations
+ * change memory using a single instruction, but give no atomicity or ordering
+ * guarantees if result observed from another CPU.  Atomicity is guaranteed if
+ * result is observed from the same CPU, e.g. from a local interrupt, or a
+ * hypervisor if running in a VM.
+ * Atomicity is not guaranteed across CPUs: if two examples of these operations
+ * race on different CPUs, one can appear to succeed but actually fail.
+ * To get atomicity guarantees across CPUs use non-local atomics instead.
+ * These operations can be reordered. No memory barrier is implied.
+ */
+
+#define ARCH_HAS_BITOPS_LOCAL_ATOMIC 1
+
 /**
  * set_bit - Atomically set a bit in memory
  * &amp;lt; at &amp;gt;nr: the bit to set
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -85,6 +99,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline void __set_bit(int nr, volatile unsigned long *addr)
 }
 
 /**
+ * set_bit_local - Atomically set a bit in memory
+ * &amp;lt; at &amp;gt;nr: the bit to set
+ * &amp;lt; at &amp;gt;addr: the address to start counting from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static inline void set_bit_local(int nr, volatile unsigned long *addr)
+{
+asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
+}
+
+/**
  * clear_bit - Clears a bit in memory
  * &amp;lt; at &amp;gt;nr: Bit to clear
  * &amp;lt; at &amp;gt;addr: Address to start counting from
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -149,6 +176,30 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline void __clear_bit_unlock(unsigned nr, volatile unsigned long *addr)
 #define smp_mb__after_clear_bit()barrier()
 
 /**
+ * clear_bit - Clears a bit in memory
+ * &amp;lt; at &amp;gt;nr: Bit to clear
+ * &amp;lt; at &amp;gt;addr: Address to start counting from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static __always_inline void
+clear_bit_local(int nr, volatile unsigned long *addr)
+{
+if (IS_IMMEDIATE(nr)) {
+asm volatile("andb %1,%0"
+: CONST_MASK_ADDR(nr, addr)
+: "iq" ((u8)~CONST_MASK(nr))
+: "memory");
+} else {
+asm volatile("btr %1,%0"
+: BITOP_ADDR(addr)
+: "Ir" (nr)
+: "memory");
+}
+}
+
+/**
  * __change_bit - Toggle a bit in memory
  * &amp;lt; at &amp;gt;nr: the bit to change
  * &amp;lt; at &amp;gt;addr: the address to start counting from
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -185,6 +236,29 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline void change_bit(int nr, volatile unsigned long *addr)
 }
 
 /**
+ * change_bit_local - Toggle a bit in memory
+ * &amp;lt; at &amp;gt;nr: Bit to clear
+ * &amp;lt; at &amp;gt;addr: Address to start counting from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static inline void change_bit_local(int nr, volatile unsigned long *addr)
+{
+if (IS_IMMEDIATE(nr)) {
+asm volatile("xorb %1,%0"
+: CONST_MASK_ADDR(nr, addr)
+: "iq" ((u8)CONST_MASK(nr))
+: "memory");
+} else {
+asm volatile("btc %1,%0"
+: BITOP_ADDR(addr)
+: "Ir" (nr)
+: "memory");
+}
+}
+
+/**
  * test_and_set_bit - Set a bit and return its old value
  * &amp;lt; at &amp;gt;nr: Bit to set
  * &amp;lt; at &amp;gt;addr: Address to count from
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -236,6 +310,24 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
 }
 
 /**
+ * test_and_set_bit_local - Set a bit and return its old value
+ * &amp;lt; at &amp;gt;nr: Bit to set
+ * &amp;lt; at &amp;gt;addr: Address to count from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static inline int test_and_set_bit_local(int nr, volatile unsigned long *addr)
+{
+int oldbit;
+
+asm volatile("bts %2,%1\n\t"
+     "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
+
+return oldbit;
+}
+
+/**
  * test_and_clear_bit - Clear a bit and return its old value
  * &amp;lt; at &amp;gt;nr: Bit to clear
  * &amp;lt; at &amp;gt;addr: Address to count from
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -274,6 +366,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
 return oldbit;
 }
 
+/**
+ * test_and_clear_bit_local - Clear a bit and return its old value
+ * &amp;lt; at &amp;gt;nr: Bit to clear
+ * &amp;lt; at &amp;gt;addr: Address to count from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static inline
+int test_and_clear_bit_local(int nr, volatile unsigned long *addr)
+{
+int oldbit;
+
+asm volatile("btr %2,%1\n\t"
+     "sbb %0,%0"
+     : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
+
+return oldbit;
+}
+
 /* WARNING: non atomic and it can be reordered! */
 static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
 {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -306,6 +418,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
 return oldbit;
 }
 
+/**
+ * test_and_change_bit_local - Change a bit and return its old value
+ * &amp;lt; at &amp;gt;nr: Bit to change
+ * &amp;lt; at &amp;gt;addr: Address to count from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static inline
+int test_and_change_bit_local(int nr, volatile unsigned long *addr)
+{
+int oldbit;
+
+asm volatile("btc %2,%1\n\t"
+     "sbb %0,%0"
+     : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
+
+return oldbit;
+}
+
 static __always_inline int constant_test_bit(unsigned int nr, const volatile unsigned long *addr)
 {
 return ((1UL &amp;lt;&amp;lt; (nr % BITS_PER_LONG)) &amp;amp;
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index 280ca7a..d720c9e 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -40,5 +40,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;asm-generic/bitops/non-atomic.h&amp;gt;
 #include &amp;lt;asm-generic/bitops/le.h&amp;gt;
 #include &amp;lt;asm-generic/bitops/ext2-atomic.h&amp;gt;
+#include &amp;lt;asm-generic/bitops/local-atomic.h&amp;gt;
 
 #endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/include/asm-generic/bitops/local-atomic.h b/include/asm-generic/bitops/local-atomic.h
new file mode 100644
index 0000000..8ae3c22
--- /dev/null
+++ b/include/asm-generic/bitops/local-atomic.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,114 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#ifndef ASM_GENERIC_BITOPS_LOCAL_ATOMIC_H
+#define ASM_GENERIC_BITOPS_LOCAL_ATOMIC_H
+/**
+ * Local atomic operations
+ *
+ * These operations give no atomicity or ordering guarantees if result
+ * observed from another CPU.  Atomicity is guaranteed if result is observed
+ * from the same CPU, e.g. from a local interrupt, or a hypervisor if running
+ * in a VM.
+ * Atomicity is not guaranteed across CPUs: if two examples of these operations
+ * race on different CPUs, one can appear to succeed but actually fail.  Use
+ * non-local atomics instead or protect such SMP accesses with a lock.
+ * These operations can be reordered. No memory barrier is implied.
+ */
+
+/**
+ * Implement local operations in terms of atomics.
+ * For use from a local interrupt, this is always safe but suboptimal: many
+ * architectures can use bitops/local.h instead.
+ * For use from a hypervisor, make sure your architecture doesn't
+ * rely on locks for atomics: if it does - override these operations.
+ */
+
+#if 0 /* Fool kernel-doc since it doesn't do macros yet */
+/**
+ * set_bit_local - Sets a bit in memory
+ * &amp;lt; at &amp;gt;nr: the bit to set
+ * &amp;lt; at &amp;gt;addr: the address to start counting from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ * Note that &amp;lt; at &amp;gt;nr may be almost arbitrarily large; this function is not
+ * restricted to acting on a single-word quantity.
+ */
+static
+void set_bit_local(unsigned int nr, volatile unsigned long *addr);
+#endif
+#define set_bit_local(nr, addr) set_bit(nr, addr)
+
+#if 0 /* Fool kernel-doc since it doesn't do macros yet */
+/**
+ * clear_bit_local - Clears a bit in memory
+ * &amp;lt; at &amp;gt;nr: Bit to clear
+ * &amp;lt; at &amp;gt;addr: Address to start counting from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ * Note that &amp;lt; at &amp;gt;nr may be almost arbitrarily large; this function is not
+ * restricted to acting on a single-word quantity.
+ */
+static
+void clear_bit_local(unsigned int nr, volatile unsigned long *addr);
+#endif
+#define clear_bit_local(nr, addr) clear_bit(nr, addr)
+
+#if 0 /* Fool kernel-doc since it doesn't do macros yet */
+/**
+ * change_bit_local - Toggle a bit in memory
+ * &amp;lt; at &amp;gt;nr: Bit to change
+ * &amp;lt; at &amp;gt;addr: Address to start counting from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static
+void change_bit_local(unsigned int nr, volatile unsigned long *addr);
+#endif
+#define change_bit_local(nr, addr) change_bit(nr, addr)
+
+#if 0 /* Fool kernel-doc since it doesn't do macros yet */
+/**
+ * test_and_set_bit_local - Set a bit and return its old value
+ * &amp;lt; at &amp;gt;nr: Bit to set
+ * &amp;lt; at &amp;gt;addr: Address to count from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static
+int test_and_set_bit_local(unsigned int nr, volatile unsigned long *addr);
+#endif
+#define test_and_set_bit_local(nr, addr) test_and_set_bit(nr, addr)
+
+#if 0 /* Fool kernel-doc since it doesn't do macros yet */
+/**
+ * test_and_clear_bit_local - Clear a bit and return its old value
+ * &amp;lt; at &amp;gt;nr: Bit to clear
+ * &amp;lt; at &amp;gt;addr: Address to count from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ * Note that &amp;lt; at &amp;gt;nr may be almost arbitrarily large; this function is not
+ * restricted to acting on a single-word quantity.
+ */
+static
+int test_and_clear_bit_local(unsigned int nr, volatile unsigned long *addr);
+#endif
+#define test_and_clear_bit_local(nr, addr) test_and_clear_bit(nr, addr)
+
+#if 0 /* Fool kernel-doc since it doesn't do macros yet */
+/**
+ * test_and_change_bit_local - Change a bit and return its old value
+ * &amp;lt; at &amp;gt;nr: Bit to change
+ * &amp;lt; at &amp;gt;addr: Address to count from
+ *
+ * This operation is atomic with respect to local CPU only. No memory barrier
+ * is implied.
+ */
+static
+int test_and_change_bit_local(unsigned int nr, volatile unsigned long *addr);
+#endif
+#define test_and_change_bit_local(nr, addr) test_and_change_bit(nr, addr)
+
+#endif /* ASM_GENERIC_BITOPS_LOCAL_ATOMIC_H */
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a3b6b82..09ab214 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -197,5 +197,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; extern unsigned long find_last_bit(const unsigned long *addr,
    unsigned long size);
 #endif
 
+/**
+ * Include the generic version for local atomics unless
+ * an architecture overrides it.
+ * */
+#ifndef ARCH_HAS_BITOPS_LOCAL_ATOMIC
+#include "include/asm-generic/bitops/local-atomic.h"
+#endif
+
 #endif /* __KERNEL__ */
 #endif
&lt;/pre&gt;</description>
    <dc:creator>Michael S. Tsirkin</dc:creator>
    <dc:date>2012-05-09T16:28:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13971">
    <title>[PATCH 0/6] get rid of extra check for TASK_SIZE in get_unmapped_area</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/13971</link>
    <description>&lt;pre&gt;From: Vladimir Murzin &amp;lt;murzin.v&amp;lt; at &amp;gt;gmail&amp;gt;

The current get_unmapped_area code calls the f_ops-&amp;gt;get_unmapped_area or
the arch's one (via the mm) only when check for TASK_SIZE is passed. However,
generic code and some arches do the same check in their a_g_u_a implementation.

This series of patches fix the check order for TASK_SIZE in archs'
get_unmapped_area() implementations, and then removes extra check in
high-level get_unmapped_area().

Vladimir Murzin (6):
  get_unmapped_area checks for TASK_SIZE before MAP_FIXED on arm
  get_unmapped_area checks for TASK_SIZE before MAP_FIXED on sh
  get_unmapped_area checks for TASK_SIZE before MAP_FIXED on sparc32
  get_unmapped_area checks for TASK_SIZE before MAP_FIXED on sparc64
  get_unmapped_area checks for TASK_SIZE before MAP_FIXED on x86_64
  get_unmapped_area remove extra check for TASK_SIZE

 arch/arm/mm/mmap.c               |    6 +++---
 arch/sh/mm/mmap.c                |   12 ++++++------
 arch/sparc/kernel/sys_sparc_32.c |    9 +++++----
 arch/sparc/kernel/sys_sparc_64.c |   16 ++++++++--------
 arch/x86/kernel/sys_x86_64.c     |    6 +++---
 mm/mmap.c                        |    4 ----
 6 files changed, 25 insertions(+), 28 deletions(-)

&lt;/pre&gt;</description>
    <dc:creator>Vladimir Murzin</dc:creator>
    <dc:date>2012-05-08T14:40:16</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13963">
    <title>[PATCH 0/6] OpenRISC patches for review</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/13963</link>
    <description>&lt;pre&gt;
Here's a couple of patches that I'm planning on queuing up for 3.5.  These
have been through the openrisc mailing list, but there's not much response
on that channel, so I thought I'd run these once by the "big" list.

Comments welcome, otherwise these will go into 3.5.

Thanks,
Jonas

Jonas Bonn (5):
  openrisc: implement irqdomains
  openrisc: remove unnecessary includes
  openrisc: header file cleanups
  openrisc: provide dma_map_ops
  openrisc: use scratch regs in atomic syscall

Kautuk Consul (1):
  openrisc/mm/fault.c: Port OOM changes to do_page_fault

 arch/openrisc/Kconfig                   |    1 +
 arch/openrisc/include/asm/Kbuild        |    3 +-
 arch/openrisc/include/asm/dma-mapping.h |  147 +++++++------------------------
 arch/openrisc/include/asm/elf.h         |   12 ++-
 arch/openrisc/include/asm/ptrace.h      |    6 +-
 arch/openrisc/kernel/dma.c              |  109 +++++++++++++++--------
 arch/openrisc/kernel/entry.S            |    8 +-
 arch/openrisc/kernel/irq.c              |   83 ++++++++++--------
 arch/openrisc/mm/fault.c                |   32 ++++++--
 9 files changed, 199 insertions(+), 202 deletions(-)

&lt;/pre&gt;</description>
    <dc:creator>Jonas Bonn</dc:creator>
    <dc:date>2012-05-08T09:53:59</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13937">
    <title>An invitation to Multiply</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/13937</link>
    <description>&lt;pre&gt;
Check out my Multiply site

I set up a Multiply site with my pictures, videos and blog and I want 
to add you as my friend so you can see it. First, you need to join 
Multiply! Once you join, you can also create your own site and share 
anything you want, with anyone you want.

Here's the link:
http://multiply.com/si/PlknC3ZfVkZFzocsLwdi+A

Gracias de leer y me responde

Thanks,
Gracias de leer







Stop e-mails, view our privacy policy, or report abuse: 
http://multiply.com/bl/PlknC3ZfVkZFzocsLwdi+A
We haven't added your email address to any lists, nor will we share it
with anyone at any time.
Copyright 2012 Multiply
6001 Park of Commerce Blvd, Boca Raton, FL

&lt;/pre&gt;</description>
    <dc:creator> Gracias de leer y me responde (via Multiply) </dc:creator>
    <dc:date>2012-05-05T20:45:38</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.cross-arch/13936">
    <title>An invitation to Multiply</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.cross-arch/13936</link>
    <description>&lt;pre&gt;
Check out my Multiply site

I set up a Multiply site with my pictures, videos and blog and I want 
to add you as my friend so you can see it. First, you need to join 
Multiply! Once you join, you can also create your own site and share 
anything you want, with anyone you want.

Here's the link:
http://multiply.com/si/hTCRezMd03moqDWw+PQ06A

Gracias de leer y me responde

Thanks,
Gracias de leer







Stop e-mails, view our privacy policy, or report abuse: 
http://multiply.com/bl/hTCRezMd03moqDWw+PQ06A
We haven't added your email address to any lists, nor will we share it
with anyone at any time.
Copyright 2012 Multiply
6001 Park of Commerce Blvd, Boca Raton, FL

&lt;/pre&gt;</description>
    <dc:creator> Gracias de leer y me responde (via Multiply) </dc:creator>
    <dc:date>2012-05-05T20:46:01</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.linux.kernel.cross-arch">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.linux.kernel.cross-arch</link>
  </textinput>
</rdf:RDF>

