<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib/extable.c, branch v3.3.4</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.3.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.3.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2009-06-12T12:17:04Z</updated>
<entry>
<title>module: trim exception table on init free.</title>
<updated>2009-06-12T12:17:04Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:47:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ad6561dffa17f17bb68d7207d422c26c381c4313'/>
<id>urn:sha1:ad6561dffa17f17bb68d7207d422c26c381c4313</id>
<content type='text'>
It's theoretically possible that there are exception table entries
which point into the (freed) init text of modules.  These could cause
future problems if other modules get loaded into that memory and cause
an exception as we'd see the wrong fixup.  The only case I know of is
kvm-intel.ko (when CONFIG_CC_OPTIMIZE_FOR_SIZE=n).

Amerigo fixed this long-standing FIXME in the x86 version, but this
patch is more general.

This implements trim_init_extable(); most archs are simple since they
use the standard lib/extable.c sort code.  Alpha and IA64 use relative
addresses in their fixups, so thier trimming is a slight variation.

Sparc32 is unique; it doesn't seem to define ARCH_HAS_SORT_EXTABLE,
yet it defines its own sort_extable() which overrides the one in lib.
It doesn't sort, so we have to mark deleted entries instead of
actually trimming them.

Inspired-by: Amerigo Wang &lt;amwang@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: linux-alpha@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-ia64@vger.kernel.org
</content>
</entry>
<entry>
<title>lib/extable.c: remove an expensive integer divide in search_extable()</title>
<updated>2008-02-06T18:41:08Z</updated>
<author>
<name>Eric Dumazet</name>
<email>dada1@cosmosbay.com</email>
</author>
<published>2008-02-06T09:37:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=15ae02baf025750cd79ef3929c28f7083a088bd2'/>
<id>urn:sha1:15ae02baf025750cd79ef3929c28f7083a088bd2</id>
<content type='text'>
Actual code let compiler generates idiv instruction on x86.

Using a right shift is OK here and readable as well.

Before patch
   10:   57                      push   %edi
   11:   56                      push   %esi
   12:   89 d6                   mov    %edx,%esi
   14:   53                      push   %ebx
   15:   89 c3                   mov    %eax,%ebx
   17:   eb 22                   jmp    3b &lt;search_extable+0x2b&gt;
   19:   89 f0                   mov    %esi,%eax
   1b:   ba 02 00 00 00          mov    $0x2,%edx
   20:   29 d8                   sub    %ebx,%eax
   22:   89 d7                   mov    %edx,%edi
   24:   c1 f8 03                sar    $0x3,%eax
   27:   99                      cltd
   28:   f7 ff                   idiv   %edi
   2a:   8d 04 c3                lea    (%ebx,%eax,8),%eax
   2d:   39 08                   cmp    %ecx,(%eax)
...

After patch

00000010 &lt;search_extable&gt;:
   10:   53                      push   %ebx
   11:   89 c3                   mov    %eax,%ebx
   13:   eb 18                   jmp    2d &lt;search_extable+0x1d&gt;
   15:   89 d0                   mov    %edx,%eax
   17:   29 d8                   sub    %ebx,%eax
   19:   c1 f8 04                sar    $0x4,%eax
   1c:   8d 04 c3                lea    (%ebx,%eax,8),%eax
   1f:   39 08                   cmp    %ecx,(%eax)
...

Signed-off-by: Eric Dumazet &lt;dada1@cosmosbay.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Remove obsolete #include &lt;linux/config.h&gt;</title>
<updated>2006-06-30T17:25:36Z</updated>
<author>
<name>Jörn Engel</name>
<email>joern@wohnheim.fh-wedel.de</email>
</author>
<published>2006-06-30T17:25:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6ab3d5624e172c553004ecc862bfeac16d9d68b7'/>
<id>urn:sha1:6ab3d5624e172c553004ecc862bfeac16d9d68b7</id>
<content type='text'>
Signed-off-by: Jörn Engel &lt;joern@wohnheim.fh-wedel.de&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>[PATCH] powerpc: trivial: modify comments to refer to new location of files</title>
<updated>2006-02-10T05:53:51Z</updated>
<author>
<name>Jon Mason</name>
<email>jdmason@us.ibm.com</email>
</author>
<published>2006-01-23T16:58:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2ef9481e666b4654159ac9f847e6963809e3c470'/>
<id>urn:sha1:2ef9481e666b4654159ac9f847e6963809e3c470</id>
<content type='text'>
This patch removes all self references and fixes references to files
in the now defunct arch/ppc64 tree.  I think this accomplises
everything wanted, though there might be a few references I missed.

Signed-off-by: Jon Mason &lt;jdmason@us.ibm.com&gt;
Signed-off-by: Paul Mackerras &lt;paulus@samba.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] extable: remove needless declaration</title>
<updated>2005-10-31T01:37:26Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@cam.org</email>
</author>
<published>2005-10-30T23:03:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c4dd0e4c6336bd17fea38bcad636eafa2941cf9f'/>
<id>urn:sha1:c4dd0e4c6336bd17fea38bcad636eafa2941cf9f</id>
<content type='text'>
They aren't used anywhere in that file.

Signed-off-by: Nicolas Pitre &lt;nico@cam.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] ia64 extable sorting fix</title>
<updated>2005-03-10T12:20:45Z</updated>
<author>
<name>Matt Mackall</name>
<email>mpm@selenic.com</email>
</author>
<published>2005-03-10T12:20:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fd4615c9a0c3340cca3612f2ccdcb8c04724e213'/>
<id>urn:sha1:fd4615c9a0c3340cca3612f2ccdcb8c04724e213</id>
<content type='text'>
Fix a goofup from the recent sort consolidation patches.

- Subtractions in comparison functions could overflow the return type for
  64-bit pointers.  Make it right again.

- Add missing size arg to ia64 extable swap function.

Signed-off-by: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] lib/sort: Replace insertion sort in exception tables</title>
<updated>2005-03-08T02:05:40Z</updated>
<author>
<name>Matt Mackall</name>
<email>mpm@selenic.com</email>
</author>
<published>2005-03-08T02:05:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9e9dd5d9cf1868a69fcee884006b555a4d860a11'/>
<id>urn:sha1:9e9dd5d9cf1868a69fcee884006b555a4d860a11</id>
<content type='text'>
Replace exception table insertion sort with lib/sort

Signed-off-by: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] do not use shared extable code for ia64</title>
<updated>2004-01-20T11:17:40Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@osdl.org</email>
</author>
<published>2004-01-20T11:17:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=160c2d70e7f146cea087ae3cf9382d171e6c8eb6'/>
<id>urn:sha1:160c2d70e7f146cea087ae3cf9382d171e6c8eb6</id>
<content type='text'>
From: Jes Sorensen &lt;jes@trained-monkey.org&gt;

The new sort_extable and shared search_extable code doesn't work on ia64.
I have introduced two new #defines that archs can define to avoid the
common code being built.  ARCH_HAS_SEARCH_EXTABLE and
ARCH_HAS_SORT_EXTABLE.
</content>
</entry>
<entry>
<title>[PATCH] exception table search fix</title>
<updated>2004-01-20T11:16:20Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@osdl.org</email>
</author>
<published>2004-01-20T11:16:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8283a979b1bd0c92a4713ccb6f79f18dae2d7e93'/>
<id>urn:sha1:8283a979b1bd0c92a4713ccb6f79f18dae2d7e93</id>
<content type='text'>
The exception table search code currently fails if addresses differ by more
than 2G.  This is only a problem when using the 4g/4g address space split,
but it's more robust this way.

Also, shuffle the comparison order n there so the least likely case comes
last.
</content>
</entry>
<entry>
<title>[PATCH] sort exception tables</title>
<updated>2004-01-19T13:49:29Z</updated>
<author>
<name>Paul Mackerras</name>
<email>paulus@samba.org</email>
</author>
<published>2004-01-19T13:49:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=35b93751d2f184c82be557bbeac4c5cef11e34a1'/>
<id>urn:sha1:35b93751d2f184c82be557bbeac4c5cef11e34a1</id>
<content type='text'>
This patch arranges for the exception tables to be sorted on most
architectures.  It sorts the main kernel exception table on startup
and the module exception tables when they get loaded.  The main table
is sorted reasonably early - just after kmem_cache_init - but that
could be moved even earlier if necessary.

There is now a lib/extable.c which includes the sort_extable()
function from arch/ppc/mm/extable.c and the search_extable() function
from arch/i386/mm/extable.c, which had been copied to many
architectures.  On many architectures, arch/$(ARCH)/mm/extable.c
became empty and so I have removed it.

There are four architectures which do things differently from i386:
alpha, ia64, sparc and sparc64.  Alpha and ia64 store the offset from
the offset from the exception table entry to the instruction, and
sparc and sparc64 have range entries in the table.  For those
architectures I have added empty sort_extable functions.  The
maintainers for those architectures can implement something better if
they care to.  As it is they are no worse off than before.

Although it is a moderately sizable patch, it ends up with a net
reduction of 377 lines in the size of the kernel source. :)

I have tested this on x86 and ppc with a module that uses __get_user
in an init function, deliberately laid out to get the exception table
out of order, and it works (whereas it oopsed without this patch).
</content>
</entry>
</feed>
