* [PATCH] safety check in claim_heap()
@ 2008-01-20 14:22 Robert Millan
2008-01-21 18:07 ` Marco Gerards
0 siblings, 1 reply; 5+ messages in thread
From: Robert Millan @ 2008-01-20 14:22 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 356 bytes --]
Hi!
What do you think of adding this kind of checks? I know it's not a
perfect safegard, but it can save your day in some situations (it helped
me during i386/ieee1275 port, when link address was 0x100000).
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
[-- Attachment #2: claim_safety.diff --]
[-- Type: text/x-diff, Size: 884 bytes --]
--- ../../grub2/kern/powerpc/ieee1275/init.c 2008-01-14 15:30:59.000000000 +0100
+++ kern/powerpc/ieee1275/init.c 2008-01-20 15:20:23.000000000 +0100
@@ -143,6 +143,17 @@
(total + (HEAP_MAX_ADDR - addr) > HEAP_MIN_SIZE)) /* only limit ourselves when we can afford to */
len = HEAP_MAX_ADDR - addr;
+ /* In theory, firmware should already prevent this from happening by not
+ listing our own image in /memory/available. The check below is intended
+ as a safegard in case that doesn't happen. It does, however, not protect
+ us from corrupting our module area, which extends up to a
+ yet-undetermined region above _end. */
+ if ((addr < _end) && ((addr + len) > _start))
+ {
+ grub_printf ("Warning: attempt to claim over our own code!\n");
+ len = 0;
+ }
+
if (len)
{
/* Claim and use it. */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] safety check in claim_heap()
2008-01-20 14:22 [PATCH] safety check in claim_heap() Robert Millan
@ 2008-01-21 18:07 ` Marco Gerards
2008-01-21 21:01 ` Robert Millan
0 siblings, 1 reply; 5+ messages in thread
From: Marco Gerards @ 2008-01-21 18:07 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
Hi,
> What do you think of adding this kind of checks? I know it's not a
> perfect safegard, but it can save your day in some situations (it helped
> me during i386/ieee1275 port, when link address was 0x100000).
If this fixes the i386-ieee1275 port, this is fine to me.
--
Marco
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] safety check in claim_heap()
2008-01-21 18:07 ` Marco Gerards
@ 2008-01-21 21:01 ` Robert Millan
2008-01-21 21:11 ` Marco Gerards
0 siblings, 1 reply; 5+ messages in thread
From: Robert Millan @ 2008-01-21 21:01 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Jan 21, 2008 at 07:07:37PM +0100, Marco Gerards wrote:
> Robert Millan <rmh@aybabtu.com> writes:
>
> Hi,
>
> > What do you think of adding this kind of checks? I know it's not a
> > perfect safegard, but it can save your day in some situations (it helped
> > me during i386/ieee1275 port, when link address was 0x100000).
>
> If this fixes the i386-ieee1275 port, this is fine to me.
It isn't currently needed by either of the i386-ieee1275 targets (qemu and
xo).
However, it was during an earlier stage of the port in which link address
was 0x100000 rather than 0x10000.
My question is whether it makes sense as a general safety check.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] safety check in claim_heap()
2008-01-21 21:01 ` Robert Millan
@ 2008-01-21 21:11 ` Marco Gerards
2008-01-22 20:09 ` Robert Millan
0 siblings, 1 reply; 5+ messages in thread
From: Marco Gerards @ 2008-01-21 21:11 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
> On Mon, Jan 21, 2008 at 07:07:37PM +0100, Marco Gerards wrote:
>> Robert Millan <rmh@aybabtu.com> writes:
>>
>> Hi,
>>
>> > What do you think of adding this kind of checks? I know it's not a
>> > perfect safegard, but it can save your day in some situations (it helped
>> > me during i386/ieee1275 port, when link address was 0x100000).
>>
>> If this fixes the i386-ieee1275 port, this is fine to me.
>
> It isn't currently needed by either of the i386-ieee1275 targets (qemu and
> xo).
>
> However, it was during an earlier stage of the port in which link address
> was 0x100000 rather than 0x10000.
>
> My question is whether it makes sense as a general safety check.
Well, if it isn't going to occur with the current firmware
implementations, I do not see the use. But it will not hurt either.
Simply, I do not care either way... I leave this up to you ;-)
--
Marco
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] safety check in claim_heap()
2008-01-21 21:11 ` Marco Gerards
@ 2008-01-22 20:09 ` Robert Millan
0 siblings, 0 replies; 5+ messages in thread
From: Robert Millan @ 2008-01-22 20:09 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Jan 21, 2008 at 10:11:42PM +0100, Marco Gerards wrote:
> > My question is whether it makes sense as a general safety check.
>
> Well, if it isn't going to occur with the current firmware
> implementations, I do not see the use. But it will not hurt either.
> Simply, I do not care either way... I leave this up to you ;-)
Ok, I checked that in.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-22 20:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-20 14:22 [PATCH] safety check in claim_heap() Robert Millan
2008-01-21 18:07 ` Marco Gerards
2008-01-21 21:01 ` Robert Millan
2008-01-21 21:11 ` Marco Gerards
2008-01-22 20:09 ` Robert Millan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.