linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* checkstack.pl <large_number>
@ 2005-02-18 19:12 Randy.Dunlap
  2005-02-21 12:38 ` Jörn Engel
  0 siblings, 1 reply; 2+ messages in thread
From: Randy.Dunlap @ 2005-02-18 19:12 UTC (permalink / raw)
  To: joern, lkml

Hi,

In checkstack.pl, do you recall the reason for this code snippet:

		if ($size > 0x80000000) {
			$size = - $size;
			$size += 0x80000000;
			$size += 0x80000000;
		}

There is one (unusual:) case where it fails.  Is it needed?

For arch/i386/kernel/efi_stub.S, checkstack reports:

0xc0116f5d efi_call_phys:				1073741824
which is 0x4000_0000 (_ added for readability only), however the
actual change in %esp there is __PAGE_OFFSET (0xc000_0000 on ia32),

so if I alter the "if" test above to check for > 0xf000_0000,
checkstack reports the correct value:
0xc0116f5d efi_call_phys:				3221225472
which is 0xc000_0000.


from objdump of efi_stub.o:
    5:	81 ea 00 00 00 c0    	sub    $0xc0000000,%edx

or I can just ignore it, like I've been doing for awhile...

-- 
~Randy

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

* Re: checkstack.pl <large_number>
  2005-02-18 19:12 checkstack.pl <large_number> Randy.Dunlap
@ 2005-02-21 12:38 ` Jörn Engel
  0 siblings, 0 replies; 2+ messages in thread
From: Jörn Engel @ 2005-02-21 12:38 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: lkml

On Fri, 18 February 2005 11:12:45 -0800, Randy.Dunlap wrote:
> 
> In checkstack.pl, do you recall the reason for this code snippet:
> 
> 		if ($size > 0x80000000) {
> 			$size = - $size;
> 			$size += 0x80000000;
> 			$size += 0x80000000;
> 		}
> 
> There is one (unusual:) case where it fails.  Is it needed?

Something like this is needed, also for unusual cases.  gcc sometimes
decides to switch "sub 16" with "add -16".  Later, when the stack
frame is popped back, the exchange goes vice versa.

Without this code, you'd see a few cases of nearly 4GiB.

> For arch/i386/kernel/efi_stub.S, checkstack reports:
> 
> 0xc0116f5d efi_call_phys:				1073741824
> which is 0x4000_0000 (_ added for readability only), however the
> actual change in %esp there is __PAGE_OFFSET (0xc000_0000 on ia32),
> 
> so if I alter the "if" test above to check for > 0xf000_0000,
> checkstack reports the correct value:
> 0xc0116f5d efi_call_phys:				3221225472
> which is 0xc000_0000.
> 
> 
> from objdump of efi_stub.o:
>    5:	81 ea 00 00 00 c0    	sub    $0xc0000000,%edx
> 
> or I can just ignore it, like I've been doing for awhile...

Changing 0x8000_0000 to 0xf000_0000 would work for the add case as
well.  Sounds like a sane change.

Checkstack could also do the ignoring for you, maybe like this:
	if ($size > 0xf0000000) {
		$size = - $size;
		$size += 0x80000000;
		$size += 0x80000000;
	}
	if ($size > 0x10000000) {
		$size = 0;
	}

Jörn

-- 
Ninety percent of everything is crap.
-- Sturgeon's Law

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

end of thread, other threads:[~2005-02-21 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-18 19:12 checkstack.pl <large_number> Randy.Dunlap
2005-02-21 12:38 ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).