public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Bombe <andreas.bombe@munich.netsurf.de>
To: Xavier Bestel <xavier.bestel@free.fr>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Is this the ultimate stack-smash fix?
Date: Wed, 21 Feb 2001 01:13:03 +0100	[thread overview]
Message-ID: <20010221011303.A3045@storm.local> (raw)
In-Reply-To: <3A899FEB.D54ABBC7@sympatico.ca> <m1lmr98c5t.fsf@frodo.biederman.org> <3A8ADA30.2936D3B1@sympatico.ca> <m1hf1w8qea.fsf@frodo.biederman.org> <3A8BF5ED.1C12435A@colorfullife.com> <m1k86s6imn.fsf@frodo.biederman.org> <20010217084330.A17398@cadcamlab.org> <m1y9v4382r.fsf@frodo.biederman.org> <20010220021012.A1481@storm.local> <200102200909.KAA12190@microsoft.com>
In-Reply-To: <200102200909.KAA12190@microsoft.com>; from xavier.bestel@free.fr on Tue, Feb 20, 2001 at 10:09:55AM +0100

On Tue, Feb 20, 2001 at 10:09:55AM +0100, Xavier Bestel wrote:
> Le 20 Feb 2001 02:10:12 +0100, Andreas Bombe a écrit :
> > On Sat, Feb 17, 2001 at 09:53:48PM -0700, Eric W. Biederman wrote:
> > > Peter Samuelson <peter@cadcamlab.org> writes:
> > > > It also sounds like you will be
> > > > breaking the extremely useful C postulate that, at the ABI level at
> > > > least, arrays and pointers are equivalent.  I can't see *how* you plan
> > > > to work around that one.
> > > 
> > > Huh?  Pointers and arrays are clearly different at the ABI level.
> > > 
> > > A pointer is a word that contains an address of something.
> > > An array is an array.
> > 
> > An array is a word that contains the address of the first element.
> 
> 
> No. Exercise 3: compile and run this:
> file a.c:
> char array[] = "I'm really an array";
> 
> file b.c:
> extern char* array;
>
> main() { printf("array = %s\n", array); }
> 
> ... and watch it biting the dust !

Deliberately linking to the wrong symbol is not a point.  Might as well
replace file a.c with "int array = 0;".  That'll also bite the dust.  So?

> in short: an array is NOT a pointer.

In this context we were talking *function calls*, not confusing the
linker.  And whether you say "char array[];" or "char *const array;",
array is a pointer.  Even more so at the ABI = function call interface.

Another try:  Assume that
	#include "secret.h"
	int main() { printf("array = %s\n", array); return 0; }
is correct code.

Is the variable array a pointer to a char or an array of chars?

Oh well, who cares.

-- 
 Andreas E. Bombe <andreas.bombe@munich.netsurf.de>    DSA key 0x04880A44
http://home.pages.de/~andreas.bombe/    http://linux1394.sourceforge.net/

  parent reply	other threads:[~2001-02-21  0:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-13 20:58 Is this the ultimate stack-smash fix? Jeremy Jackson
2001-02-13 21:06 ` Alan Cox
2001-02-13 21:22 ` James Sutherland
2001-02-13 23:04   ` Bruce Harada
2001-02-13 23:14 ` William T Wilson
2001-02-14 16:25 ` Eric W. Biederman
2001-02-14 19:19   ` Jeremy Jackson
2001-02-14 20:43     ` Gerhard Mack
2001-02-15  5:30     ` Eric W. Biederman
2001-02-15 15:29       ` Manfred Spraul
2001-02-15 16:00         ` Eric W. Biederman
2001-02-17 14:43           ` Peter Samuelson
2001-02-18  4:53             ` Eric W. Biederman
2001-02-20  1:10               ` Andreas Bombe
2001-02-20  9:09                 ` Xavier Bestel
2001-02-20 16:40                   ` Jeremy Jackson
2001-02-20 17:04                     ` Xavier Bestel
2001-02-21  0:13                   ` Andreas Bombe [this message]
2001-02-21  9:30                     ` Xavier Bestel
2001-02-15 15:32       ` Jeremy Jackson
2001-02-17 10:47   ` Florian Weimer
2001-02-17 20:32     ` Alan Cox

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=20010221011303.A3045@storm.local \
    --to=andreas.bombe@munich.netsurf.de \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xavier.bestel@free.fr \
    /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