Skip to contentSkip to conversation

Fix ARM PIC problems with new decompressor code

PATCH In review Russell King 2 participants 3 messages Feb 28, 2010 – Mar 2, 2010 2 messages not in the archive Generic include/asm header files

lore
Share & tools
lore
#2 lore raw

PATCH 1/1 Fix ARM PIC problems with new decompressor code

In reply to a message not in the archive
Quoted 4 lines · Alain Knaff

Yes, that should be fine. So it would be static in full kernel context (initrd decompression) but global in preboot. As long as it doesn't clash with other variables of the same name, but I think that's rather unlikely in the "small" preboot environment.

Here's a patch to this end. I decided to change the name of the define to something more sensible.

Are we happy with this? Shall I queue it for merging? I'd be nice to get this into -stable as well as some other fixes for this feature.

Subject: Fix new decompressor for PIC

The ARM kernel decompressor wants to be able to relocate r/w data independently from the rest of the image, and we do this by ensuring that r/w data has global visibility. Define STATIC_RW_DATA to be empty to achieve this.

Signature · 2 lines
 include/linux/decompress/mm.h |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
include/linux/decompress/mm.h +12 -2
index 5032b9a..278e6c8 100644
@@ -14,11 +14,21 @@
 
 /* Code active when included from pre-boot environment: */
 
+/*
+ * Some architectures want to ensure there is no local data in their
+ * pre-boot environment, so that data can arbitarily relocated (via
+ * GOT references).  This is achieved by defining STATIC_RW_DATA to
+ * be null.
+ */
+#ifndef STATIC_RW_DATA
+#define STATIC_RW_DATA static
+#endif
+
 /* A trivial malloc implementation, adapted from
  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  */
-static unsigned long malloc_ptr;
-static int malloc_count;
+STATIC_RW_DATA unsigned long malloc_ptr;
+STATIC_RW_DATA int malloc_count;
 
 static void *malloc(int size)
 {
Signature · 1 line
Russell King
#3 lore raw
Quoted 10 lines · On Sun, 28 Feb 2010 15:49:08 +0000 Russell King <[email protected]> wrote:
Quoted 4 lines · Alain Knaff

Yes, that should be fine. So it would be static in full kernel context (initrd decompression) but global in preboot. As long as it doesn't clash with other variables of the same name, but I think that's rather unlikely in the "small" preboot environment.

Here's a patch to this end. I decided to change the name of the define to something more sensible.

Are we happy with this? Shall I queue it for merging?

I grabbed it, but you can preempt that by merging it if that's more convenient.

Quoted 3 lines

I'd be nice
to get this into -stable as well as some other fixes for this feature.

I don't think I've seen any other fixes.

#4 lore raw
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Sun, 28 Feb 2010 15:49:08 +0000 Russell King <[email protected]> wrote:
Quoted 4 lines · Alain Knaff

Yes, that should be fine. So it would be static in full kernel context (initrd decompression) but global in preboot. As long as it doesn't clash with other variables of the same name, but I think that's rather unlikely in the "small" preboot environment.

Quoted 7 lines
Quoted 4 lines

Here's a patch to this end. I decided to change the name of the define to something more sensible.

Are we happy with this? Shall I queue it for merging?

I grabbed it, but you can preempt that by merging it if that's more convenient.

Thanks.

Quoted 5 lines
Quoted 3 lines

I'd be nice
to get this into -stable as well as some other fixes for this feature.

I don't think I've seen any other fixes.

There's one other in my tree on the same subject in the master branch, but it's ARM specific.

I'll need an additional patch to define this new STATIC_RW_DATA, so it probably makes sense for me to collect up all three patches. Main reason was to let you see it and check that it passes your taste test. ;)

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of: