<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib, branch v3.10.81</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.81</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.81'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-06-06T06:19:54Z</updated>
<entry>
<title>lib: Fix strnlen_user() to not touch memory after specified maximum</title>
<updated>2015-06-06T06:19:54Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2015-06-02T15:10:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=73f668104f25d364f758e8c6738c2a1826d2f0fc'/>
<id>urn:sha1:73f668104f25d364f758e8c6738c2a1826d2f0fc</id>
<content type='text'>
commit f18c34e483ff6b1d9866472221e4015b3a4698e4 upstream.

If the specified maximum length of the string is a multiple of unsigned
long, we would load one long behind the specified maximum.  If that
happens to be in a next page, we can hit a page fault although we were
not expected to.

Fix the off-by-one bug in the test whether we are at the end of the
specified range.

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR</title>
<updated>2015-05-06T19:56:28Z</updated>
<author>
<name>mancha security</name>
<email>mancha1@zoho.com</email>
</author>
<published>2015-03-18T17:47:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e60e4dc082ca9c63d2113be4be5ac4cf3fd2f2a8'/>
<id>urn:sha1:e60e4dc082ca9c63d2113be4be5ac4cf3fd2f2a8</id>
<content type='text'>
commit 0b053c9518292705736329a8fe20ef4686ffc8e9 upstream.

OPTIMIZER_HIDE_VAR(), as defined when using gcc, is insufficient to
ensure protection from dead store optimization.

For the random driver and crypto drivers, calls are emitted ...

  $ gdb vmlinux
  (gdb) disassemble memzero_explicit
  Dump of assembler code for function memzero_explicit:
    0xffffffff813a18b0 &lt;+0&gt;:	push   %rbp
    0xffffffff813a18b1 &lt;+1&gt;:	mov    %rsi,%rdx
    0xffffffff813a18b4 &lt;+4&gt;:	xor    %esi,%esi
    0xffffffff813a18b6 &lt;+6&gt;:	mov    %rsp,%rbp
    0xffffffff813a18b9 &lt;+9&gt;:	callq  0xffffffff813a7120 &lt;memset&gt;
    0xffffffff813a18be &lt;+14&gt;:	pop    %rbp
    0xffffffff813a18bf &lt;+15&gt;:	retq
  End of assembler dump.

  (gdb) disassemble extract_entropy
  [...]
    0xffffffff814a5009 &lt;+313&gt;:	mov    %r12,%rdi
    0xffffffff814a500c &lt;+316&gt;:	mov    $0xa,%esi
    0xffffffff814a5011 &lt;+321&gt;:	callq  0xffffffff813a18b0 &lt;memzero_explicit&gt;
    0xffffffff814a5016 &lt;+326&gt;:	mov    -0x48(%rbp),%rax
  [...]

... but in case in future we might use facilities such as LTO, then
OPTIMIZER_HIDE_VAR() is not sufficient to protect gcc from a possible
eviction of the memset(). We have to use a compiler barrier instead.

Minimal test example when we assume memzero_explicit() would *not* be
a call, but would have been *inlined* instead:

  static inline void memzero_explicit(void *s, size_t count)
  {
    memset(s, 0, count);
    &lt;foo&gt;
  }

  int main(void)
  {
    char buff[20];

    snprintf(buff, sizeof(buff) - 1, "test");
    printf("%s", buff);

    memzero_explicit(buff, sizeof(buff));
    return 0;
  }

With &lt;foo&gt; := OPTIMIZER_HIDE_VAR():

  (gdb) disassemble main
  Dump of assembler code for function main:
  [...]
   0x0000000000400464 &lt;+36&gt;:	callq  0x400410 &lt;printf@plt&gt;
   0x0000000000400469 &lt;+41&gt;:	xor    %eax,%eax
   0x000000000040046b &lt;+43&gt;:	add    $0x28,%rsp
   0x000000000040046f &lt;+47&gt;:	retq
  End of assembler dump.

With &lt;foo&gt; := barrier():

  (gdb) disassemble main
  Dump of assembler code for function main:
  [...]
   0x0000000000400464 &lt;+36&gt;:	callq  0x400410 &lt;printf@plt&gt;
   0x0000000000400469 &lt;+41&gt;:	movq   $0x0,(%rsp)
   0x0000000000400471 &lt;+49&gt;:	movq   $0x0,0x8(%rsp)
   0x000000000040047a &lt;+58&gt;:	movl   $0x0,0x10(%rsp)
   0x0000000000400482 &lt;+66&gt;:	xor    %eax,%eax
   0x0000000000400484 &lt;+68&gt;:	add    $0x28,%rsp
   0x0000000000400488 &lt;+72&gt;:	retq
  End of assembler dump.

As can be seen, movq, movq, movl are being emitted inlined
via memset().

Reference: http://thread.gmane.org/gmane.linux.kernel.cryptoapi/13764/
Fixes: d4c5efdb9777 ("random: add and use memzero_explicit() for clearing data")
Cc: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: mancha security &lt;mancha1@zoho.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Acked-by: Stephan Mueller &lt;smueller@chronox.de&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>lib/checksum.c: fix build for generic csum_tcpudp_nofold</title>
<updated>2015-02-11T06:48:17Z</updated>
<author>
<name>karl beldan</name>
<email>karl.beldan@gmail.com</email>
</author>
<published>2015-01-29T10:10:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1c3f3138ea06ce56ae257b8d39e3968e3d38cbd8'/>
<id>urn:sha1:1c3f3138ea06ce56ae257b8d39e3968e3d38cbd8</id>
<content type='text'>
commit 9ce357795ef208faa0d59894d9d119a7434e37f3 upstream.

Fixed commit added from64to32 under _#ifndef do_csum_ but used it
under _#ifndef csum_tcpudp_nofold_, breaking some builds (Fengguang's
robot reported TILEGX's). Move from64to32 under the latter.

Fixes: 150ae0e94634 ("lib/checksum.c: fix carry in csum_tcpudp_nofold")
Reported-by: kbuild test robot &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Karl Beldan &lt;karl.beldan@rivierawaves.com&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>lib/checksum.c: fix carry in csum_tcpudp_nofold</title>
<updated>2015-02-11T06:48:16Z</updated>
<author>
<name>karl beldan</name>
<email>karl.beldan@gmail.com</email>
</author>
<published>2015-01-28T09:58:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=229d02538b35a1fded99cdd71ceb583c7b3d56bc'/>
<id>urn:sha1:229d02538b35a1fded99cdd71ceb583c7b3d56bc</id>
<content type='text'>
commit 150ae0e94634714b23919f0c333fee28a5b199d5 upstream.

The carry from the 64-&gt;32bits folding was dropped, e.g with:
saddr=0xFFFFFFFF daddr=0xFF0000FF len=0xFFFF proto=0 sum=1,
csum_tcpudp_nofold returned 0 instead of 1.

Signed-off-by: Karl Beldan &lt;karl.beldan@rivierawaves.com&gt;
Cc: Al Viro &lt;viro@ZenIV.linux.org.uk&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Mike Frysinger &lt;vapier@gentoo.org&gt;
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>decompress_bunzip2: off by one in get_next_block()</title>
<updated>2015-01-27T15:52:33Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2014-12-13T00:58:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=42ddd03e8044fdf101ded7a56b73dd5b4b3436a6'/>
<id>urn:sha1:42ddd03e8044fdf101ded7a56b73dd5b4b3436a6</id>
<content type='text'>
commit b5c8afe5be51078a979d86ae5ae78c4ac948063d upstream.

"origPtr" is used as an offset into the bd-&gt;dbuf[] array.  That array is
allocated in start_bunzip() and has "bd-&gt;dbufSize" number of elements so
the test here should be &gt;= instead of &gt;.

Later we check "origPtr" again before using it as an offset so I don't
know if this bug can be triggered in real life.

Fixes: bc22c17e12c1 ('bzip2/lzma: library support for gzip, bzip2 and lzma decompression')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: Alain Knaff &lt;alain@knaff.lu&gt;
Cc: Yinghai Lu &lt;yinghai@kernel.org&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>lib/bitmap.c: fix undefined shift in __bitmap_shift_{left|right}()</title>
<updated>2014-11-14T16:47:59Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2014-10-29T21:50:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8b080e3470f4c01a27cc5fc8b73676300c6be12d'/>
<id>urn:sha1:8b080e3470f4c01a27cc5fc8b73676300c6be12d</id>
<content type='text'>
commit ea5d05b34aca25c066e0699512d0ffbd8ee6ac3e upstream.

If __bitmap_shift_left() or __bitmap_shift_right() are asked to shift by
a multiple of BITS_PER_LONG, they will try to shift a long value by
BITS_PER_LONG bits which is undefined.  Change the functions to avoid
the undefined shift.

Coverity id: 1192175
Coverity id: 1192174
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Cc: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>random: add and use memzero_explicit() for clearing data</title>
<updated>2014-11-14T16:47:55Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>dborkman@redhat.com</email>
</author>
<published>2014-08-27T03:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=25e1465ac3cfeafce34b3a47e773c4bc950054a3'/>
<id>urn:sha1:25e1465ac3cfeafce34b3a47e773c4bc950054a3</id>
<content type='text'>
commit d4c5efdb97773f59a2b711754ca0953f24516739 upstream.

zatimend has reported that in his environment (3.16/gcc4.8.3/corei7)
memset() calls which clear out sensitive data in extract_{buf,entropy,
entropy_user}() in random driver are being optimized away by gcc.

Add a helper memzero_explicit() (similarly as explicit_bzero() variants)
that can be used in such cases where a variable with sensitive data is
being cleared out in the end. Other use cases might also be in crypto
code. [ I have put this into lib/string.c though, as it's always built-in
and doesn't need any dependencies then. ]

Fixes kernel bugzilla: 82041

Reported-by: zatimend@hotmail.co.uk
Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>lzo: check for length overrun in variable length encoding.</title>
<updated>2014-10-30T16:35:11Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2014-09-27T10:31:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=96894152592785638ba49e3a55c5bc218aafc49e'/>
<id>urn:sha1:96894152592785638ba49e3a55c5bc218aafc49e</id>
<content type='text'>
commit 72cf90124e87d975d0b2114d930808c58b4c05e4 upstream.

This fix ensures that we never meet an integer overflow while adding
255 while parsing a variable length encoding. It works differently from
commit 206a81c ("lzo: properly check for overruns") because instead of
ensuring that we don't overrun the input, which is tricky to guarantee
due to many assumptions in the code, it simply checks that the cumulated
number of 255 read cannot overflow by bounding this number.

The MAX_255_COUNT is the maximum number of times we can add 255 to a base
count without overflowing an integer. The multiply will overflow when
multiplying 255 by more than MAXINT/255. The sum will overflow earlier
depending on the base count. Since the base count is taken from a u8
and a few bits, it is safe to assume that it will always be lower than
or equal to 2*255, thus we can always prevent any overflow by accepting
two less 255 steps.

This patch also reduces the CPU overhead and actually increases performance
by 1.1% compared to the initial code, while the previous fix costs 3.1%
(measured on x86_64).

The fix needs to be backported to all currently supported stable kernels.

Reported-by: Willem Pinckaers &lt;willem@lekkertech.net&gt;
Cc: "Don A. Bailey" &lt;donb@securitymouse.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Revert "lzo: properly check for overruns"</title>
<updated>2014-10-30T16:35:11Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2014-09-27T10:31:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f7939e1eb8de872933fc2e3fa9934aa55567a541'/>
<id>urn:sha1:f7939e1eb8de872933fc2e3fa9934aa55567a541</id>
<content type='text'>
commit af958a38a60c7ca3d8a39c918c1baa2ff7b6b233 upstream.

This reverts commit 206a81c ("lzo: properly check for overruns").

As analysed by Willem Pinckaers, this fix is still incomplete on
certain rare corner cases, and it is easier to restart from the
original code.

Reported-by: Willem Pinckaers &lt;willem@lekkertech.net&gt;
Cc: "Don A. Bailey" &lt;donb@securitymouse.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>lib/btree.c: fix leak of whole btree nodes</title>
<updated>2014-08-07T21:30:27Z</updated>
<author>
<name>Minfei Huang</name>
<email>huangminfei@ucloud.cn</email>
</author>
<published>2014-06-04T23:11:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=81513d14716eb555b443e7e2e2b862f094f8b731'/>
<id>urn:sha1:81513d14716eb555b443e7e2e2b862f094f8b731</id>
<content type='text'>
commit c75b53af2f0043aff500af0a6f878497bef41bca upstream.

I use btree from 3.14-rc2 in my own module.  When the btree module is
removed, a warning arises:

 kmem_cache_destroy btree_node: Slab cache still has objects
 CPU: 13 PID: 9150 Comm: rmmod Tainted: GF          O 3.14.0-rc2 #1
 Hardware name: Inspur NF5270M3/NF5270M3, BIOS CHEETAH_2.1.3 09/10/2013
 Call Trace:
   dump_stack+0x49/0x5d
   kmem_cache_destroy+0xcf/0xe0
   btree_module_exit+0x10/0x12 [btree]
   SyS_delete_module+0x198/0x1f0
   system_call_fastpath+0x16/0x1b

The cause is that it doesn't release the last btree node, when height = 1
and fill = 1.

[akpm@linux-foundation.org: remove unneeded test of NULL]
Signed-off-by: Minfei Huang &lt;huangminfei@ucloud.cn&gt;
Cc: Joern Engel &lt;joern@logfs.org&gt;
Cc: Johannes Berg &lt;johannes@sipsolutions.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
