mmap(2) with MAP_ANON honouring offset although it shouldn't

View: New views
3 Messages — Rating Filter:   Alert me  

mmap(2) with MAP_ANON honouring offset although it shouldn't

by Alexander Best :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

no problem. i've sent the final patch as followup to kern/71258 and also
attached it to this message. to make it short. what's being changed by the
patch:

1) if MAP_ANON is defined and offset !=0  ====>  return EINVAL
2) if MAP_STACK is defined and offset !=0   ====>  offset = 0

would be great if you could have a look at the patch if you've got a spare
minute.

cheers.
alex

Index: sys/vm/vm_mmap.c
===================================================================
--- sys/vm/vm_mmap.c (revision 199016)
+++ sys/vm/vm_mmap.c (working copy)
@@ -244,6 +244,9 @@
  pos = 0;
  }
 
+ if (flags & MAP_ANON && pos != 0)
+ return (EINVAL);
+
  /*
  * Align the file position to a page boundary,
  * and save its page offset component.
@@ -300,7 +303,6 @@
  handle = NULL;
  handle_type = OBJT_DEFAULT;
  maxprot = VM_PROT_ALL;
- pos = 0;
  } else {
  /*
  * Mapping file, get fp for validation and

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: mmap(2) with MAP_ANON honouring offset although it shouldn't

by John Baldwin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 07 November 2009 9:19:05 pm Alexander Best wrote:
> no problem. i've sent the final patch as followup to kern/71258 and also
> attached it to this message. to make it short. what's being changed by the
> patch:
>
> 1) if MAP_ANON is defined and offset !=0  ====>  return EINVAL
> 2) if MAP_STACK is defined and offset !=0   ====>  offset = 0
>
> would be great if you could have a look at the patch if you've got a spare
> minute.

I didn't think 2) changed?  I.e. both the old and new code do this, so only 1)
is changing?

--
John Baldwin
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."

Re: mmap(2) with MAP_ANON honouring offset although it shouldn't

by Alexander Best-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John Baldwin schrieb am 2009-11-09:
> On Saturday 07 November 2009 9:19:05 pm Alexander Best wrote:
> > no problem. i've sent the final patch as followup to kern/71258 and
> > also
> > attached it to this message. to make it short. what's being changed
> > by the
> > patch:

> > 1) if MAP_ANON is defined and offset !=0  ====>  return EINVAL
> > 2) if MAP_STACK is defined and offset !=0   ====>  offset = 0

> > would be great if you could have a look at the patch if you've got
> > a spare
> > minute.

> I didn't think 2) changed?  I.e. both the old and new code do this,
> so only 1)
> is changing?

you're right sorry about that mistake. so the only aspect of mmap() the patch
changes is:

if MAP_ANON is defined and offset !=0  ====>  return EINVAL

cheers.
alex
_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."