public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] lib/mpi: bug fixes and cleanup
@ 2016-03-17 17:59 Nicolai Stange
  2016-03-17 17:59 ` [PATCH 1/8] lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs Nicolai Stange
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Nicolai Stange @ 2016-03-17 17:59 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Tadeusz Struk, Michal Marek, Andrzej Zaborowski, Stephan Mueller,
	Arnd Bergmann, linux-kernel, Nicolai Stange

With linux-next-20160317, KASAN splats for both, mpi_write_sgl()
and mpi_read_buffer().

While the first isn't dramatic on x86 (as long as it doesn't fault),
the latter potentially overwrites unrelated memory.

These two issues are fixed by

  [4/8] ("lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access")

and

  [8/8] ("lib/mpi: mpi_read_buffer(): fix buffer overflow")


While reviewing the code, I found another bug, c.f.

  [1/8] ("lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs")


The rest are cleanup/style patches I couldn't hold back ;)

There is still room for improvement in that the leading zero handling
could get easily moved out of the loop, but that's not the business of
this series.


Specifically. this patchset fixes

  2d4d1eea540b ("lib/mpi: Add mpi sgl helpers")

and

  9cbe21d8f89d ("lib/mpi: only require buffers as big as needed for
                 the integer")


 
This series is applicable to linux-next-20160317.


Nicolai Stange (8):
  lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs
  lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement
  lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic
  lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access
  lib/mpi: mpi_write_sgl(): replace open coded endian conversion
  lib/mpi: mpi_read_buffer(): optimize skipping of leading zero limbs
  lib/mpi: mpi_read_buffer(): replace open coded endian conversion
  lib/mpi: mpi_read_buffer(): fix buffer overflow

 lib/mpi/mpicoder.c | 91 ++++++++++++++++++++----------------------------------
 1 file changed, 33 insertions(+), 58 deletions(-)

-- 
2.7.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-03-20 12:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 17:59 [PATCH 0/8] lib/mpi: bug fixes and cleanup Nicolai Stange
2016-03-17 17:59 ` [PATCH 1/8] lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs Nicolai Stange
2016-03-17 18:00 ` [PATCH 2/8] lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement Nicolai Stange
2016-03-17 18:00 ` [PATCH 3/8] lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic Nicolai Stange
2016-03-17 18:00 ` [PATCH 4/8] lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access Nicolai Stange
2016-03-17 18:00 ` [PATCH 5/8] lib/mpi: mpi_write_sgl(): replace open coded endian conversion Nicolai Stange
2016-03-17 18:00 ` [PATCH 6/8] lib/mpi: mpi_read_buffer(): optimize skipping of leading zero limbs Nicolai Stange
2016-03-17 18:00 ` [PATCH 7/8] lib/mpi: mpi_read_buffer(): replace open coded endian conversion Nicolai Stange
2016-03-17 18:00 ` [PATCH 8/8] lib/mpi: mpi_read_buffer(): fix buffer overflow Nicolai Stange
2016-03-20 12:40 ` [PATCH 0/8] lib/mpi: bug fixes and cleanup Nicolai Stange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox