RE: Stack expansion on ia64

From: David Mosberger <davidm_at_napali.hpl.hp.com>
Date: 2003-06-26 10:03:53
>>>>> On Wed, 25 Jun 2003 16:41:30 -0700, "Luck, Tony" <tony.luck@intel.com> said:

  >> If you want to prevent "unreasonable" stack growth, there are
  >> already multiple, perfectly good solutions:

  >> - use RLIMIT_STACK to limit growth - install a guard page

  Tony> This program:

  Tony>   main() { int local[1];

  Tony>         printf("%d\n", local[-10000]); }

  Tony> gets a SIGSEGV on x86 (correct behaivour), but prints 0 on
  Tony> ia64.

  Tony> Now the program is contrived for simplicity sake, but real
  Tony> people write real programs with bogus pointers.  I'd much
  Tony> rather debug a SIGSEGV that hits the instant I dereference the
  Tony> pointer than try to figure out where the '0' came from a
  Tony> hundred procedure calls later!

That's a bogus argument.  If you replace the -10000 with +10000 the
program is equally buggy but chances are you won't get a SIGSEGV.

If you want range-checked arrays, don't use C.

BTW: as per my previous mail: the extra check would make a lot more
sense if it first ascertained that the stack-pointer is actually
inside the vm_area in question.

	--david
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jun 25 20:05:23 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:15 EST