Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAP_ANON and MAP_ANONYMOUS #24

Closed
kinichiro opened this issue Jul 22, 2014 · 7 comments
Closed

MAP_ANON and MAP_ANONYMOUS #24

kinichiro opened this issue Jul 22, 2014 · 7 comments

Comments

@kinichiro
Copy link
Contributor

I think MAP_ANON should be replaced with MAP_ANONYMOUS.

Seeing this
http://austingroupbugs.net/view.php?id=850
I noticed these descriptions.

  • MAP_ANON is synonym for MAP_ANONYMOUS
  • MAP_ANON shall have the same value as MAP_ANONYMOUS

It seems that MAP_ANONYMOUS will be more common than MAP_ANON.

constant MAP_ANON is used in these files.
./crypto/compat/getentropy_linux.c
./crypto/compat/arc4random_linux.h
./crypto/compat/getentropy_solaris.c
./crypto/compat/arc4random_solaris.h
./crypto/compat/getentropy_osx.c
./crypto/compat/arc4random_osx.h
./tests/arc4randomforktest.c

Thanks.

@bob-beck
Copy link
Contributor

What platform is this an issue on?

@kinichiro
Copy link
Contributor Author

Hi,
HP-UX 11.31 itanium without gcc.
I checked header files, too.

@kinichiro
Copy link
Contributor Author

I checked mmap man page of several platforms on the WWW.
And I listed that MAP_ANON and MAP_ANONYMOUS are supported or not.

                 MAP_ANON  MAP_ANONYMOUS
    OpenBSD         Y         Y(*)
    Linux           Y(*)      Y
    FreeBSD         Y         Y
    NetBSD          Y         N
    OSX             Y         N
    Solaris         Y         N
    HP-UX           N         Y
    AIX             N         Y
    IRIX            N         N
    (*) synonym to other

Simply replacing MAP_ANON with MAP_ANONYMOUS will cause another issue, sorry.

Instead of replacing, how about adding define, like this.

    #ifndef MAP_ANONYMOUS
    #define MAP_ANONYMOUS MAP_ANON
    #endif

Thanks.

@busterb
Copy link
Contributor

busterb commented Jul 30, 2014

We added a compat definition in af705b3

@busterb busterb closed this as completed Jul 30, 2014
@kinichiro
Copy link
Contributor Author

Sorry,
If LibreSSL keeps using MAP_ANON, this include/sys/mman.h fix should be like this.

#ifndef MAP_ANON
#ifdef MAP_ANONYMOUS
#define MAP_ANON MAP_ANONYMOUS
#else
#error "System does not support mapping anonymous pages?"
#endif
#endif

My recommendation was wrong.
This fix should be for the platform that does NOT define MAP_ANON but MAP_ANONYMOUS.
Sorry, again.

@busterb
Copy link
Contributor

busterb commented Jul 31, 2014

I see. Thanks for the note, this is now fixed.

@kinichiro
Copy link
Contributor Author

Thanks for everything, busterb.
I confirmed this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants