script_core 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +35 -57
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/README.md +7 -1
- data/ext/enterprise_script_service/Rakefile +1 -1
- data/ext/enterprise_script_service/libseccomp/.travis.yml +24 -12
- data/ext/enterprise_script_service/libseccomp/CHANGELOG +32 -0
- data/ext/enterprise_script_service/libseccomp/CONTRIBUTING.md +37 -26
- data/ext/enterprise_script_service/libseccomp/CREDITS +11 -0
- data/ext/enterprise_script_service/libseccomp/README.md +21 -1
- data/ext/enterprise_script_service/libseccomp/configure.ac +13 -8
- data/ext/enterprise_script_service/libseccomp/doc/Makefile.am +6 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_api_get.3 +12 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_arch_add.3 +38 -6
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_attr_set.3 +53 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_export_bpf.3 +20 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_init.3 +9 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_load.3 +32 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_merge.3 +16 -2
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_alloc.3 +113 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_fd.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_free.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_id_valid.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_receive.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_notify_respond.3 +1 -0
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_rule_add.3 +64 -3
- data/ext/enterprise_script_service/libseccomp/doc/man/man3/seccomp_syscall_priority.3 +18 -3
- data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +19 -0
- data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +116 -0
- data/ext/enterprise_script_service/libseccomp/src/.gitignore +2 -0
- data/ext/enterprise_script_service/libseccomp/src/Makefile.am +31 -17
- data/ext/enterprise_script_service/libseccomp/src/api.c +254 -58
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch-arm.c +47 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-arm.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch-gperf-generate +40 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-mips.c +41 -4
- data/ext/enterprise_script_service/libseccomp/src/arch-mips.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64.c +41 -4
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64.h +3 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32.c +41 -4
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc.h +1 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc64.c +3 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc64.h +29 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64.c +606 -8
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-riscv64.c +31 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-riscv64.h +22 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +171 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.h +1 -17
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +166 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.h +1 -20
- data/ext/enterprise_script_service/libseccomp/src/arch-syscall-dump.c +8 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-syscall-validate +359 -143
- data/ext/enterprise_script_service/libseccomp/src/arch-x32.c +36 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-x32.h +2 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +172 -10
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.h +1 -14
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64.h +1 -9
- data/ext/enterprise_script_service/libseccomp/src/arch.c +11 -3
- data/ext/enterprise_script_service/libseccomp/src/arch.h +7 -0
- data/ext/enterprise_script_service/libseccomp/src/db.c +268 -57
- data/ext/enterprise_script_service/libseccomp/src/db.h +16 -2
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +503 -148
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.h +2 -1
- data/ext/enterprise_script_service/libseccomp/src/gen_pfc.c +165 -37
- data/ext/enterprise_script_service/libseccomp/src/python/libseccomp.pxd +37 -1
- data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +295 -5
- data/ext/enterprise_script_service/libseccomp/src/syscalls.c +56 -0
- data/ext/enterprise_script_service/libseccomp/src/syscalls.csv +470 -0
- data/ext/enterprise_script_service/libseccomp/src/syscalls.h +62 -0
- data/ext/enterprise_script_service/libseccomp/src/syscalls.perf.template +82 -0
- data/ext/enterprise_script_service/libseccomp/src/system.c +196 -16
- data/ext/enterprise_script_service/libseccomp/src/system.h +68 -13
- data/ext/enterprise_script_service/libseccomp/tests/.gitignore +10 -2
- data/ext/enterprise_script_service/libseccomp/tests/06-sim-actions.tests +1 -1
- data/ext/enterprise_script_service/libseccomp/tests/11-basic-basic_errors.c +5 -5
- data/ext/enterprise_script_service/libseccomp/tests/13-basic-attrs.c +35 -1
- data/ext/enterprise_script_service/libseccomp/tests/13-basic-attrs.py +10 -1
- data/ext/enterprise_script_service/libseccomp/tests/15-basic-resolver.c +4 -3
- data/ext/enterprise_script_service/libseccomp/tests/16-sim-arch_basic.c +12 -0
- data/ext/enterprise_script_service/libseccomp/tests/16-sim-arch_basic.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/{18-sim-basic_whitelist.c → 18-sim-basic_allowlist.c} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/{18-sim-basic_whitelist.py → 18-sim-basic_allowlist.py} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/18-sim-basic_allowlist.tests +32 -0
- data/ext/enterprise_script_service/libseccomp/tests/23-sim-arch_all_le_basic.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tests/23-sim-arch_all_le_basic.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/30-sim-socket_syscalls.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tests/30-sim-socket_syscalls.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/30-sim-socket_syscalls.tests +33 -17
- data/ext/enterprise_script_service/libseccomp/tests/{34-sim-basic_blacklist.c → 34-sim-basic_denylist.c} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/{34-sim-basic_blacklist.py → 34-sim-basic_denylist.py} +0 -0
- data/ext/enterprise_script_service/libseccomp/tests/34-sim-basic_denylist.tests +32 -0
- data/ext/enterprise_script_service/libseccomp/tests/36-sim-ipc_syscalls.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tests/36-sim-ipc_syscalls.py +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/36-sim-ipc_syscalls.tests +25 -25
- data/ext/enterprise_script_service/libseccomp/tests/39-basic-api_level.c +24 -3
- data/ext/enterprise_script_service/libseccomp/tests/39-basic-api_level.py +16 -1
- data/ext/enterprise_script_service/libseccomp/tests/47-live-kill_process.c +3 -3
- data/ext/enterprise_script_service/libseccomp/tests/51-live-user_notification.c +112 -0
- data/ext/enterprise_script_service/libseccomp/tests/51-live-user_notification.py +60 -0
- data/ext/enterprise_script_service/libseccomp/tests/51-live-user_notification.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.c +48 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.py +38 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/53-sim-binary_tree.c +156 -0
- data/ext/enterprise_script_service/libseccomp/tests/53-sim-binary_tree.py +95 -0
- data/ext/enterprise_script_service/libseccomp/tests/53-sim-binary_tree.tests +65 -0
- data/ext/enterprise_script_service/libseccomp/tests/54-live-binary_tree.c +128 -0
- data/ext/enterprise_script_service/libseccomp/tests/54-live-binary_tree.py +95 -0
- data/ext/enterprise_script_service/libseccomp/tests/54-live-binary_tree.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/55-basic-pfc_binary_tree.c +134 -0
- data/ext/enterprise_script_service/libseccomp/tests/55-basic-pfc_binary_tree.sh +46 -0
- data/ext/enterprise_script_service/libseccomp/tests/55-basic-pfc_binary_tree.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/56-basic-iterate_syscalls.c +90 -0
- data/ext/enterprise_script_service/libseccomp/tests/56-basic-iterate_syscalls.py +65 -0
- data/ext/enterprise_script_service/libseccomp/tests/56-basic-iterate_syscalls.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/57-basic-rawsysrc.c +64 -0
- data/ext/enterprise_script_service/libseccomp/tests/57-basic-rawsysrc.py +46 -0
- data/ext/enterprise_script_service/libseccomp/tests/57-basic-rawsysrc.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/58-live-tsync_notify.c +116 -0
- data/ext/enterprise_script_service/libseccomp/tests/58-live-tsync_notify.py +61 -0
- data/ext/enterprise_script_service/libseccomp/tests/58-live-tsync_notify.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +34 -10
- data/ext/enterprise_script_service/libseccomp/tests/regression +10 -3
- data/ext/enterprise_script_service/libseccomp/tests/util.c +3 -3
- data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -3
- data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -1
- data/ext/enterprise_script_service/libseccomp/tools/scmp_arch_detect.c +3 -0
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_disasm.c +4 -2
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +4 -0
- data/ext/enterprise_script_service/libseccomp/tools/util.c +14 -12
- data/ext/enterprise_script_service/libseccomp/tools/util.h +7 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +149 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/codeql-analysis.yml +55 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/lint.yml +23 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/oss-fuzz.yml +27 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/spell-checker.yml +17 -0
- data/ext/enterprise_script_service/mruby/.gitignore +3 -0
- data/ext/enterprise_script_service/mruby/.gitlab-ci.yml +3 -3
- data/ext/enterprise_script_service/mruby/.markdownlint.yml +16 -0
- data/ext/enterprise_script_service/mruby/.travis.yml +7 -10
- data/ext/enterprise_script_service/mruby/.yamllint +8 -0
- data/ext/enterprise_script_service/mruby/AUTHORS +4 -0
- data/ext/enterprise_script_service/mruby/CODEOWNERS +1 -0
- data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +6 -13
- data/ext/enterprise_script_service/mruby/Doxyfile +4 -4
- data/ext/enterprise_script_service/mruby/LICENSE +1 -1
- data/ext/enterprise_script_service/mruby/Makefile +1 -1
- data/ext/enterprise_script_service/mruby/README.md +5 -11
- data/ext/enterprise_script_service/mruby/Rakefile +18 -108
- data/ext/enterprise_script_service/mruby/TODO.md +17 -0
- data/ext/enterprise_script_service/mruby/appveyor.yml +29 -26
- data/ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb +1 -1
- data/ext/enterprise_script_service/mruby/build_config.rb +9 -152
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_ArduinoDue.rb → build_config/ArduinoDue.rb} +4 -21
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelEdison.rb → build_config/IntelEdison.rb} +4 -4
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelGalileo.rb → build_config/IntelGalileo.rb} +3 -20
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_RX630.rb → build_config/RX630.rb} +4 -21
- data/ext/enterprise_script_service/mruby/build_config/android_arm64-v8a.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/android_armeabi.rb +11 -0
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_android_armeabi_v7a_neon_hard.rb → build_config/android_armeabi_v7a_neon_hard.rb} +0 -15
- data/ext/enterprise_script_service/mruby/build_config/bench.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/boxing.rb +21 -0
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_chipKITMax32.rb → build_config/chipKITMax32.rb} +4 -21
- data/ext/enterprise_script_service/mruby/{appveyor_config.rb → build_config/ci/gcc-clang.rb} +11 -8
- data/ext/enterprise_script_service/mruby/build_config/ci/msvc.rb +20 -0
- data/ext/enterprise_script_service/mruby/build_config/clang-asan.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/cross-32bit.rb +14 -0
- data/ext/enterprise_script_service/mruby/build_config/default.rb +80 -0
- data/ext/enterprise_script_service/mruby/build_config/dreamcast_shelf.rb +94 -0
- data/ext/enterprise_script_service/mruby/build_config/gameboyadvance.rb +73 -0
- data/ext/enterprise_script_service/mruby/build_config/host-cxx.rb +12 -0
- data/ext/enterprise_script_service/mruby/build_config/host-debug.rb +20 -0
- data/ext/enterprise_script_service/mruby/build_config/host-gprof.rb +14 -0
- data/ext/enterprise_script_service/mruby/build_config/host-m32.rb +15 -0
- data/ext/enterprise_script_service/mruby/build_config/host-shared.rb +36 -0
- data/ext/enterprise_script_service/mruby/build_config/mrbc.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/no-float.rb +17 -0
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +142 -49
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +5 -4
- data/ext/enterprise_script_service/mruby/doc/guides/gc-arena-howto.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +53 -30
- data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +31 -14
- data/ext/enterprise_script_service/mruby/doc/guides/symbol.md +83 -0
- data/ext/enterprise_script_service/mruby/doc/limitations.md +35 -36
- data/ext/enterprise_script_service/mruby/doc/mruby3.md +163 -0
- data/ext/enterprise_script_service/mruby/doc/opcode.md +102 -103
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +1 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +5 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_extension_example/src/example.c +5 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +1 -1
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +88 -66
- data/ext/enterprise_script_service/mruby/include/mruby.h +160 -104
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +27 -6
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +80 -46
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +8 -8
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +76 -55
- data/ext/enterprise_script_service/mruby/include/mruby/class.h +10 -8
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +14 -1
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +20 -6
- data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +18 -52
- data/ext/enterprise_script_service/mruby/include/mruby/endian.h +44 -0
- data/ext/enterprise_script_service/mruby/include/mruby/error.h +39 -5
- data/ext/enterprise_script_service/mruby/include/mruby/gc.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/hash.h +33 -13
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +74 -14
- data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -1
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +19 -9
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +37 -63
- data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +1 -27
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +29 -24
- data/ext/enterprise_script_service/mruby/include/mruby/presym.h +40 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/disable.h +70 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/enable.h +37 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/scanning.h +73 -0
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +93 -21
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +12 -16
- data/ext/enterprise_script_service/mruby/include/mruby/throw.h +14 -3
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +60 -59
- data/ext/enterprise_script_service/mruby/include/mruby/variable.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +25 -6
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +198 -72
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +71 -78
- data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +12 -10
- data/ext/enterprise_script_service/mruby/lib/{mruby-core-ext.rb → mruby/core_ext.rb} +10 -3
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +84 -32
- data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +1 -1
- data/ext/enterprise_script_service/mruby/lib/mruby/presym.rb +132 -0
- data/ext/enterprise_script_service/mruby/lib/mruby/source.rb +3 -1
- data/ext/enterprise_script_service/mruby/mrbgems/default-no-fpu.gembox +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default-no-stdio.gembox +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +9 -81
- data/ext/enterprise_script_service/mruby/mrbgems/full-core.gembox +1 -4
- data/ext/enterprise_script_service/mruby/mrbgems/math.gembox +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/metaprog.gembox +15 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +1 -32
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +10 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +0 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +30 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mruby-config +18 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb +3 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb +10 -10
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +14 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +2 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +6 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb +23 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +11 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +46 -35
- data/ext/enterprise_script_service/mruby/mrbgems/{mruby-compiler → mruby-bin-mrbc}/bintest/mrbc.rb +0 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake +3 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +41 -28
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +25 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +26 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +6 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrbgem.rake +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb +27 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +495 -436
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +49 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +637 -220
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +13734 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +20 -23
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +9 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +1 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/mrbgem.rake +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +19 -238
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +21 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +19 -15
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +31 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +7 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-inline-struct/test/inline.c +5 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +18 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +39 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +2 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +9 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file_constants.rb +0 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +9 -14
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +107 -59
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +22 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +417 -203
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +20 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +33 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +58 -50
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +13 -14
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +13 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/test/math.rb +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +56 -73
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +13 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/README.md +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +80 -78
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +14 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +8 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +18 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/mrbgem.rake +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/src/memsize.c +231 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/test/memsize.rb +63 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/README.md +15 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +120 -67
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +1 -30
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +65 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +34 -21
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +98 -43
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +39 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +21 -43
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +27 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +12 -20
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +216 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +6 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/README.md +6 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +5 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +47 -45
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/test/sockettest.c +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +161 -93
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +9 -25
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +23 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +17 -14
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +23 -36
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +7 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/README.md +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +5 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +17 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +37 -41
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib-ext.gembox +18 -0
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib-io.gembox +12 -0
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib.gembox +54 -0
- data/ext/enterprise_script_service/mruby/mrblib/00class.rb +10 -0
- data/ext/enterprise_script_service/mruby/mrblib/10error.rb +4 -0
- data/ext/enterprise_script_service/mruby/mrblib/array.rb +17 -9
- data/ext/enterprise_script_service/mruby/mrblib/enum.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +3 -23
- data/ext/enterprise_script_service/mruby/mrblib/init_mrblib.c +0 -11
- data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +36 -11
- data/ext/enterprise_script_service/mruby/mrblib/range.rb +25 -3
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +2 -2
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +1 -1
- data/ext/enterprise_script_service/mruby/src/array.c +67 -90
- data/ext/enterprise_script_service/mruby/src/backtrace.c +18 -19
- data/ext/enterprise_script_service/mruby/src/class.c +819 -211
- data/ext/enterprise_script_service/mruby/src/codedump.c +226 -197
- data/ext/enterprise_script_service/mruby/src/debug.c +14 -11
- data/ext/enterprise_script_service/mruby/src/dump.c +470 -207
- data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
- data/ext/enterprise_script_service/mruby/src/error.c +94 -20
- data/ext/enterprise_script_service/mruby/src/etc.c +56 -39
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +103 -27
- data/ext/enterprise_script_service/mruby/src/gc.c +86 -349
- data/ext/enterprise_script_service/mruby/src/hash.c +1058 -723
- data/ext/enterprise_script_service/mruby/src/kernel.c +78 -226
- data/ext/enterprise_script_service/mruby/src/load.c +215 -159
- data/ext/enterprise_script_service/mruby/src/numeric.c +400 -382
- data/ext/enterprise_script_service/mruby/src/object.c +115 -90
- data/ext/enterprise_script_service/mruby/src/print.c +31 -6
- data/ext/enterprise_script_service/mruby/src/proc.c +56 -45
- data/ext/enterprise_script_service/mruby/src/range.c +49 -33
- data/ext/enterprise_script_service/mruby/src/state.c +58 -42
- data/ext/enterprise_script_service/mruby/src/string.c +151 -156
- data/ext/enterprise_script_service/mruby/src/symbol.c +132 -66
- data/ext/enterprise_script_service/mruby/src/value_array.h +1 -0
- data/ext/enterprise_script_service/mruby/src/variable.c +158 -158
- data/ext/enterprise_script_service/mruby/src/vm.c +655 -645
- data/ext/enterprise_script_service/mruby/tasks/benchmark.rake +6 -6
- data/ext/enterprise_script_service/mruby/tasks/bin.rake +23 -0
- data/ext/enterprise_script_service/mruby/tasks/core.rake +12 -0
- data/ext/enterprise_script_service/mruby/tasks/doc.rake +50 -38
- data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +64 -61
- data/ext/enterprise_script_service/mruby/tasks/libmruby.rake +10 -1
- data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +13 -1
- data/ext/enterprise_script_service/mruby/tasks/mrblib.rake +40 -0
- data/ext/enterprise_script_service/mruby/tasks/presym.rake +44 -0
- data/ext/enterprise_script_service/mruby/tasks/test.rake +68 -0
- data/ext/enterprise_script_service/mruby/tasks/toolchains/android.rake +46 -1
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +8 -7
- data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +13 -17
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +21 -25
- data/ext/enterprise_script_service/mruby/test/assert.rb +5 -4
- data/ext/enterprise_script_service/mruby/test/bintest.rb +5 -5
- data/ext/enterprise_script_service/mruby/test/t/argumenterror.rb +16 -0
- data/ext/enterprise_script_service/mruby/test/t/array.rb +7 -3
- data/ext/enterprise_script_service/mruby/test/t/bs_literal.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/ensure.rb +8 -26
- data/ext/enterprise_script_service/mruby/test/t/exception.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/float.rb +18 -8
- data/ext/enterprise_script_service/mruby/test/t/hash.rb +903 -281
- data/ext/enterprise_script_service/mruby/test/t/integer.rb +10 -38
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +16 -25
- data/ext/enterprise_script_service/mruby/test/t/literals.rb +50 -0
- data/ext/enterprise_script_service/mruby/test/t/module.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/numeric.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/range.rb +83 -1
- data/ext/enterprise_script_service/mruby/test/t/string.rb +4 -0
- data/ext/enterprise_script_service/mruby/test/t/superclass.rb +10 -10
- data/ext/enterprise_script_service/mruby/test/t/syntax.rb +24 -0
- data/ext/enterprise_script_service/mruby/test/t/vformat.rb +3 -3
- data/ext/enterprise_script_service/mruby_config.rb +2 -5
- data/ext/enterprise_script_service/mruby_engine.cpp +1 -1
- data/ext/enterprise_script_service/msgpack/.github/depends/boost.sh +56 -0
- data/ext/enterprise_script_service/msgpack/.github/workflows/coverage.yml +62 -0
- data/ext/enterprise_script_service/msgpack/.github/workflows/gha.yml +304 -0
- data/ext/enterprise_script_service/msgpack/CHANGELOG.md +11 -0
- data/ext/enterprise_script_service/msgpack/CMakeLists.txt +82 -39
- data/ext/enterprise_script_service/msgpack/Files.cmake +22 -12
- data/ext/enterprise_script_service/msgpack/QUICKSTART-C.md +26 -29
- data/ext/enterprise_script_service/msgpack/README.md +3 -2
- data/ext/enterprise_script_service/msgpack/appveyor.yml +6 -2
- data/ext/enterprise_script_service/msgpack/ci/build_cmake.sh +3 -1
- data/ext/enterprise_script_service/msgpack/cmake/CodeCoverage.cmake +55 -0
- data/ext/enterprise_script_service/msgpack/codecov.yml +36 -0
- data/ext/enterprise_script_service/msgpack/example/CMakeLists.txt +9 -5
- data/ext/enterprise_script_service/msgpack/example/boost/CMakeLists.txt +1 -1
- data/ext/enterprise_script_service/msgpack/example/c/CMakeLists.txt +17 -6
- data/ext/enterprise_script_service/msgpack/example/c/boundary.c +296 -0
- data/ext/enterprise_script_service/msgpack/example/c/jsonconv.c +419 -0
- data/ext/enterprise_script_service/msgpack/example/c/simple_c.c +1 -1
- data/ext/enterprise_script_service/msgpack/example/cpp03/CMakeLists.txt +3 -3
- data/ext/enterprise_script_service/msgpack/example/cpp11/CMakeLists.txt +2 -2
- data/ext/enterprise_script_service/msgpack/example/x3/CMakeLists.txt +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/pack.h +24 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +5 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/boost/optional.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp17/vector_byte.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/map.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_char.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_unsigned_char.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/unpack.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +4 -4
- data/ext/enterprise_script_service/msgpack/make_file_list.sh +38 -11
- data/ext/enterprise_script_service/msgpack/src/vrefbuffer.c +6 -0
- data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +86 -64
- data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/buffer.cpp +4 -47
- data/ext/enterprise_script_service/msgpack/test/buffer_c.cpp +148 -0
- data/ext/enterprise_script_service/msgpack/test/carray.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/cases.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/convert.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/fixint.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/json.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/limit.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +159 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +32 -27
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/object.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +12 -8
- data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +30 -26
- data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/raw.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/streaming.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/user_class.cpp +16 -12
- data/ext/enterprise_script_service/msgpack/test/version.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/visitor.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/zone.cpp +4 -0
- data/lib/script_core/engine.rb +24 -5
- data/lib/script_core/executable.rb +4 -3
- data/lib/script_core/version.rb +1 -1
- data/lib/tasks/script_core.rake +3 -1
- data/script_core.gemspec +1 -2
- data/spec/dummy/app/lib/script_engine.rb +64 -5
- data/spec/script_core_spec.rb +13 -0
- metadata +123 -61
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +0 -570
- data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +0 -562
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +0 -562
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +0 -562
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +0 -542
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +0 -626
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +0 -626
- data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +0 -558
- data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +0 -692
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +0 -559
- data/ext/enterprise_script_service/libseccomp/tests/18-sim-basic_whitelist.tests +0 -32
- data/ext/enterprise_script_service/libseccomp/tests/34-sim-basic_blacklist.tests +0 -32
- data/ext/enterprise_script_service/mruby/TODO +0 -8
- data/ext/enterprise_script_service/mruby/benchmark/build_config_boxing.rb +0 -28
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_arm64-v8a.rb +0 -26
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_armeabi.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +0 -30
- data/ext/enterprise_script_service/mruby/mrblib/mrblib.rake +0 -18
- data/ext/enterprise_script_service/mruby/src/crc.c +0 -39
- data/ext/enterprise_script_service/mruby/src/mruby_core.rake +0 -19
- data/ext/enterprise_script_service/mruby/travis_config.rb +0 -54
- data/ext/enterprise_script_service/msgpack/.travis.yml +0 -258
@@ -14,61 +14,69 @@
|
|
14
14
|
#include <mruby/string.h>
|
15
15
|
#include <mruby/debug.h>
|
16
16
|
#include <mruby/error.h>
|
17
|
+
#include <mruby/data.h>
|
18
|
+
#include <mruby/endian.h>
|
17
19
|
|
18
20
|
#if SIZE_MAX < UINT32_MAX
|
19
21
|
# error size_t must be at least 32 bits wide
|
20
22
|
#endif
|
21
23
|
|
22
|
-
#define FLAG_BYTEORDER_BIG 2
|
23
|
-
#define FLAG_BYTEORDER_LIL 4
|
24
|
-
#define FLAG_BYTEORDER_NATIVE 8
|
25
24
|
#define FLAG_SRC_MALLOC 1
|
26
25
|
#define FLAG_SRC_STATIC 0
|
27
26
|
|
28
27
|
#define SIZE_ERROR_MUL(nmemb, size) ((size_t)(nmemb) > SIZE_MAX / (size))
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
{
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
struct rite_binary_header header;
|
41
|
-
return ((uint8_t *)header.binary_crc - (uint8_t *)&header) + sizeof(header.binary_crc);
|
42
|
-
}
|
43
|
-
|
44
|
-
#ifndef MRB_WITHOUT_FLOAT
|
45
|
-
double mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck);
|
29
|
+
#define DEFINE_READ_IREP_FUNC(funcdecl, basecall) \
|
30
|
+
funcdecl \
|
31
|
+
{ \
|
32
|
+
int ai = mrb_gc_arena_save(mrb); \
|
33
|
+
struct RProc *proc = basecall; \
|
34
|
+
struct mrb_irep *irep = (mrb_irep*)(proc ? proc->body.irep : NULL); \
|
35
|
+
if (irep) proc->body.irep = NULL; \
|
36
|
+
mrb_gc_arena_restore(mrb, ai); \
|
37
|
+
return irep; \
|
38
|
+
}
|
46
39
|
|
40
|
+
#ifndef MRB_NO_FLOAT
|
47
41
|
static double
|
48
|
-
str_to_double(mrb_state *mrb, const char *p
|
42
|
+
str_to_double(mrb_state *mrb, const char *p)
|
49
43
|
{
|
50
|
-
/*
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
44
|
+
/* dump IEEE754 little endian binary */
|
45
|
+
union {
|
46
|
+
char s[sizeof(double)];
|
47
|
+
double f;
|
48
|
+
} u;
|
49
|
+
|
50
|
+
if (littleendian) {
|
51
|
+
memcpy(u.s, p, sizeof(double));
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
size_t i;
|
55
|
+
for (i=0; i<sizeof(double); i++) {
|
56
|
+
u.s[i] = p[sizeof(double)-i-1];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return u.f;
|
56
60
|
}
|
57
61
|
#endif
|
58
62
|
|
59
|
-
mrb_value mrb_str_len_to_inum(mrb_state *mrb, const char *str,
|
63
|
+
mrb_value mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, mrb_int base, int badcheck);
|
60
64
|
|
61
|
-
static
|
62
|
-
read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
|
65
|
+
static mrb_bool
|
66
|
+
read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags, mrb_irep **irepp)
|
63
67
|
{
|
64
68
|
int i;
|
65
69
|
const uint8_t *src = bin;
|
66
70
|
ptrdiff_t diff;
|
67
71
|
uint16_t tt, pool_data_len, snl;
|
68
72
|
int plen;
|
73
|
+
mrb_pool_value *pool;
|
74
|
+
mrb_sym *syms;
|
69
75
|
int ai = mrb_gc_arena_save(mrb);
|
70
76
|
mrb_irep *irep = mrb_add_irep(mrb);
|
71
77
|
|
78
|
+
*irepp = irep;
|
79
|
+
|
72
80
|
/* skip record size */
|
73
81
|
src += sizeof(uint32_t);
|
74
82
|
|
@@ -81,153 +89,199 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
|
|
81
89
|
src += sizeof(uint16_t);
|
82
90
|
|
83
91
|
/* number of child irep */
|
84
|
-
irep->rlen = (
|
92
|
+
irep->rlen = (uint8_t)bin_to_uint16(src);
|
85
93
|
src += sizeof(uint16_t);
|
86
94
|
|
87
95
|
/* Binary Data Section */
|
88
|
-
/* ISEQ BLOCK */
|
89
|
-
irep->
|
90
|
-
src += sizeof(
|
91
|
-
|
96
|
+
/* ISEQ BLOCK (and CATCH HANDLER TABLE BLOCK) */
|
97
|
+
irep->clen = bin_to_uint16(src); /* number of catch handler */
|
98
|
+
src += sizeof(uint16_t);
|
99
|
+
irep->ilen = bin_to_uint16(src);
|
100
|
+
src += sizeof(uint16_t);
|
92
101
|
|
93
102
|
if (irep->ilen > 0) {
|
103
|
+
size_t data_len = sizeof(mrb_code) * irep->ilen +
|
104
|
+
sizeof(struct mrb_irep_catch_handler) * irep->clen;
|
105
|
+
mrb_static_assert1(sizeof(struct mrb_irep_catch_handler) == 13);
|
94
106
|
if (SIZE_ERROR_MUL(irep->ilen, sizeof(mrb_code))) {
|
95
|
-
return
|
107
|
+
return FALSE;
|
96
108
|
}
|
97
|
-
if ((flags & FLAG_SRC_MALLOC) == 0
|
98
|
-
(flags & FLAG_BYTEORDER_NATIVE)) {
|
109
|
+
if ((flags & FLAG_SRC_MALLOC) == 0) {
|
99
110
|
irep->iseq = (mrb_code*)src;
|
100
|
-
src += sizeof(mrb_code) * irep->ilen;
|
101
111
|
irep->flags |= MRB_ISEQ_NO_FREE;
|
102
112
|
}
|
103
113
|
else {
|
104
|
-
size_t data_len = sizeof(mrb_code) * irep->ilen;
|
105
114
|
void *buf = mrb_malloc(mrb, data_len);
|
106
115
|
irep->iseq = (mrb_code *)buf;
|
107
116
|
memcpy(buf, src, data_len);
|
108
|
-
src += data_len;
|
109
117
|
}
|
118
|
+
src += data_len;
|
110
119
|
}
|
111
120
|
|
112
121
|
/* POOL BLOCK */
|
113
|
-
plen =
|
114
|
-
src += sizeof(
|
122
|
+
plen = bin_to_uint16(src); /* number of pool */
|
123
|
+
src += sizeof(uint16_t);
|
115
124
|
if (plen > 0) {
|
116
125
|
if (SIZE_ERROR_MUL(plen, sizeof(mrb_value))) {
|
117
|
-
return
|
126
|
+
return FALSE;
|
118
127
|
}
|
119
|
-
irep->pool = (
|
128
|
+
irep->pool = pool = (mrb_pool_value*)mrb_calloc(mrb, sizeof(mrb_pool_value), plen);
|
120
129
|
|
121
130
|
for (i = 0; i < plen; i++) {
|
122
|
-
const char *s;
|
123
131
|
mrb_bool st = (flags & FLAG_SRC_MALLOC)==0;
|
124
132
|
|
125
133
|
tt = *src++; /* pool TT */
|
126
|
-
pool_data_len = bin_to_uint16(src); /* pool data length */
|
127
|
-
src += sizeof(uint16_t);
|
128
|
-
s = (const char*)src;
|
129
|
-
src += pool_data_len;
|
130
134
|
switch (tt) { /* pool data */
|
131
|
-
case
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
+
case IREP_TT_INT32:
|
136
|
+
{
|
137
|
+
mrb_int v = (int32_t)bin_to_uint32(src);
|
138
|
+
src += sizeof(uint32_t);
|
139
|
+
#ifdef MRB_64BIT
|
140
|
+
pool[i].tt = IREP_TT_INT64;
|
141
|
+
pool[i].u.i64 = (int64_t)v;
|
135
142
|
#else
|
136
|
-
|
143
|
+
pool[i].tt = IREP_TT_INT32;
|
144
|
+
pool[i].u.i32 = v;
|
137
145
|
#endif
|
138
146
|
}
|
139
147
|
break;
|
148
|
+
case IREP_TT_INT64:
|
149
|
+
#ifdef MRB_64BIT
|
150
|
+
{
|
151
|
+
uint64_t i64 = bin_to_uint32(src);
|
152
|
+
src += sizeof(uint32_t);
|
153
|
+
i64 <<= 32;
|
154
|
+
i64 |= bin_to_uint32(src);
|
155
|
+
src += sizeof(uint32_t);
|
156
|
+
pool[i].u.i64 = (int64_t)i64;
|
157
|
+
}
|
158
|
+
break;
|
159
|
+
#else
|
160
|
+
return FALSE; /* INT64 not supported on MRB_32BIT */
|
161
|
+
#endif
|
140
162
|
|
141
|
-
#ifndef MRB_WITHOUT_FLOAT
|
142
163
|
case IREP_TT_FLOAT:
|
143
|
-
|
164
|
+
#ifndef MRB_NO_FLOAT
|
165
|
+
pool[i].tt = tt;
|
166
|
+
pool[i].u.f = str_to_double(mrb, (const char*)src);
|
167
|
+
src += sizeof(double);
|
144
168
|
break;
|
169
|
+
#else
|
170
|
+
return FALSE; /* MRB_NO_FLOAT */
|
145
171
|
#endif
|
146
172
|
|
147
|
-
case
|
148
|
-
|
173
|
+
case IREP_TT_STR:
|
174
|
+
pool_data_len = bin_to_uint16(src); /* pool data length */
|
175
|
+
src += sizeof(uint16_t);
|
176
|
+
if (st) {
|
177
|
+
pool[i].tt = (pool_data_len<<2) | IREP_TT_SSTR;
|
178
|
+
pool[i].u.str = (const char*)src;
|
179
|
+
}
|
180
|
+
else {
|
181
|
+
char *p;
|
182
|
+
pool[i].tt = (pool_data_len<<2) | IREP_TT_STR;
|
183
|
+
p = (char*)mrb_malloc(mrb, pool_data_len+1);
|
184
|
+
memcpy(p, src, pool_data_len+1);
|
185
|
+
pool[i].u.str = (const char*)p;
|
186
|
+
}
|
187
|
+
src += pool_data_len + 1;
|
149
188
|
break;
|
150
189
|
|
151
190
|
default:
|
152
191
|
/* should not happen */
|
153
|
-
|
154
|
-
break;
|
192
|
+
return FALSE;
|
155
193
|
}
|
156
|
-
irep->plen
|
157
|
-
mrb_gc_arena_restore(mrb, ai);
|
194
|
+
irep->plen = i+1;
|
158
195
|
}
|
159
196
|
}
|
160
197
|
|
161
198
|
/* SYMS BLOCK */
|
162
|
-
irep->slen = (
|
163
|
-
src += sizeof(
|
199
|
+
irep->slen = bin_to_uint16(src); /* syms length */
|
200
|
+
src += sizeof(uint16_t);
|
164
201
|
if (irep->slen > 0) {
|
165
202
|
if (SIZE_ERROR_MUL(irep->slen, sizeof(mrb_sym))) {
|
166
|
-
return
|
203
|
+
return FALSE;
|
167
204
|
}
|
168
|
-
irep->syms = (mrb_sym *)mrb_malloc(mrb, sizeof(mrb_sym) * irep->slen);
|
205
|
+
irep->syms = syms = (mrb_sym *)mrb_malloc(mrb, sizeof(mrb_sym) * irep->slen);
|
169
206
|
|
170
207
|
for (i = 0; i < irep->slen; i++) {
|
171
208
|
snl = bin_to_uint16(src); /* symbol name length */
|
172
209
|
src += sizeof(uint16_t);
|
173
210
|
|
174
211
|
if (snl == MRB_DUMP_NULL_SYM_LEN) {
|
175
|
-
|
212
|
+
syms[i] = 0;
|
176
213
|
continue;
|
177
214
|
}
|
178
215
|
|
179
216
|
if (flags & FLAG_SRC_MALLOC) {
|
180
|
-
|
217
|
+
syms[i] = mrb_intern(mrb, (char *)src, snl);
|
181
218
|
}
|
182
219
|
else {
|
183
|
-
|
220
|
+
syms[i] = mrb_intern_static(mrb, (char *)src, snl);
|
184
221
|
}
|
185
222
|
src += snl + 1;
|
186
|
-
|
187
223
|
mrb_gc_arena_restore(mrb, ai);
|
188
224
|
}
|
189
225
|
}
|
190
226
|
|
191
|
-
irep->reps = (mrb_irep**)mrb_malloc(mrb, sizeof(mrb_irep*)*irep->rlen);
|
192
|
-
|
193
227
|
diff = src - bin;
|
194
228
|
mrb_assert_int_fit(ptrdiff_t, diff, size_t, SIZE_MAX);
|
195
229
|
*len = (size_t)diff;
|
196
230
|
|
197
|
-
return
|
231
|
+
return TRUE;
|
198
232
|
}
|
199
233
|
|
200
|
-
static
|
201
|
-
read_irep_record(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
|
234
|
+
static mrb_bool
|
235
|
+
read_irep_record(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags, mrb_irep **irepp)
|
202
236
|
{
|
203
|
-
|
237
|
+
int ai = mrb_gc_arena_save(mrb);
|
238
|
+
mrb_bool readsuccess = read_irep_record_1(mrb, bin, len, flags, irepp);
|
239
|
+
mrb_irep **reps;
|
204
240
|
int i;
|
205
241
|
|
206
|
-
|
207
|
-
|
242
|
+
mrb_gc_arena_restore(mrb, ai);
|
243
|
+
if (!readsuccess) {
|
244
|
+
return FALSE;
|
208
245
|
}
|
209
246
|
|
247
|
+
reps = (mrb_irep**)mrb_calloc(mrb, (*irepp)->rlen, sizeof(mrb_irep*));
|
248
|
+
(*irepp)->reps = (const mrb_irep**)reps;
|
249
|
+
|
210
250
|
bin += *len;
|
211
|
-
for (i=0; i<
|
251
|
+
for (i=0; i<(*irepp)->rlen; i++) {
|
212
252
|
size_t rlen;
|
213
253
|
|
214
|
-
|
215
|
-
|
216
|
-
|
254
|
+
readsuccess = read_irep_record(mrb, bin, &rlen, flags, &reps[i]);
|
255
|
+
mrb_gc_arena_restore(mrb, ai);
|
256
|
+
if (!readsuccess) {
|
257
|
+
return FALSE;
|
217
258
|
}
|
218
259
|
bin += rlen;
|
219
260
|
*len += rlen;
|
220
261
|
}
|
221
|
-
|
262
|
+
|
263
|
+
return TRUE;
|
222
264
|
}
|
223
265
|
|
224
266
|
static mrb_irep*
|
225
|
-
read_section_irep(mrb_state *mrb, const uint8_t *bin, uint8_t flags)
|
267
|
+
read_section_irep(mrb_state *mrb, const uint8_t *bin, uint8_t flags, struct RProc **proc)
|
226
268
|
{
|
227
269
|
size_t len;
|
228
270
|
|
271
|
+
/*
|
272
|
+
* This proc object keeps all the data in progress to avoid memory leaks
|
273
|
+
* if something goes wrong while reading irep.
|
274
|
+
*/
|
275
|
+
*proc = mrb_proc_new(mrb, NULL);
|
276
|
+
|
277
|
+
mrb_irep **irepp = (mrb_irep**)&(*proc)->body.irep;
|
229
278
|
bin += sizeof(struct rite_section_irep_header);
|
230
|
-
|
279
|
+
if (read_irep_record(mrb, bin, &len, flags, irepp)) {
|
280
|
+
return *irepp;
|
281
|
+
}
|
282
|
+
else {
|
283
|
+
return NULL;
|
284
|
+
}
|
231
285
|
}
|
232
286
|
|
233
287
|
static int
|
@@ -238,25 +292,26 @@ read_debug_record(mrb_state *mrb, const uint8_t *start, mrb_irep* irep, size_t *
|
|
238
292
|
size_t record_size;
|
239
293
|
uint16_t f_idx;
|
240
294
|
int i;
|
295
|
+
mrb_irep_debug_info *debug;
|
241
296
|
|
242
297
|
if (irep->debug_info) { return MRB_DUMP_INVALID_IREP; }
|
243
298
|
|
244
|
-
irep->debug_info = (mrb_irep_debug_info*)
|
245
|
-
|
299
|
+
irep->debug_info = debug = (mrb_irep_debug_info*)mrb_calloc(mrb, 1, sizeof(mrb_irep_debug_info));
|
300
|
+
debug->pc_count = (uint32_t)irep->ilen;
|
246
301
|
|
247
302
|
record_size = (size_t)bin_to_uint32(bin);
|
248
303
|
bin += sizeof(uint32_t);
|
249
304
|
|
250
|
-
|
251
|
-
|
305
|
+
debug->flen = bin_to_uint16(bin);
|
306
|
+
debug->files = (mrb_irep_debug_info_file**)mrb_calloc(mrb, irep->debug_info->flen, sizeof(mrb_irep_debug_info*));
|
252
307
|
bin += sizeof(uint16_t);
|
253
308
|
|
254
|
-
for (f_idx = 0; f_idx <
|
309
|
+
for (f_idx = 0; f_idx < debug->flen; ++f_idx) {
|
255
310
|
mrb_irep_debug_info_file *file;
|
256
311
|
uint16_t filename_idx;
|
257
312
|
|
258
|
-
file = (mrb_irep_debug_info_file *)
|
259
|
-
|
313
|
+
file = (mrb_irep_debug_info_file *)mrb_calloc(mrb, 1, sizeof(*file));
|
314
|
+
debug->files[f_idx] = file;
|
260
315
|
|
261
316
|
file->start_pos = bin_to_uint32(bin);
|
262
317
|
bin += sizeof(uint32_t);
|
@@ -285,8 +340,8 @@ read_debug_record(mrb_state *mrb, const uint8_t *start, mrb_irep* irep, size_t *
|
|
285
340
|
case mrb_debug_line_flat_map: {
|
286
341
|
uint32_t l;
|
287
342
|
|
288
|
-
file->lines.flat_map = (mrb_irep_debug_info_line*)
|
289
|
-
mrb,
|
343
|
+
file->lines.flat_map = (mrb_irep_debug_info_line*)mrb_calloc(
|
344
|
+
mrb, (size_t)(file->line_entry_count), sizeof(mrb_irep_debug_info_line));
|
290
345
|
for (l = 0; l < file->line_entry_count; ++l) {
|
291
346
|
file->lines.flat_map[l].start_pos = bin_to_uint32(bin);
|
292
347
|
bin += sizeof(uint32_t);
|
@@ -310,7 +365,7 @@ read_debug_record(mrb_state *mrb, const uint8_t *start, mrb_irep* irep, size_t *
|
|
310
365
|
size_t len;
|
311
366
|
int ret;
|
312
367
|
|
313
|
-
ret = read_debug_record(mrb, bin, irep->reps[i], &len, filenames, filenames_len);
|
368
|
+
ret = read_debug_record(mrb, bin, (mrb_irep*)irep->reps[i], &len, filenames, filenames_len);
|
314
369
|
if (ret != MRB_DUMP_OK) return ret;
|
315
370
|
bin += len;
|
316
371
|
}
|
@@ -333,6 +388,7 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t
|
|
333
388
|
int result;
|
334
389
|
uint16_t filenames_len;
|
335
390
|
mrb_sym *filenames;
|
391
|
+
mrb_value filenames_obj;
|
336
392
|
|
337
393
|
bin = start;
|
338
394
|
header = (struct rite_section_debug_header *)bin;
|
@@ -340,7 +396,8 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t
|
|
340
396
|
|
341
397
|
filenames_len = bin_to_uint16(bin);
|
342
398
|
bin += sizeof(uint16_t);
|
343
|
-
|
399
|
+
filenames_obj = mrb_str_new(mrb, NULL, sizeof(mrb_sym) * (size_t)filenames_len);
|
400
|
+
filenames = (mrb_sym*)RSTRING_PTR(filenames_obj);
|
344
401
|
for (i = 0; i < filenames_len; ++i) {
|
345
402
|
uint16_t f_len = bin_to_uint16(bin);
|
346
403
|
bin += sizeof(uint16_t);
|
@@ -364,7 +421,7 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t
|
|
364
421
|
}
|
365
422
|
|
366
423
|
debug_exit:
|
367
|
-
|
424
|
+
mrb_str_resize(mrb, filenames_obj, 0);
|
368
425
|
return result;
|
369
426
|
}
|
370
427
|
|
@@ -372,34 +429,31 @@ static int
|
|
372
429
|
read_lv_record(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, size_t *record_len, mrb_sym const *syms, uint32_t syms_len)
|
373
430
|
{
|
374
431
|
const uint8_t *bin = start;
|
432
|
+
mrb_sym *lv;
|
375
433
|
ptrdiff_t diff;
|
376
434
|
int i;
|
377
435
|
|
378
|
-
irep->lv = (
|
436
|
+
irep->lv = lv = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym) * (irep->nlocals - 1));
|
379
437
|
|
380
|
-
for (i = 0; i + 1< irep->nlocals; ++i) {
|
438
|
+
for (i = 0; i + 1 < irep->nlocals; ++i) {
|
381
439
|
uint16_t const sym_idx = bin_to_uint16(bin);
|
382
440
|
bin += sizeof(uint16_t);
|
383
441
|
if (sym_idx == RITE_LV_NULL_MARK) {
|
384
|
-
|
385
|
-
irep->lv[i].r = 0;
|
442
|
+
lv[i] = 0;
|
386
443
|
}
|
387
444
|
else {
|
388
445
|
if (sym_idx >= syms_len) {
|
389
446
|
return MRB_DUMP_GENERAL_FAILURE;
|
390
447
|
}
|
391
|
-
|
392
|
-
|
393
|
-
irep->lv[i].r = bin_to_uint16(bin);
|
448
|
+
lv[i] = syms[sym_idx];
|
394
449
|
}
|
395
|
-
bin += sizeof(uint16_t);
|
396
450
|
}
|
397
451
|
|
398
452
|
for (i = 0; i < irep->rlen; ++i) {
|
399
453
|
size_t len;
|
400
454
|
int ret;
|
401
455
|
|
402
|
-
ret = read_lv_record(mrb, bin, irep->reps[i], &len, syms, syms_len);
|
456
|
+
ret = read_lv_record(mrb, bin, (mrb_irep*)irep->reps[i], &len, syms, syms_len);
|
403
457
|
if (ret != MRB_DUMP_OK) return ret;
|
404
458
|
bin += len;
|
405
459
|
}
|
@@ -422,6 +476,7 @@ read_section_lv(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t fl
|
|
422
476
|
int result;
|
423
477
|
uint32_t syms_len;
|
424
478
|
mrb_sym *syms;
|
479
|
+
mrb_value syms_obj;
|
425
480
|
mrb_sym (*intern_func)(mrb_state*, const char*, size_t) =
|
426
481
|
(flags & FLAG_SRC_MALLOC)? mrb_intern : mrb_intern_static;
|
427
482
|
|
@@ -431,7 +486,8 @@ read_section_lv(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t fl
|
|
431
486
|
|
432
487
|
syms_len = bin_to_uint32(bin);
|
433
488
|
bin += sizeof(uint32_t);
|
434
|
-
|
489
|
+
syms_obj = mrb_str_new(mrb, NULL, sizeof(mrb_sym) * (size_t)syms_len);
|
490
|
+
syms = (mrb_sym*)RSTRING_PTR(syms_obj);
|
435
491
|
for (i = 0; i < syms_len; ++i) {
|
436
492
|
uint16_t const str_len = bin_to_uint16(bin);
|
437
493
|
bin += sizeof(uint16_t);
|
@@ -451,12 +507,12 @@ read_section_lv(mrb_state *mrb, const uint8_t *start, mrb_irep *irep, uint8_t fl
|
|
451
507
|
}
|
452
508
|
|
453
509
|
lv_exit:
|
454
|
-
|
510
|
+
mrb_str_resize(mrb, syms_obj, 0);
|
455
511
|
return result;
|
456
512
|
}
|
457
513
|
|
458
514
|
static int
|
459
|
-
read_binary_header(const uint8_t *bin, size_t bufsize, size_t *bin_size,
|
515
|
+
read_binary_header(const uint8_t *bin, size_t bufsize, size_t *bin_size, uint8_t *flags)
|
460
516
|
{
|
461
517
|
const struct rite_binary_header *header = (const struct rite_binary_header *)bin;
|
462
518
|
|
@@ -464,29 +520,19 @@ read_binary_header(const uint8_t *bin, size_t bufsize, size_t *bin_size, uint16_
|
|
464
520
|
return MRB_DUMP_READ_FAULT;
|
465
521
|
}
|
466
522
|
|
467
|
-
if (memcmp(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident))
|
468
|
-
if (bigendian_p())
|
469
|
-
*flags |= FLAG_BYTEORDER_NATIVE;
|
470
|
-
else
|
471
|
-
*flags |= FLAG_BYTEORDER_BIG;
|
472
|
-
}
|
473
|
-
else if (memcmp(header->binary_ident, RITE_BINARY_IDENT_LIL, sizeof(header->binary_ident)) == 0) {
|
474
|
-
if (bigendian_p())
|
475
|
-
*flags |= FLAG_BYTEORDER_LIL;
|
476
|
-
else
|
477
|
-
*flags |= FLAG_BYTEORDER_NATIVE;
|
478
|
-
}
|
479
|
-
else {
|
523
|
+
if (memcmp(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident)) != 0) {
|
480
524
|
return MRB_DUMP_INVALID_FILE_HEADER;
|
481
525
|
}
|
482
526
|
|
483
|
-
if
|
527
|
+
/* if major version is different, they are incompatible */
|
528
|
+
if (memcmp(header->major_version, RITE_BINARY_MAJOR_VER, sizeof(header->major_version)) != 0) {
|
484
529
|
return MRB_DUMP_INVALID_FILE_HEADER;
|
485
530
|
}
|
486
|
-
|
487
|
-
if (
|
488
|
-
|
531
|
+
/* if minor version is different, we can accept the older version */
|
532
|
+
if (memcmp(header->minor_version, RITE_BINARY_MINOR_VER, sizeof(header->minor_version)) > 0) {
|
533
|
+
return MRB_DUMP_INVALID_FILE_HEADER;
|
489
534
|
}
|
535
|
+
|
490
536
|
*bin_size = (size_t)bin_to_uint32(header->binary_size);
|
491
537
|
|
492
538
|
if (bufsize < *bin_size) {
|
@@ -496,35 +542,29 @@ read_binary_header(const uint8_t *bin, size_t bufsize, size_t *bin_size, uint16_
|
|
496
542
|
return MRB_DUMP_OK;
|
497
543
|
}
|
498
544
|
|
499
|
-
static
|
545
|
+
static struct RProc*
|
500
546
|
read_irep(mrb_state *mrb, const uint8_t *bin, size_t bufsize, uint8_t flags)
|
501
547
|
{
|
502
548
|
int result;
|
549
|
+
struct RProc *proc = NULL;
|
503
550
|
mrb_irep *irep = NULL;
|
504
551
|
const struct rite_section_header *section_header;
|
505
|
-
uint16_t crc;
|
506
552
|
size_t bin_size = 0;
|
507
|
-
size_t n;
|
508
553
|
|
509
554
|
if ((mrb == NULL) || (bin == NULL)) {
|
510
555
|
return NULL;
|
511
556
|
}
|
512
557
|
|
513
|
-
result = read_binary_header(bin, bufsize, &bin_size, &
|
558
|
+
result = read_binary_header(bin, bufsize, &bin_size, &flags);
|
514
559
|
if (result != MRB_DUMP_OK) {
|
515
560
|
return NULL;
|
516
561
|
}
|
517
562
|
|
518
|
-
n = offset_crc_body();
|
519
|
-
if (crc != calc_crc_16_ccitt(bin + n, bin_size - n, 0)) {
|
520
|
-
return NULL;
|
521
|
-
}
|
522
|
-
|
523
563
|
bin += sizeof(struct rite_binary_header);
|
524
564
|
do {
|
525
565
|
section_header = (const struct rite_section_header *)bin;
|
526
566
|
if (memcmp(section_header->section_ident, RITE_SECTION_IREP_IDENT, sizeof(section_header->section_ident)) == 0) {
|
527
|
-
irep = read_section_irep(mrb, bin, flags);
|
567
|
+
irep = read_section_irep(mrb, bin, flags, &proc);
|
528
568
|
if (!irep) return NULL;
|
529
569
|
}
|
530
570
|
else if (memcmp(section_header->section_ident, RITE_SECTION_DEBUG_IDENT, sizeof(section_header->section_ident)) == 0) {
|
@@ -544,11 +584,11 @@ read_irep(mrb_state *mrb, const uint8_t *bin, size_t bufsize, uint8_t flags)
|
|
544
584
|
bin += bin_to_uint32(section_header->section_size);
|
545
585
|
} while (memcmp(section_header->section_ident, RITE_BINARY_EOF, sizeof(section_header->section_ident)) != 0);
|
546
586
|
|
547
|
-
return
|
587
|
+
return proc;
|
548
588
|
}
|
549
589
|
|
550
|
-
|
551
|
-
|
590
|
+
static struct RProc*
|
591
|
+
mrb_proc_read_irep(mrb_state *mrb, const uint8_t *bin)
|
552
592
|
{
|
553
593
|
#if defined(MRB_USE_LINK_TIME_RO_DATA_P) || defined(MRB_USE_CUSTOM_RO_DATA_P)
|
554
594
|
uint8_t flags = mrb_ro_data_p((char*)bin) ? FLAG_SRC_STATIC : FLAG_SRC_MALLOC;
|
@@ -559,34 +599,38 @@ mrb_read_irep(mrb_state *mrb, const uint8_t *bin)
|
|
559
599
|
return read_irep(mrb, bin, (size_t)-1, flags);
|
560
600
|
}
|
561
601
|
|
562
|
-
|
563
|
-
|
602
|
+
DEFINE_READ_IREP_FUNC(
|
603
|
+
mrb_irep *mrb_read_irep(mrb_state *mrb, const uint8_t *bin),
|
604
|
+
mrb_proc_read_irep(mrb, bin))
|
605
|
+
|
606
|
+
static struct RProc*
|
607
|
+
mrb_proc_read_irep_buf(mrb_state *mrb, const void *buf, size_t bufsize)
|
564
608
|
{
|
565
609
|
return read_irep(mrb, (const uint8_t *)buf, bufsize, FLAG_SRC_MALLOC);
|
566
610
|
}
|
567
611
|
|
612
|
+
DEFINE_READ_IREP_FUNC(
|
613
|
+
MRB_API mrb_irep *mrb_read_irep_buf(mrb_state *mrb, const void *buf, size_t bufsize),
|
614
|
+
mrb_proc_read_irep_buf(mrb, buf, bufsize))
|
615
|
+
|
568
616
|
void mrb_exc_set(mrb_state *mrb, mrb_value exc);
|
569
617
|
|
570
618
|
static void
|
571
619
|
irep_error(mrb_state *mrb)
|
572
620
|
{
|
573
|
-
mrb_exc_set(mrb,
|
621
|
+
mrb_exc_set(mrb, mrb_exc_new_lit(mrb, E_SCRIPT_ERROR, "irep load error"));
|
574
622
|
}
|
575
623
|
|
576
624
|
void mrb_codedump_all(mrb_state*, struct RProc*);
|
577
625
|
|
578
626
|
static mrb_value
|
579
|
-
load_irep(mrb_state *mrb,
|
627
|
+
load_irep(mrb_state *mrb, struct RProc *proc, mrbc_context *c)
|
580
628
|
{
|
581
|
-
|
582
|
-
|
583
|
-
if (!irep) {
|
629
|
+
if (!proc || !proc->body.irep) {
|
584
630
|
irep_error(mrb);
|
585
631
|
return mrb_nil_value();
|
586
632
|
}
|
587
|
-
proc = mrb_proc_new(mrb, irep);
|
588
633
|
proc->c = NULL;
|
589
|
-
mrb_irep_decref(mrb, irep);
|
590
634
|
if (c && c->dump_result) mrb_codedump_all(mrb, proc);
|
591
635
|
if (c && c->no_exec) return mrb_obj_value(proc);
|
592
636
|
return mrb_top_run(mrb, proc, mrb_top_self(mrb), 0);
|
@@ -595,13 +639,15 @@ load_irep(mrb_state *mrb, mrb_irep *irep, mrbc_context *c)
|
|
595
639
|
MRB_API mrb_value
|
596
640
|
mrb_load_irep_cxt(mrb_state *mrb, const uint8_t *bin, mrbc_context *c)
|
597
641
|
{
|
598
|
-
|
642
|
+
struct RProc *proc = mrb_proc_read_irep(mrb, bin);
|
643
|
+
if (!proc) return mrb_undef_value();
|
644
|
+
return load_irep(mrb, proc, c);
|
599
645
|
}
|
600
646
|
|
601
647
|
MRB_API mrb_value
|
602
648
|
mrb_load_irep_buf_cxt(mrb_state *mrb, const void *buf, size_t bufsize, mrbc_context *c)
|
603
649
|
{
|
604
|
-
return load_irep(mrb,
|
650
|
+
return load_irep(mrb, mrb_proc_read_irep_buf(mrb, buf, bufsize), c);
|
605
651
|
}
|
606
652
|
|
607
653
|
MRB_API mrb_value
|
@@ -616,12 +662,18 @@ mrb_load_irep_buf(mrb_state *mrb, const void *buf, size_t bufsize)
|
|
616
662
|
return mrb_load_irep_buf_cxt(mrb, buf, bufsize, NULL);
|
617
663
|
}
|
618
664
|
|
619
|
-
|
665
|
+
MRB_API mrb_value
|
666
|
+
mrb_load_proc(mrb_state *mrb, const struct RProc *proc)
|
667
|
+
{
|
668
|
+
return mrb_vm_run(mrb, proc, mrb_top_self(mrb), 0);
|
669
|
+
}
|
670
|
+
|
671
|
+
#ifndef MRB_NO_STDIO
|
620
672
|
|
621
|
-
|
622
|
-
|
673
|
+
static struct RProc*
|
674
|
+
mrb_proc_read_irep_file(mrb_state *mrb, FILE *fp)
|
623
675
|
{
|
624
|
-
|
676
|
+
struct RProc *proc = NULL;
|
625
677
|
uint8_t *buf;
|
626
678
|
const size_t header_size = sizeof(struct rite_binary_header);
|
627
679
|
size_t buf_size = 0;
|
@@ -636,7 +688,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
|
|
636
688
|
if (fread(buf, header_size, 1, fp) == 0) {
|
637
689
|
goto irep_exit;
|
638
690
|
}
|
639
|
-
result = read_binary_header(buf, (size_t)-1, &buf_size,
|
691
|
+
result = read_binary_header(buf, (size_t)-1, &buf_size, &flags);
|
640
692
|
if (result != MRB_DUMP_OK || buf_size <= header_size) {
|
641
693
|
goto irep_exit;
|
642
694
|
}
|
@@ -645,17 +697,21 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
|
|
645
697
|
if (fread(buf+header_size, buf_size-header_size, 1, fp) == 0) {
|
646
698
|
goto irep_exit;
|
647
699
|
}
|
648
|
-
|
700
|
+
proc = read_irep(mrb, buf, (size_t)-1, FLAG_SRC_MALLOC);
|
649
701
|
|
650
702
|
irep_exit:
|
651
703
|
mrb_free(mrb, buf);
|
652
|
-
return
|
704
|
+
return proc;
|
653
705
|
}
|
654
706
|
|
707
|
+
DEFINE_READ_IREP_FUNC(
|
708
|
+
mrb_irep *mrb_read_irep_file(mrb_state *mrb, FILE *fp),
|
709
|
+
mrb_proc_read_irep_file(mrb, fp))
|
710
|
+
|
655
711
|
MRB_API mrb_value
|
656
712
|
mrb_load_irep_file_cxt(mrb_state *mrb, FILE* fp, mrbc_context *c)
|
657
713
|
{
|
658
|
-
return load_irep(mrb,
|
714
|
+
return load_irep(mrb, mrb_proc_read_irep_file(mrb, fp), c);
|
659
715
|
}
|
660
716
|
|
661
717
|
MRB_API mrb_value
|
@@ -663,4 +719,4 @@ mrb_load_irep_file(mrb_state *mrb, FILE* fp)
|
|
663
719
|
{
|
664
720
|
return mrb_load_irep_file_cxt(mrb, fp, NULL);
|
665
721
|
}
|
666
|
-
#endif /*
|
722
|
+
#endif /* MRB_NO_STDIO */
|