Bug 209435 - [build] HEAD kernel can not build with /usr/src mounted with option noexec
Summary: [build] HEAD kernel can not build with /usr/src mounted with option noexec
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-10 19:53 UTC by joh.hendriks
Modified: 2016-05-16 22:34 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description joh.hendriks 2016-05-10 19:53:47 UTC
make kernel fails with the following error when /usr/src is mounted with option noexec.

This is FreeBSD desk.server.mydomain.nl 11.0-CURRENT FreeBSD
11.0-CURRENT #8 r299158:
...
===> bhnd (all)
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
/usr/src/sys/dev/bhnd/tools/nvram_map_gen.sh
/usr/src/sys/dev/bhnd/nvram/nvram_map -h
make[4]: exec(/usr/src/sys/dev/bhnd/tools/nvram_map_gen.sh) failed
(Permission denied)
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-05-13 16:36:03 UTC
A commit references this bug:

Author: dim
Date: Fri May 13 16:35:38 UTC 2016
New revision: 299684
URL: https://svnweb.freebsd.org/changeset/base/299684

Log:
  After r299241, which added bhnd(4), use sh to run the shell scripts for
  generating nvram maps, to allow a noexec-mounted source directory.

  Reported by:	Johan Hendriks <joh.hendriks@gmail.com>
  PR:		209435

Changes:
  head/sys/conf/files
  head/sys/conf/kmod.mk
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2016-05-13 16:37:54 UTC
Johan, can you please verify that a kernel now also builds successfully for you, even if you mount /usr/src noexec?
Comment 3 Landon Fuller 2016-05-13 17:59:07 UTC
Hey Dmitry,

You'll also need the nvram_map_gen.sh changes from D6312 (https://reviews.freebsd.org/D6312#d5a8eee4)

With that, I can confirm the build completes successfully with `noexec`
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-05-13 18:57:16 UTC
A commit references this bug:

Author: emaste
Date: Fri May 13 18:56:56 UTC 2016
New revision: 299692
URL: https://svnweb.freebsd.org/changeset/base/299692

Log:
  Use awk to run bhnd's awk script, to allow noexec src dir

  PR:		209435
  Submitted by:	Landon Fuller <landonf@landonf.org>
  Differential Revision:	https://reviews.freebsd.org/D6312

Changes:
  head/sys/dev/bhnd/tools/nvram_map_gen.sh
Comment 5 joh.hendriks 2016-05-16 22:26:53 UTC
(In reply to Dimitry Andric from comment #2)

I just set exec=off on my /usr/src zfs dataset and did an svnupdate.
Now the buildworld goes fine.

Thanks.
regards

Johan
Comment 6 Ed Maste freebsd_committer freebsd_triage 2016-05-16 22:34:18 UTC
Thanks for the confirmation!