Bug 193961 - [exp-run] Remove MAP_RENAME and MAP_NORESERVE
Summary: [exp-run] Remove MAP_RENAME and MAP_NORESERVE
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: John Baldwin
URL: https://reviews.freebsd.org/D848
Keywords:
Depends on: 194427 194428 194429 194430
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-26 20:18 UTC by John Baldwin
Modified: 2014-12-09 14:07 UTC (History)
1 user (show)

See Also:
mva: exp-run?


Attachments
patch (3.01 KB, patch)
2014-09-28 07:09 UTC, Antoine Brodin
no flags Details | Diff
ports patch (23.08 KB, patch)
2014-10-13 19:34 UTC, John Baldwin
no flags Details | Diff
ports patch (22.94 KB, patch)
2014-10-14 15:29 UTC, John Baldwin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Baldwin freebsd_committer freebsd_triage 2014-09-26 20:18:10 UTC
FreeBSD has never implemented these flags for mmap() and software that uses them expecting Sun behavior is likely to be surprised.  From my recent mmap error checking changes in HEAD, I know that at least openjdk7 and chromium both use MAP_NORESERVE.  I'm not sure if either will gracefully handle the flag not being defined or if they will need patching.  (I believe avg@ suggested openjdk probably does not and will need patching.)

The patch can be found at the associated URL.
Comment 1 Marcus von Appen freebsd_committer freebsd_triage 2014-09-27 06:45:09 UTC
portmgr@ does exp-runs.
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2014-09-27 18:12:00 UTC
Take for exp-run.

Only the headers / userland needs to be patched for the exp-run,  no need to use a patched kernel,  right?
Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2014-09-27 23:55:14 UTC
World fails to build with the patch applied:


--- all_subdir_truss ---
/poudriere/jails/head-amd64-D848/usr/src/usr.bin/truss/syscalls.c:312:46: error: use of undeclared identifier 'MAP_RENAME'
        X(MAP_SHARED) X(MAP_PRIVATE) X(MAP_FIXED) X(MAP_RENAME)
                                                    ^
/poudriere/jails/head-amd64-D848/usr/src/usr.bin/truss/syscalls.c:291:16: note: expanded from macro 'X'
#define X(a)    { a, #a },
                  ^
/poudriere/jails/head-amd64-D848/usr/src/usr.bin/truss/syscalls.c:313:4: error: use of undeclared identifier 'MAP_NORESERVE'
        X(MAP_NORESERVE) X(MAP_RESERVED0080) X(MAP_RESERVED0100)
          ^
/poudriere/jails/head-amd64-D848/usr/src/usr.bin/truss/syscalls.c:291:16: note: expanded from macro 'X'
#define X(a)    { a, #a },
                  ^
Comment 4 Antoine Brodin freebsd_committer freebsd_triage 2014-09-28 07:09:05 UTC
Created attachment 147741 [details]
patch

A patch that passes "buildworld"
Comment 5 Antoine Brodin freebsd_committer freebsd_triage 2014-09-28 07:09:32 UTC
I will exp-run with the patch I just attached
Comment 6 Antoine Brodin freebsd_committer freebsd_triage 2014-09-28 20:39:49 UTC
Exp-run results are available at:

http://package18.nyi.freebsd.org/build.html?mastername=head-amd64-D848-default&build=2014-09-28_07h08m12s

There were 14 new failures and around 4500 ports skipped due to those failures

New failures:

+ {"origin"=>"devel/libunwind", "pkgname"=>"libunwind-20121006_1", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"devel/umem", "pkgname"=>"umem-1.0.1_4", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"graphics/cairo", "pkgname"=>"cairo-1.12.16_1,2", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"java/openjdk6", "pkgname"=>"openjdk6-b32,1", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"java/openjdk6-jre", "pkgname"=>"openjdk6-jre-b32,1", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"java/openjdk7", "pkgname"=>"openjdk-7.65.17,1", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"lang/ccl", "pkgname"=>"ccl-1.9", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"lang/v8", "pkgname"=>"v8-3.18.5", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"lang/v8-devel", "pkgname"=>"v8-devel-3.27.7_1", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"mail/annoyance-filter", "pkgname"=>"annoyance-filter-1.0d_2", "phase"=>"build", "errortype"=>"compiler_error"}
+ {"origin"=>"security/binwalk", "pkgname"=>"binwalk-0.5.0_2", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"www/node", "pkgname"=>"node-0.10.32", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"www/node-devel", "pkgname"=>"node-devel-0.11.13", "phase"=>"build", "errortype"=>"clang"}
+ {"origin"=>"www/trafficserver", "pkgname"=>"trafficserver-5.0.1", "phase"=>"build", "errortype"=>"clang"}

Failure logs:

http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/libunwind-20121006_1.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/umem-1.0.1_4.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/cairo-1.12.16_1,2.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/openjdk6-b32,1.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/openjdk6-jre-b32,1.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/openjdk-7.65.17,1.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/ccl-1.9.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/v8-3.18.5.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/v8-devel-3.27.7_1.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/annoyance-filter-1.0d_2.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/binwalk-0.5.0_2.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/node-0.10.32.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/node-devel-0.11.13.log
http://package18.nyi.freebsd.org/data/head-amd64-D848-default/2014-09-28_07h08m12s/logs/errors/trafficserver-5.0.1.log
Comment 7 John Baldwin freebsd_committer freebsd_triage 2014-09-29 14:01:42 UTC
Comment on attachment 147741 [details]
patch

Yes, thank you for catching this.
Comment 8 John Baldwin freebsd_committer freebsd_triage 2014-10-13 19:34:38 UTC
Created attachment 148279 [details]
ports patch

First version of a patch for ports to remove MAP_NORESERVE usage
Comment 9 John Baldwin freebsd_committer freebsd_triage 2014-10-13 19:35:54 UTC
Please re-run this.  You can use the previous world (if you still have it).  I have patched the ports that failed previously in the attached patch.
Comment 10 Antoine Brodin freebsd_committer freebsd_triage 2014-10-13 19:41:36 UTC
Take for exp-run
Comment 11 Antoine Brodin freebsd_committer freebsd_triage 2014-10-13 19:43:57 UTC
Note: i will apply the patch on a 10.1 world to test ~150 more ports than on head.
Comment 12 Antoine Brodin freebsd_committer freebsd_triage 2014-10-13 20:48:21 UTC
This part of the port patch in java/openjdk7/files/patch-src-os-bsd-vm-os_bsd.cpp doesn't look good:

-+#define DEFAULT_LIBPATH "/lib:/usr/lib:%%LOCALBASE%%/lib"
++#define DEFAULT_LIBPATH "/lib:/usr/lib:/usr/local/lib"
Comment 13 John Baldwin freebsd_committer freebsd_triage 2014-10-14 15:29:07 UTC
Oops, missed that.  Due to rediffing the file after patching.  I'll update the ports patch
Comment 14 John Baldwin freebsd_committer freebsd_triage 2014-10-14 15:29:40 UTC
Created attachment 148303 [details]
ports patch
Comment 15 Antoine Brodin freebsd_committer freebsd_triage 2014-10-14 20:55:49 UTC
Exp-run results:

http://package18.nyi.freebsd.org/jail.html?mastername=101amd64D848-default-PR193961

1 new failure:  databases/galera

Failure log:

http://package18.nyi.freebsd.org/data/101amd64D848-default-PR193961/2014-10-14_19h21m00s/logs/errors/galera-25.3.5_1.log

I let you fix it,  and patch approved.
Comment 16 commit-hook freebsd_committer freebsd_triage 2014-10-18 12:21:21 UTC
A commit references this bug:

Author: jhb
Date: Sat Oct 18 12:20:47 UTC 2014
New revision: 371117
URL: https://svnweb.freebsd.org/changeset/ports/371117

Log:
  The MAP_NORESERVE flag to mmap() has never been implemented in FreeBSD and
  is being removed.  No portrev bump needed since the kernel will continue to
  accept this flag for old binaries even after support for it in new binaries
  is removed.

  PR:		193961
  Approved by:	portmgr (antoine)

Changes:
  head/databases/galera/files/patch-galerautils-src-gu_mmap.cpp
  head/devel/libunwind/files/
  head/devel/libunwind/files/patch-tests-mapper.c
  head/devel/umem/files/patch-vmem_mmap.c
  head/graphics/cairo/files/patch-util_cairo-sphinx_sphinx.c
  head/java/openjdk6/files/patch-set
  head/java/openjdk7/files/patch-src-os-bsd-vm-os_bsd.cpp
  head/java/openjdk8/files/patch-bsd
  head/lang/ccl/files/patch-lisp-kernel_memory.c
  head/lang/v8/files/patch-src_platform-freebsd.cc
  head/lang/v8-devel/files/patch-src_platform-freebsd.cc
  head/mail/annoyance-filter/files/patch-annoyance-filter.cc
  head/security/binwalk/files/patch-common.c
  head/www/chromium/files/patch-v8__src__base__platform__platform-freebsd.cc
  head/www/node/files/
  head/www/node/files/patch-deps_v8_src_platform-freebsd.cc
  head/www/node-devel/files/
  head/www/node-devel/files/patch-deps_v8_src_platform-freebsd.cc
  head/www/trafficserver/files/patch-lib__ts__Compatability.h
  head/www/trafficserver/files/patch-tools__jtest__jtest.cc
Comment 17 commit-hook freebsd_committer freebsd_triage 2014-10-18 12:29:22 UTC
A commit references this bug:

Author: jhb
Date: Sat Oct 18 12:28:52 UTC 2014
New revision: 273250
URL: https://svnweb.freebsd.org/changeset/base/273250

Log:
  Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to mmap(2).
  Older binaries are still permitted to use these flags.

  PR:		193961 (exp-run in ports)
  Differential Revision:	https://reviews.freebsd.org/D848
  Reviewed by:	kib

Changes:
  head/sys/sys/mman.h
  head/sys/sys/param.h
  head/sys/vm/vm_mmap.c
  head/usr.bin/truss/syscalls.c
Comment 18 commit-hook freebsd_committer freebsd_triage 2014-12-09 14:07:08 UTC
A commit references this bug:

Author: madpilot
Date: Tue Dec  9 14:06:59 UTC 2014
New revision: 374392
URL: https://svnweb.freebsd.org/changeset/ports/374392

Log:
  Fix build on recent head by removing references to the MAP_NORESERVE
  flag to mmap(2). It has never been implemented in FreeBSD and thus
  was being ignored before anyway.

  No functional change, so no PORTREVISION bump.

  PR:	193961 (related)

Changes:
  head/games/0ad/files/patch-source_lib_allocators_page__aligned.cpp
  head/games/0ad/files/patch-source_lib_sysdep_os_unix_uvm.cpp