public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bao C. Ha" <baoha@sensoria.com>
To: "'Benjamin LaHaise'" <bcrl@redhat.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: Different old_mmap behavior between  2.4.5 and 2.4.8
Date: Tue, 11 Sep 2001 11:31:22 -0700	[thread overview]
Message-ID: <02b701c13aef$f59f0a00$456c020a@SENSORIA> (raw)
In-Reply-To: <20010910214946.A16760@redhat.com>

> On Mon, Sep 10, 2001 at 06:30:55PM -0700, Bao C. Ha wrote:
> > Is this supposed to be the correct behavior?  What changes 
> > make the newer kernels to return different pointers?  We
> > are running on the sh4 architecture but I think these calls
> > come from malloc() which should be arch-independent.
> 
> The result from earlier kernels is wrong.  If your code 
> requires that the same address is returned as was specified 
> then you need to pass in the MAP_FIXED flag.

Unfortunately, it is the linuxthreads code that is broken
on the sh4 platform.  It seems that the pointers are moved 
due to cache aliasing.  I am trying to raise awareness that
this is breaking pthreads applications on sh4-linux.

Following is the relevant segment of linuxthreads that is
broken:

In function pthread_allocate_stack(), file manager.c:
.......
#  ifdef _STACK_GROWS_DOWN
      new_thread = default_new_thread;
      new_thread_bottom = (char *) (new_thread + 1) - stacksize;
      map_addr = new_thread_bottom - guardsize;
      res_addr = mmap(map_addr, stacksize + guardsize,
                      PROT_READ | PROT_WRITE | PROT_EXEC,
                      MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
      if (res_addr != map_addr)
        {
          /* Bad luck, this segment is already mapped. */
          if (res_addr != MAP_FAILED)
            munmap (res_addr, stacksize + guardsize);
          return -1;
        }
.......

We resort to patching the MAP_FIXED back to linuxthreads
until we get a resolution on this problem.

Thanks.
Bao



      reply	other threads:[~2001-09-11 18:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-11  1:30 Different old_mmap behavior between 2.4.5 and 2.4.8 Bao C. Ha
2001-09-11  1:49 ` Benjamin LaHaise
2001-09-11 18:31   ` Bao C. Ha [this message]

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='02b701c13aef$f59f0a00$456c020a@SENSORIA' \
    --to=baoha@sensoria.com \
    --cc=bcrl@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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