public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] bitops: Change bitmap index from int to unsigned long
@ 2009-02-25  4:41 Justin Chen
  2009-02-25  6:54 ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Justin Chen @ 2009-02-25  4:41 UTC (permalink / raw)
  To: linux-arch; +Cc: bjorn.helgaas, justin.chen, linux-kernel

This patch is to change the bitmap index in the bitops from "int" to "unsigned long".

In many bitops implementations, the bitmap index is a signed int.  If the caller passes a large unsigned integer and we interpret it as being negative, we compute an address outside the bitmap.  This can cause memory corruption or other errors.

The issue that triggered me to do this change is the routine mark_bootmem_node() while we ran on an ia64 box with large memory.  As long as the EFI maps the available memory chunk at the physical address 0x200000000000 (or above), the routine mark_bootmem_node() will get the start PFN>=0x80000000.  While it calls the __free() with this sidx=0x80000000 (bit31 set), the bitops (test_and_clear_bit) will treat this idx as a negative number since it accepts it as an "int".  It turns out the memory outside the bitmap will be corrupted.

Following 15 patches will change all the bitmap index "nr" in all bitops from "int" to "unsigned long".

The patch is based on 2.6.29-rc6

Please comment -

--jchen

(00/15): intro
(01/15): generic
(02/15): arm
(03/15): avr32
(04/15): blackfin
(05/15): cris
(06/15): h8300
(07/15): ia64
(08/15): m68k
(09/15): mn10300
(10/15): parisc
(11/15): powerpc
(12/15): sh
(13/15): x86
(14/15): frv
(15/15): m32r

 arch/arm/include/asm/bitops.h           |   39 +++++++++-------
 arch/arm/lib/changebit.S                |    2 
 arch/arm/lib/clearbit.S                 |    2 
 arch/arm/lib/setbit.S                   |    2 
 arch/avr32/include/asm/bitops.h         |   12 ++---
 arch/blackfin/include/asm/bitops.h      |   74 +++++++++++++++++++-------------
 arch/cris/include/asm/bitops.h          |    9 ++-
 arch/h8300/include/asm/bitops.h         |    8 +-
 arch/ia64/include/asm/bitops.h          |   30 ++++++------
 arch/ia64/include/asm/sync_bitops.h     |   21 ++++++---
 arch/m68k/include/asm/bitops_mm.h       |   63 ++++++++++++++++-----------
 arch/m68k/include/asm/bitops_no.h       |   34 +++++++++-----
 arch/mn10300/lib/bitops.c               |    4 -
 arch/parisc/include/asm/bitops.h        |   12 ++---
 arch/powerpc/include/asm/bitops.h       |   14 +++---
 arch/sh/include/asm/bitops-grb.h        |   12 ++---
 arch/sh/include/asm/bitops-llsc.h       |   12 ++---
 arch/sh/include/asm/bitops-op32.h       |   19 ++++----
 arch/x86/boot/bitops.h                  |    6 +-
 arch/x86/include/asm/bitops.h           |   48 +++++++++++++-------
 arch/x86/include/asm/sync_bitops.h      |   18 +++++--
 include/asm-frv/bitops.h                |   29 ++++++------
 include/asm-generic/bitops/atomic.h     |   17 ++++---
 include/asm-generic/bitops/non-atomic.h |   19 ++++----
 include/asm-m32r/bitops.h               |   14 +++---
 include/asm-mn10300/bitops.h            |   12 ++---
 26 files changed, 307 insertions(+), 219 deletions(-)

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

end of thread, other threads:[~2009-02-25 16:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25  4:41 [PATCH 00/15] bitops: Change bitmap index from int to unsigned long Justin Chen
2009-02-25  6:54 ` Peter Zijlstra
2009-02-25 15:37   ` Matthew Wilcox
2009-02-25 15:46     ` Peter Zijlstra
2009-02-25 15:46       ` Peter Zijlstra
2009-02-25 15:53       ` Matthew Wilcox
2009-02-25 16:03         ` Peter Zijlstra

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