From: Justin Chen <jchen@hpdst41.cup.hp.com>
To: linux-arch@vger.kernel.org
Cc: bjorn.helgaas@hp.com, justin.chen@hp.com, linux-kernel@vger.kernel.org
Subject: [PATCH 00/15] bitops: Change bitmap index from int to unsigned long
Date: Tue, 24 Feb 2009 20:41:15 -0800 (PST) [thread overview]
Message-ID: <200902250441.UAA12527@hpdst41.cup.hp.com> (raw)
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(-)
next reply other threads:[~2009-02-25 4:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 4:41 Justin Chen [this message]
2009-02-25 6:54 ` [PATCH 00/15] bitops: Change bitmap index from int to unsigned long 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200902250441.UAA12527@hpdst41.cup.hp.com \
--to=jchen@hpdst41.cup.hp.com \
--cc=bjorn.helgaas@hp.com \
--cc=justin.chen@hp.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox