"Permission denied" when using system-installed kernel headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks

Here is a follow-up for this issue
https://github.com/Open-CAS/open-cas-linux/issues/540

opencas project builds an out-of-tree kernel module and uses
system-level kernel header. In my case these headers are installed to
/lib/modules/5.9.1-arch1-1/build

So if I do

$ cd /lib/modules/5.9.1-arch1-1/build
$ make kernelversion

I get following output:

mkdir: cannot create directory ‘.tmp_86541’: Permission denied
mkdir: cannot create directory ‘.tmp_86543’: Permission denied
mkdir: cannot create directory ‘.tmp_86545’: Permission denied
mkdir: cannot create directory ‘.tmp_86547’: Permission denied
.......
mkdir: cannot create directory ‘.tmp_86626’: Permission denied
mkdir: cannot create directory ‘.tmp_86628’: Permission denied
mkdir: cannot create directory ‘.tmp_86630’: Permission denied
5.9.1-arch1


Quick debugging shows that it comes from scripts/Kbuild.include
following lines in particular:

# output directory for tests below
TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$

# try-run
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
# Exit code chooses option. "$$TMP" serves as a temporary file and is
# automatically cleaned up.
try-run = $(shell set -e; \
TMP=$(TMPOUT)/tmp; \
TMPO=$(TMPOUT)/tmp.o; \
mkdir -p $(TMPOUT); \
trap "rm -rf $(TMPOUT)" EXIT; \
if ($(1)) >/dev/null 2>&1; \
then echo "$(2)"; \
else echo "$(3)"; \
fi)



TMPOUT points to headers directory and in my case it is a part of /usr
partition that restricts user writes.


TMPOUT should avoid writing to headers dir and use `mktemp` instead.




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux