You are not logged in.
Pages: 1
Hi,
I'm trying to compile some code using gcc. The code does include asm/page.h but I don't have thad header in /usr/include/asm or asm-generic. Linux headers are installed.
x.c:30:22: fatal error: asm/page.h: No such file or directory
#include <asm/page.h>
^
compilation terminated.
Any idea how to fix this?
Last edited by Truc (2014-09-24 14:15:29)
Offline
Are you sure it shouldn't be asm/page.h? Not that that one is present.
Last edited by Marcel- (2014-09-24 14:15:21)
Offline
Indeed Marcel-. I edited my post also included error message.
▶ ls /usr/include/asm-generic/
auxvec.h int-ll64.h mman.h sembuf.h signal.h termbits.h
bitsperlong.h ioctl.h msgbuf.h setup.h socket.h termios.h
errno-base.h ioctls.h param.h shmbuf.h sockios.h types.h
errno.h ipcbuf.h poll.h shmparam.h stat.h ucontext.h
fcntl.h kvm_para.h posix_types.h siginfo.h statfs.h unistd.h
int-l64.h mman-common.h resource.h signal-defs.h swab.h
▶ ls /usr/include/asm
a.out.h hyperv.h msr-index.h processor-flags.h socket.h unistd_32.h
auxvec.h ioctl.h msr.h ptrace-abi.h sockios.h unistd_64.h
bitsperlong.h ioctls.h mtrr.h ptrace.h stat.h unistd_x32.h
boot.h ipcbuf.h param.h resource.h statfs.h vm86.h
bootparam.h ist.h perf_regs.h sembuf.h svm.h vmx.h
byteorder.h kvm.h poll.h setup.h swab.h vsyscall.h
debugreg.h kvm_para.h posix_types.h shmbuf.h termbits.h
e820.h ldt.h posix_types_32.h sigcontext.h termios.h
errno.h mce.h posix_types_64.h sigcontext32.h types.h
fcntl.h mman.h posix_types_x32.h siginfo.h ucontext.h
hw_breakpoint.h msgbuf.h prctl.h signal.h unistd.h
Offline
This file seems to be present in the Linux kernel.
Offline
$ pacman -Ql linux-headers | grep asm/page.h
Offline
Oh thanks... I located it. Now I'm facing this error..
x.c: In function ‘main’:
x.c:211:36: error: ‘PAGE_SIZE’ undeclared (first use in this function)
x.c:211:36: note: each undeclared identifier is reported only once for each function it appears in
Offline
$ pacman -Ql linux-headers | grep asm/page.h
The result of that command is another page.h then the one in the Linux kernel (in include/asm-generic/, downloaded from [core]'s PKGBUILD). The latter contains PAGE_SIZE.
Last edited by Marcel- (2014-09-24 14:36:52)
Offline
You'll have to use <asm-generic/page.h> to use the file from linux-headers.
Offline
The pacman command didn't return anything actualy... But I found it in /usr/lib/modules/3.16.2-1-ARCH/build/arch/x86/include/asm/ and created a link for page.h
Tried with the one from asm-generic too. Including asm-generic/page.h instead didn't seem to change anything. I still get the no such file error
Thanks for helping
edit: btw I'm trying on both arch and debian 3.12. Looks like on debian I get the PAGE_SIZE issue and on arch it still the no such file
Last edited by Truc (2014-09-24 14:54:37)
Offline
Where does this code come from? What do you need out of that header? If you need the page size, PAGE_SIZE is a kernel only symbol. You more likely want to be calling getpagesize() from unistd.h.
As a general rule, you should never be directly importing any header that starts with 'asm' unless you know what you're doing (and don't care about discarding portability).
Offline
It's this exploit http://www.exploit-db.com/exploits/5092/
I need it to (maybe) escalate privilege on some machine in my lab
Offline
This is quite old code and I had to rewrite it to even compile.
No kidding. And that comment appears to be at least 6 years old....
Since this is a learning exercise for you, I'll stop here. I think I've already given you sufficient hinting on how to solve this for yourself.
Offline
Pages: 1