Git Product home page Git Product logo

Comments (10)

dvyukov avatar dvyukov commented on April 28, 2024

Hi @rnsastry,

numbers are defined in sys/sys_amd64.go and sys/sys_arm64.go for the respective architectures.
What architecture are you compiling it for? If it's 386, then I would suggest to switch to amd64. Of you want to test specifically 386?

p.s. target architecture is controlled with GOARCH env var. i.e. GOARCH=amd64 make

from syzkaller.

rnsastry avatar rnsastry commented on April 28, 2024

Hi Dmitry, I am compiling for ppc64le (power architecture little endian).
GOARCH="ppc64le"
GOHOSTARCH="ppc64le"
Do you have any plans for supporting this architecture? Or can I create it in any way?
Thanks for your time.

from syzkaller.

rnsastry avatar rnsastry commented on April 28, 2024

From "go env"

go env

GOARCH="ppc64le"
GOBIN=""
GOEXE=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_ppc64le"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

from syzkaller.

dvyukov avatar dvyukov commented on April 28, 2024

To overcome this compilation error you need to extend this table:
https://github.com/google/syzkaller/blob/master/sysgen/syscallnr.go#L23

the first value is GOARCH, so it should be ppc64le
the second - if a C define for this arch, not sure what it is
the third - is location of file with syscall numbers for this arch in linux kernel tree

when you do this, run
make generate LINUX=path_to_tip_linux_kernel_checkout

this should generate sys/sys_ppc64le.go file and update executor/syscalls.h
if it works for you, I will be happy to accept a pull request

from syzkaller.

rnsastry avatar rnsastry commented on April 28, 2024

Sure, Thanks a lot for the information. I will try to do this and will let you know.

from syzkaller.

rnsastry avatar rnsastry commented on April 28, 2024

Added the following in sysgen/syscallnr.go#L23
var archs = []*Arch{
{"amd64", "x86_64", "arch/x86/include/generated/uapi/asm/unistd_64.h", nil},
{"arm64", "aarch64", "arch/arm64/include/uapi/asm/unistd.h", nil},
{"ppc64le", "ppc64", "arch/powerpc/include/uapi/asm/unistd.h", nil},

Got the kernel git clone to '/root/linux'
And ran with 'make'
#make generate LINUX=/root/linux
go run sysgen/*.go -linux=/root/linux sys/sys.txt sys/socket.txt sys/tty.txt sys/perf.txt
sys/key.txt sys/bpf.txt sys/fuse.txt sys/dri.txt sys/kdbus.txt sys/sctp.txt
sys/kvm.txt sys/sndseq.txt sys/sndtimer.txt sys/sndcontrol.txt sys/input.txt
failed to run gcc: exit status 1
:48:23: fatal error: asm/prctl.h: No such file or directory
compilation terminated.

exit status 1
make: *** [generate] Error 1

find / -name prctl.h

/usr/include/sys/prctl.h
/usr/include/linux/prctl.h
/root/linux/include/uapi/linux/prctl.h
/root/linux/arch/x86/include/uapi/asm/prctl.h

seems some thing more needs to be done. And I don't know what is that.

from syzkaller.

dvyukov avatar dvyukov commented on April 28, 2024

Try to remove include <asm/prctl.h> line in sys/sys.txt.
If that does not help, I will try to generate with {"ppc64le", "ppc64", "arch/powerpc/include/uapi/asm/unistd.h", nil},

The problem is that I use host headers to extract values of various constants. And host headers are different across different distributions and versions of distributions, and also depend on set of installed packages. E.g. on Ubuntu I had to do "sudo apt-get install libnuma-dev" to install a necessary header.
I should switch to usage of only kernel headers, they are more stable and always up-to-date. However, the last time I tried I got lots of various conflicts...

from syzkaller.

rnsastry avatar rnsastry commented on April 28, 2024

Installed numactl-devel.ppc64le for error "fatal error: numaif.h: No such file or directory" after that seeing the following errors.

make generate LINUX=/root/linux

go run sysgen/*.go -linux=/root/linux sys/sys.txt sys/socket.txt sys/tty.txt sys/perf.txt
sys/key.txt sys/bpf.txt sys/fuse.txt sys/dri.txt sys/kdbus.txt sys/sctp.txt
sys/kvm.txt sys/sndseq.txt sys/sndtimer.txt sys/sndcontrol.txt sys/input.txt
failed to run gcc: exit status 1
: In function ‘main’:
:1307:978: error: ‘ARCH_GET_GS’ undeclared (first use in this function)
:1307:978: note: each undeclared identifier is reported only once for each function it appears in
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:1281: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_msrs’
:1307:2289: error: ‘FALLOC_FL_PUNCH_HOLE’ undeclared (first use in this function)
:1307:2748: error: ‘MAP_32BIT’ undeclared (first use in this function)
:1307:4917: error: ‘PTRACE_O_EXITKILL’ undeclared (first use in this function)
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:8417: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_xcrs’
:1307:8848: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared (first use in this function)
:1307:9596: error: ‘ARCH_SET_GS’ undeclared (first use in this function)
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:10387: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_msrs’
:1307:10723: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_vcpu_events’
:1307:11766: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_msr_list’
:1307:12233: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_xen_hvm_config’
:1307:13191: error: ‘KVM_GUESTDBG_INJECT_DB’ undeclared (first use in this function)
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:14305: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_cpuid2’
:1307:14886: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_cpuid2’
:1307:15320: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_pit_state2’
:1307:15694: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_vcpu_events’
:1307:17548: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_lapic_state’
:1307:17581: error: ‘ARCH_GET_FS’ undeclared (first use in this function)
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:17690: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_debugregs’
:1307:19168: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_debugregs’
:1307:19916: error: ‘ARCH_SET_FS’ undeclared (first use in this function)
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:21149: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_lapic_state’
:1307:21206: error: ‘KVM_GUESTDBG_INJECT_BP’ undeclared (first use in this function)
In file included from /usr/include/asm/ioctl.h:11:0,
from /usr/include/asm/ioctls.h:4,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from /usr/include/sys/mount.h:25,
from :20:
:1307:21897: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_cpuid’
:1307:24215: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_pit_state2’
:1307:24526: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_xsave’
:1307:25712: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_xcrs’
:1307:26663: error: invalid application of ‘sizeof’ to incomplete type ‘struct kvm_xsave’

exit status 1
make: *** [generate] Error 1

from syzkaller.

rnsastry avatar rnsastry commented on April 28, 2024

forgot to mention removed '#include <asm/prctl.h>' from sys/sys.txt
and then tried the above.

from syzkaller.

dvyukov avatar dvyukov commented on April 28, 2024

@rnsastry should be fixed by 81438c4
I've tried to build with GOARCH=ppc64le and build succeeded.
Feel free to file more issues or contact syzkaller googlegroups mailing list if you have other issues.

from syzkaller.

Related Issues (20)

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.