public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Different old_mmap behavior between  2.4.5 and 2.4.8
@ 2001-09-11  1:30 Bao C. Ha
  2001-09-11  1:49 ` Benjamin LaHaise
  0 siblings, 1 reply; 3+ messages in thread
From: Bao C. Ha @ 2001-09-11  1:30 UTC (permalink / raw)
  To: linux-kernel


We are moving from kernel 2.4.5 to kernel 2.4.8 and above.
One of our applications broke due to different behaviors
of the system call old_mmap.

In kernel 2.4.5:
307   old_mmap(0x7b7f7000, 36864, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7b7f7000

In kernel 2.4.8:
[pid   313] old_mmap(0x7b7f7000, 36864, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7b7f8000

In 2.4.5, we request 0x7b7f7000 and get the same area back.
In 2.4.8, we also request 0x7b7f7000, but we are getting a
different area pointed by 0x7b7f8000.

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.

Appreciate any pointers/suggestions.

Thanks.
Bao


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

* Re: Different old_mmap behavior between  2.4.5 and 2.4.8
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin LaHaise @ 2001-09-11  1:49 UTC (permalink / raw)
  To: Bao C. Ha; +Cc: linux-kernel

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.

		-ben

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

* RE: Different old_mmap behavior between  2.4.5 and 2.4.8
  2001-09-11  1:49 ` Benjamin LaHaise
@ 2001-09-11 18:31   ` Bao C. Ha
  0 siblings, 0 replies; 3+ messages in thread
From: Bao C. Ha @ 2001-09-11 18:31 UTC (permalink / raw)
  To: 'Benjamin LaHaise'; +Cc: linux-kernel

> 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



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

end of thread, other threads:[~2001-09-11 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox