Giter Site home page Giter Site logo

vbh's Issues

Another build issue

Hi,

I tried to build vbh with an older version of the Linux kernel (which has the definitions for ASM_VMX_VMREAD_RDX_RAX and similar),, but I get a new error:
[...]
CC [M] /home/luca/Src/Virt/vbh/sources/vbh_setup.o
AS [M] /home/luca/Src/Virt/vbh/sources/vmcall.o
CC [M] /home/luca/Src/Virt/vbh/sources/vcpu.o
LD [M] /home/luca/Src/Virt/vbh/sources/vmx-switch.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "__stack_chk_fail" [/home/luca/Src/Virt/vbh/sources/vmx-switch.ko] undefined!
[...]
and of course the module cannot be inserted in the kernel, because it tries to link the __stack_chk_fail symbol that does not exist...

It seems to me that the problem is due to the fact that you unconditionally add "-fstack-protector-strong" to the compiler options...
(as a side note, why are you adding all those cflags and ldflags? Doesn't kbuild use the correct flags by default?)

Thanks,
Luca

Build error

Hello,

I get a build error when compiling on Ubuntu 20.04:

luca@luca64:/data/Test/Virt/vbh/sources$ make
make -C /lib/modules/5.4.0-40-lowlatency/build M=/data/Test/Virt/vbh/sources
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-40-lowlatency'
AR /data/Test/Virt/vbh/sources/built-in.a
CC [M] /data/Test/Virt/vbh/sources/kernelhardening.o
In file included from /data/Test/Virt/vbh/sources/kernelhardening.c:6:
/data/Test/Virt/vbh/sources/vmx_common.h: In function ‘__vmcs_readl’:
/data/Test/Virt/vbh/sources/vmx_common.h:322:15: error: expected string literal before ‘ASM_VMX_VMREAD_RDX_RAX’
322 | asm volatile(ASM_VMX_VMREAD_RDX_RAX
| ^~~~~~~~~~~~~~~~~~~~~~
/data/Test/Virt/vbh/sources/vmx_common.h: In function ‘__vmcs_writel’:
/data/Test/Virt/vbh/sources/vmx_common.h:364:20: error: expected string literal before ‘ASM_VMX_VMWRITE_RAX_RDX’
364 | asm volatile(__ex(ASM_VMX_VMWRITE_RAX_RDX) "; setna %0"
| ^~~~~~~~~~~~~~~~~~~~~~~
/data/Test/Virt/vbh/sources/vmx_common.h:263:17: note: in definition of macro ‘__ex’
263 | #define __ex(x) x
| ^

It looks like the source expect to find ASM_VMX_VMREAD_RDX_RAX and similar defined in the kernel sources... However, that define has been removed some time ago (and the kernel now uses the vmread and vmwrite assembly instructions directly).

I think there are 2 possible solutions:

  1. switch to using vmread and vmwrite directly, as current kernels do
  2. define ASM_VMX_VMREAD_RDX_RAX and similar in vbh/sources/vmx_common.h

Which solution do you think is more appropriate?

As a side note, what is the purpose of the "__ex()" macro?

Thanks,
Luca

Failed to compile the project

Hi
I'm interested in this project and doing a quick try, but failed to compile. Did you have idea ?
My code base is v4.4 as recommended in Readme.

root@:/vbh/sources# make -C /home/works/linux/
make: Entering directory '/home/works/linux'
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  HOSTCC  arch/x86/entry/vdso/vdso2c
In file included from arch/x86/entry/vdso/vdso2c.c:161:
arch/x86/entry/vdso/vdso2c.h: In function ‘go64’:
arch/x86/entry/vdso/vdso2c.h:55:24: warning: unused variable ‘tag’ [-Wunused-variable]
   55 |   typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag);
      |                        ^~~
arch/x86/entry/vdso/vdso2c.h:7:22: error: invalid storage class for function ‘go32’
    7 | static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
      |                      ^~
arch/x86/entry/vdso/vdso2c.c:150:39: note: in definition of macro ‘BITSFUNC3’
  150 | #define BITSFUNC3(name, bits, suffix) name##bits##suffix
      |                                       ^~~~
arch/x86/entry/vdso/vdso2c.c:152:24: note: in expansion of macro ‘BITSFUNC2’
  152 | #define BITSFUNC(name) BITSFUNC2(name, ELF_BITS, )
      |                        ^~~~~~~~~
arch/x86/entry/vdso/vdso2c.h:7:13: note: in expansion of macro ‘BITSFUNC’
    7 | static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
      |             ^~~~~~~~
In file included from arch/x86/entry/vdso/vdso2c.c:165:
arch/x86/entry/vdso/vdso2c.h: In function ‘go32’:
arch/x86/entry/vdso/vdso2c.h:55:24: warning: unused variable ‘tag’ [-Wunused-variable]
   55 |   typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag);
      |                        ^~~
arch/x86/entry/vdso/vdso2c.c:168:13: error: invalid storage class for function ‘go’
  168 | static void go(void *raw_addr, size_t raw_len,
      |             ^~
arch/x86/entry/vdso/vdso2c.c:185:13: error: invalid storage class for function ‘map_input’
  185 | static void map_input(const char *name, void **addr, size_t *len, int prot)
      |             ^~~~~~~~~
arch/x86/entry/vdso/vdso2c.c:205:5: warning: ‘main’ is normally a non-static function [-Wmain]
  205 | int main(int argc, char **argv)
      |     ^~~~
arch/x86/entry/vdso/vdso2c.c:253:1: error: expected declaration or statement at end of input
  253 | }
      | ^
arch/x86/entry/vdso/vdso2c.c: In function ‘go64’:
arch/x86/entry/vdso/vdso2c.c:253:1: error: expected declaration or statement at end of input
At top level:
arch/x86/entry/vdso/vdso2c.c:205:5: warning: ‘main’ defined but not used [-Wunused-function]
  205 | int main(int argc, char **argv)
      |     ^~~~
make[3]: *** [scripts/Makefile.host:91: arch/x86/entry/vdso/vdso2c] Error 1
make[2]: *** [scripts/Makefile.build:403: arch/x86/entry/vdso] Error 2
make[1]: *** [scripts/Makefile.build:403: arch/x86/entry] Error 2
make: *** [Makefile:943: arch/x86] Error 2
make: Leaving directory '/home/works/linux'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.