Giter Club home page Giter Club logo

lunatik's People

Contributors

cj-matti-niemenmaa avatar gabriel-cujo avatar glk0 avatar iru- avatar lhf avatar lneto avatar roberto-ieru avatar romariorios avatar sav-cujo avatar sheharyaar avatar tammela avatar tammela-cujo avatar victornogueirario avatar vitormob avatar wceles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lunatik's Issues

# operator will cause leak

use # operator not only cause gc problem but also overwrite data in memory and cause kernel panic .

collectgarbage("collect")
before = collectgarbage("count");
for i = 1, 10000 do
    local tb= {};
    for j = 1, 100 do
        tb[j]  ={ k=1}
    end

    -- gc not work
    --local i = #tb

    --- gc not work
    --for i = 1, #tb do
    --
    --end
    
    ---- gc not work
    --local tb = {}
    --for i = 1, 100 do
    --    tb[i]="aa"
    --end
    --local i = #tb



    
    -- gc work fine
    --local tb2={ {a=1}}
    --local i = #tb2

    ---- gc work fine
    --local tb = {{k=1},{k=1},{k=1},{k=1},{k=1},{k=1},{k=1},{k=1},{k=1},{k=1}}
    --local i = #tb



    ---- gc work fine
    --local tb = {"a","b","c","a","b","c","a","b","c","a","b","c"}
    --local i = #tb


    ---- gc work fine
    --local str = "adsfafas"
    --local len = #str

    ---- gc work fine
    --for i = 1, 100 do
    --
    --end
    --
    ----gc work fine
    --for i, v in pairs(tb) do
    --
    --end

end
for i = 1, 1000 do
    collectgarbage("collect")
end
after = collectgarbage("count");
print(string.format("gc before: %s after: %s", before, after));

image

systrack example breaks

When trying to run the systrack example, I can cat /dev/systrack a couple of times but then the system breaks.

My environment:

Debian GNU/Linux 12 (bookworm)
Linux debian-dev 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
lunatik 3.4
gcc (Debian 12.2.0-14) 12.2.0

Full logs attached: systrack-dmesg.log

log snippet:

Mar 09 11:41:07.105153 debian-dev kernel: lunatik: loading out-of-tree module taints kernel.
Mar 09 11:41:07.105320 debian-dev kernel: lunatik: module verification failed: signature and/or required key missing - tainting kernel
Mar 09 11:42:33.392989 debian-dev kernel: luathread: [00000000ae5213a3] attempt to call a string value
Mar 09 11:44:34.933202 debian-dev kernel: luaprobe: couldn't find probe table
Mar 09 11:45:17.905016 debian-dev kernel: BUG: scheduling while atomic: node/1316/0x00000002
Mar 09 11:45:17.905465 debian-dev kernel: Modules linked in: lunatik_run(OE) luasyscall(OE) luaprobe(OE) luadata(OE) luafib(OE) luathread(OE) luarcu(OE) luasocket(OE) luanotifier(OE) lualinux(OE) luadevice(OE) lunatik(OE) xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xfrm_user xfrm_algo xt_addrtype nft_compat nf_tables libcrc32c nfnetlink br_netfilter bridge stp llc overlay binfmt_misc intel_rapl_msr intel_rapl_common intel_pmc_core ghash_clmulni_intel sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_intel snd_intel8x0 vmwgfx crypto_simd snd_ac97_codec cryptd rapl drm_ttm_helper ac97_bus ttm snd_pcm snd_timer snd drm_kms_helper pcspkr soundcore vboxguest joydev button ac evdev serio_raw sg drm fuse dm_mod loop efi_pstore configfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic hid_generic usbhid hid sd_mod t10_pi sr_mod crc64_rocksoft crc64 crc_t10dif cdrom crct10dif_generic ohci_pci ata_generic ahci ata_piix libahci
Mar 09 11:45:17.907819 debian-dev kernel:  ohci_hcd ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common libata usbcore psmouse crc32_pclmul usb_common scsi_mod crc32c_intel scsi_common e1000 video i2c_piix4 battery wmi
Mar 09 11:45:17.907966 debian-dev kernel: CPU: 2 PID: 1316 Comm: node Tainted: G           OE      6.1.0-18-amd64 #1  Debian 6.1.76-1
Mar 09 11:45:17.908050 debian-dev kernel: Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
Mar 09 11:45:17.908134 debian-dev kernel: Call Trace:
Mar 09 11:45:17.908266 debian-dev kernel:  <TASK>
Mar 09 11:45:17.908363 debian-dev kernel:  dump_stack_lvl+0x44/0x5c
Mar 09 11:45:17.908391 debian-dev kernel:  __schedule_bug.cold+0x42/0x4e
Mar 09 11:45:17.908415 debian-dev kernel:  __schedule+0x7ff/0x9e0
Mar 09 11:45:17.908438 debian-dev kernel:  ? __x64_sys_epoll_wait+0x5/0x110
Mar 09 11:45:17.908463 debian-dev kernel:  schedule+0x5a/0xd0
Mar 09 11:45:17.908487 debian-dev kernel:  schedule_preempt_disabled+0x11/0x20
Mar 09 11:45:17.908513 debian-dev kernel:  __mutex_lock.constprop.0+0x6cd/0x700
Mar 09 11:45:17.908541 debian-dev kernel:  ? futex_wake+0x151/0x180
Mar 09 11:45:17.908564 debian-dev kernel:  ? __x64_sys_epoll_wait+0x5/0x110
Mar 09 11:45:17.908585 debian-dev kernel:  ? __x64_sys_epoll_wait+0x1/0x110
Mar 09 11:45:17.908608 debian-dev kernel:  luaprobe_pre_handler+0x27/0x8a0 [luaprobe]
Mar 09 11:45:17.908638 debian-dev kernel:  ? __x64_sys_epoll_wait+0x1/0x110
Mar 09 11:45:17.908664 debian-dev kernel:  kprobe_ftrace_handler+0x10b/0x1b0
Mar 09 11:45:17.908687 debian-dev kernel:  0xffffffffc05d90c8
Mar 09 11:45:17.908710 debian-dev kernel:  ? __ia32_sys_epoll_ctl+0xa0/0xa0
Mar 09 11:45:17.908732 debian-dev kernel:  ? __x64_sys_epoll_wait+0x1/0x110
Mar 09 11:45:17.908754 debian-dev kernel:  __x64_sys_epoll_wait+0x5/0x110
Mar 09 11:45:17.908779 debian-dev kernel:  do_syscall_64+0x5b/0xc0
Mar 09 11:45:17.908805 debian-dev kernel:  ? exit_to_user_mode_prepare+0x40/0x1e0
Mar 09 11:45:17.908845 debian-dev kernel:  entry_SYSCALL_64_after_hwframe+0x64/0xce
Mar 09 11:45:17.908871 debian-dev kernel: RIP: 0033:0x7ffa5b228e26
Mar 09 11:45:17.908893 debian-dev kernel: Code: 10 89 7c 24 0c 89 4c 24 1c e8 96 c9 f7 ff 44 8b 54 24 1c 8b 54 24 18 41 89 c0 48 8b 74 24 10 8b 7c 24 0c b8 e8 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 32 44 89 c7 89 44 24 0c e8 e6 c9 f7 ff 8b 44
Mar 09 11:45:17.908916 debian-dev kernel: RSP: 002b:00007fffee029080 EFLAGS: 00000293 ORIG_RAX: 00000000000000e8
Mar 09 11:45:17.909021 debian-dev kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffa5b228e26
Mar 09 11:45:17.909049 debian-dev kernel: RDX: 0000000000000400 RSI: 00007fffee029180 RDI: 000000000000000e
Mar 09 11:45:17.909072 debian-dev kernel: RBP: 00007fffee02c1b0 R08: 0000000000000000 R09: 0000000100000001
Mar 09 11:45:17.909094 debian-dev kernel: R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
Mar 09 11:45:17.909117 debian-dev kernel: R13: 000000000539b600 R14: 000000000539b660 R15: 0000000000000000
Mar 09 11:45:17.909142 debian-dev kernel:  </TASK>
Mar 09 11:45:17.909165 debian-dev kernel: BUG: scheduling while atomic: node/1316/0x00000000
Mar 09 11:45:17.909189 debian-dev kernel: Modules linked in: lunatik_run(OE) luasyscall(OE) luaprobe(OE) luadata(OE) luafib(OE) luathread(OE) luarcu(OE) luasocket(OE) luanotifier(OE) lualinux(OE) luadevice(OE) lunatik(OE) xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xfrm_user xfrm_algo xt_addrtype nft_compat nf_tables libcrc32c nfnetlink br_netfilter bridge stp llc overlay binfmt_misc intel_rapl_msr intel_rapl_common intel_pmc_core ghash_clmulni_intel sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_intel snd_intel8x0 vmwgfx crypto_simd snd_ac97_codec cryptd rapl drm_ttm_helper ac97_bus ttm snd_pcm snd_timer snd drm_kms_helper pcspkr soundcore vboxguest joydev button ac evdev serio_raw sg drm fuse dm_mod loop efi_pstore configfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic hid_generic usbhid hid sd_mod t10_pi sr_mod crc64_rocksoft crc64 crc_t10dif cdrom crct10dif_generic ohci_pci ata_generic ahci ata_piix libahci
Mar 09 11:45:17.909908 debian-dev kernel:  ohci_hcd ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common libata usbcore psmouse crc32_pclmul usb_common scsi_mod crc32c_intel scsi_common e1000 video i2c_piix4 battery wmi
Mar 09 11:45:17.909957 debian-dev kernel: CPU: 2 PID: 1316 Comm: node Tainted: G        W  OE      6.1.0-18-amd64 #1  Debian 6.1.76-1
Mar 09 11:45:17.909982 debian-dev kernel: Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
Mar 09 11:45:17.910002 debian-dev kernel: Call Trace:
Mar 09 11:45:17.910027 debian-dev kernel:  <TASK>
Mar 09 11:45:17.910049 debian-dev kernel:  dump_stack_lvl+0x44/0x5c
Mar 09 11:45:17.910076 debian-dev kernel:  __schedule_bug.cold+0x42/0x4e
Mar 09 11:45:17.910096 debian-dev kernel:  __schedule+0x7ff/0x9e0
Mar 09 11:45:17.910115 debian-dev kernel:  schedule+0x5a/0xd0
Mar 09 11:45:17.910135 debian-dev kernel:  schedule_hrtimeout_range_clock+0xd7/0x120
Mar 09 11:45:17.910154 debian-dev kernel:  ? __hrtimer_init+0xe0/0xe0
Mar 09 11:45:17.910176 debian-dev kernel:  do_epoll_wait+0x698/0x7d0
Mar 09 11:45:17.910199 debian-dev kernel:  ? 0xffffffffc05d90c8
Mar 09 11:45:17.910225 debian-dev kernel:  ? ep_eventpoll_poll+0x10/0x10
Mar 09 11:45:17.910247 debian-dev kernel:  __x64_sys_epoll_wait+0x6f/0x110
Mar 09 11:45:17.910268 debian-dev kernel:  do_syscall_64+0x5b/0xc0
Mar 09 11:45:17.910305 debian-dev kernel:  ? __x64_sys_epoll_wait+0x6f/0x110
Mar 09 11:45:17.910325 debian-dev kernel:  ? exit_to_user_mode_prepare+0x40/0x1e0
Mar 09 11:45:17.910345 debian-dev kernel:  ? syscall_exit_to_user_mode+0x27/0x40
Mar 09 11:45:17.910366 debian-dev kernel:  ? do_syscall_64+0x67/0xc0
Mar 09 11:45:17.910388 debian-dev kernel:  ? exit_to_user_mode_prepare+0x40/0x1e0
Mar 09 11:45:17.910408 debian-dev kernel:  entry_SYSCALL_64_after_hwframe+0x64/0xce
Mar 09 11:45:17.910427 debian-dev kernel: RIP: 0033:0x7ffa5b228e26
Mar 09 11:45:17.910446 debian-dev kernel: Code: 10 89 7c 24 0c 89 4c 24 1c e8 96 c9 f7 ff 44 8b 54 24 1c 8b 54 24 18 41 89 c0 48 8b 74 24 10 8b 7c 24 0c b8 e8 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 32 44 89 c7 89 44 24 0c e8 e6 c9 f7 ff 8b 44
Mar 09 11:45:17.910466 debian-dev kernel: RSP: 002b:00007fffee029080 EFLAGS: 00000293 ORIG_RAX: 00000000000000e8
Mar 09 11:45:17.910485 debian-dev kernel: RAX: ffffffffffffffda RBX: 0000000000000201 RCX: 00007ffa5b228e26
Mar 09 11:45:17.910507 debian-dev kernel: RDX: 0000000000000400 RSI: 00007fffee029180 RDI: 000000000000000e
Mar 09 11:45:17.910527 debian-dev kernel: RBP: 00007fffee02c1b0 R08: 0000000000000000 R09: 0000000000000000
Mar 09 11:45:17.910549 debian-dev kernel: R10: 0000000000000201 R11: 0000000000000293 R12: 0000000000000000
Mar 09 11:45:17.910572 debian-dev kernel: R13: 00007ffa5b61c600 R14: 000000000539b660 R15: 0000000000000000
Mar 09 11:45:17.910596 debian-dev kernel:  </TASK>

Kernel panic on msghandler using lua_pcall

When some error occurs inside the message handler used by the lua_pcall function I get a kernel panic with the following stack trace:

[  609.204493] general protection fault: 0000 [#1] SMP PTI
[  609.204777] CPU: 0 PID: 6213 Comm: lua Tainted: P           OE     5.4.0-52-generic #57-Ubuntu
[  609.205149] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[  609.205510] RIP: 0010:__kmalloc_track_caller+0x9a/0x270
[  609.205872] Code: 82 01 00 00 4d 8b 01 65 49 8b 50 08 65 4c 03 05 74 54 96 4d 4d 8b 20 4d 85 e4 0f 84 97 01 00 00 41 8b 41 20 49 8b 39 4c 01 e0 <48> 8b 18 48 89 c1 49 33 99 70 01 00 00 4c 89 e0 48 0f c9 48 31 cb
[  609.206773] RSP: 0018:ffff9eb301b87350 EFLAGS: 00010206
[  609.207126] RAX: 72b61e5ef6fd49c6 RBX: 0000000000000000 RCX: 000000000000004b
[  609.207516] RDX: 000000000000ecdf RSI: 0000000000000a20 RDI: 000000000002f0c0
[  609.207937] RBP: ffff9eb301b87388 R08: ffff89767ea2f0c0 R09: ffff89767e401540
[  609.208326] R10: 0000000000000032 R11: 0000000000000001 R12: 72b61e5ef6fd49c6
[  609.208672] R13: 0000000000000a20 R14: 000000000000004b R15: ffff89767e401540
[  609.209018] FS:  00007fb79b9ef2c0(0000) GS:ffff89767ea00000(0000) knlGS:0000000000000000
[  609.209396] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  609.209759] CR2: 000055fd1b82f5d8 CR3: 000000002b94a002 CR4: 00000000000606f0
[  609.210124] Call Trace:
[  609.210518]  ? lua_alloc+0x4e/0xa0 [lunatik]
[  609.210875]  krealloc+0x88/0xc0
[  609.211329]  lua_alloc+0x4e/0xa0 [lunatik]
[  609.211758]  luaM_realloc_+0x41/0xb0 [lunatik]
[  609.212134]  luaC_newobj+0x21/0x50 [lunatik]
[  609.212487]  luaS_createlngstrobj+0x25/0x40 [lunatik]
[  609.212911]  luaV_concat+0x293/0x2f0 [lunatik]
[  609.213325]  ? luaS_newlstr+0x6b/0x80 [lunatik]
[  609.213703]  luaO_pushvfstring+0x29b/0x3a0 [lunatik]
[  609.214118]  ? lastlevel+0x84/0xc0 [lunatik]
[  609.214488]  ? luaD_call+0x38/0x90 [lunatik]
[  609.214929]  lua_pushfstring+0x5b/0xa0 [lunatik]
[  609.215336]  luaL_traceback+0x7c/0x280 [lunatik]
[  609.215694]  ? lua_alloc+0x97/0xa0 [lunatik]
[  609.216058]  ? luaD_pcall+0x46/0xb0 [lunatik]
[  609.216593]  ? luaopen_package+0x1e0/0x1e0 [lunatik]
[  609.216951]  msghandler+0x32/0xa0 [lunatik]
[  609.217351]  luaD_precall+0x2af/0x3f0 [lunatik]
[  609.217729]  luaD_call+0x38/0x90 [lunatik]
[  609.218096]  luaD_callnoyield+0x1a/0x30 [lunatik]
[  609.218482]  luaG_errormsg+0x75/0x80 [lunatik]
[  609.218899]  lua_error+0xe/0x20 [lunatik]
[  609.219326]  luaL_error+0x82/0xb0 [lunatik]
[  609.219665]  ? auxgetstr+0x59/0xb0 [lunatik]
[  609.219983]  handle_data+0x74/0xe0 [lunatik]
[  609.220320]  ? lunatikN_list+0x400/0x400 [lunatik]
[  609.220636]  luaD_precall+0x2af/0x3f0 [lunatik]
[  609.221029]  luaD_call+0x38/0x90 [lunatik]
[  609.221349]  luaD_callnoyield+0x1a/0x30 [lunatik]
[  609.221649]  f_call+0x14/0x20 [lunatik]
[  609.221996]  luaD_rawrunprotected+0x86/0xc0 [lunatik]
[  609.222292]  ? auxsetstr+0xe0/0xe0 [lunatik]
[  609.222667]  ? luaD_rawrunprotected+0x68/0xc0 [lunatik]
[  609.223056]  ? sk_filter_trim_cap+0x48/0x220
[  609.223405]  luaD_pcall+0x46/0xb0 [lunatik]
[  609.223694]  lua_pcallk+0x7e/0x140 [lunatik]
[  609.223976]  luaU_pcall+0x5d/0x8c [lunatik]
[  609.224252]  lunatikN_data+0xf6/0x1b0 [lunatik]
[  609.224526]  genl_family_rcv_msg+0x1b9/0x470
[  609.224798]  ? __netlink_sendskb+0x42/0x50
[  609.225071]  genl_rcv_msg+0x4c/0xa0
[  609.225357]  ? _cond_resched+0x19/0x30
[  609.225680]  ? genl_family_rcv_msg+0x470/0x470
[  609.225949]  netlink_rcv_skb+0x50/0x120
[  609.226215]  genl_rcv+0x29/0x40
[  609.226495]  netlink_unicast+0x187/0x220
[  609.226765]  netlink_sendmsg+0x222/0x3e0
[  609.227049]  sock_sendmsg+0x65/0x70
[  609.227322]  ____sys_sendmsg+0x212/0x280
[  609.227611]  ___sys_sendmsg+0x88/0xd0
[  609.227892]  ? ___sys_recvmsg+0x88/0xc0
[  609.228168]  __sys_sendmsg+0x5c/0xa0
[  609.228434]  __x64_sys_sendmsg+0x1f/0x30
[  609.228702]  do_syscall_64+0x57/0x190
[  609.228956]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  609.229216] RIP: 0033:0x7fb79bb43747
[  609.229478] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
[  609.230277] RSP: 002b:00007ffe81399e88 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[  609.230604] RAX: ffffffffffffffda RBX: 000055fd1b826740 RCX: 00007fb79bb43747
[  609.230957] RDX: 0000000000000000 RSI: 00007ffe81399ec0 RDI: 0000000000000007
[  609.231294] RBP: 000055fd1b82a1b0 R08: 0000000000000014 R09: 000055fd1b828df0
[  609.231621] R10: 000055fd1b817010 R11: 0000000000000246 R12: 000055fd1b828c30
[  609.231953] R13: 00007ffe81399ec0 R14: 00007fb79b9e9380 R15: 000055fd1b8172a8
[  609.232274] Modules linked in: lunatik(OE) sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua intel_rapl_msr intel_rapl_common intel_powerclamp rapl snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm input_leds snd_timer serio_raw joydev snd soundcore vboxguest(O) mac_hid netconsole ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear hid_generic usbhid hid crct10dif_pclmul crc32_pclmul ghash_clmulni_intel vmwgfx ttm aesni_intel crypto_simd drm_kms_helper cryptd syscopyarea glue_helper sysfillrect sysimgblt fb_sys_fops psmouse ahci libahci i2c_piix4 e1000 drm pata_acpi video [last unloaded: lunatik]
[  609.235286] ---[ end trace 5a01b1a281529884 ]---
[  609.235720] RIP: 0010:__kmalloc_track_caller+0x9a/0x270
[  609.236133] Code: 82 01 00 00 4d 8b 01 65 49 8b 50 08 65 4c 03 05 74 54 96 4d 4d 8b 20 4d 85 e4 0f 84 97 01 00 00 41 8b 41 20 49 8b 39 4c 01 e0 <48> 8b 18 48 89 c1 49 33 99 70 01 00 00 4c 89 e0 48 0f c9 48 31 cb
[  609.237380] RSP: 0018:ffff9eb301b87350 EFLAGS: 00010206
[  609.237824] RAX: 72b61e5ef6fd49c6 RBX: 0000000000000000 RCX: 000000000000004b
[  609.238261] RDX: 000000000000ecdf RSI: 0000000000000a20 RDI: 000000000002f0c0
[  609.238696] RBP: ffff9eb301b87388 R08: ffff89767ea2f0c0 R09: ffff89767e401540
[  609.239127] R10: 0000000000000032 R11: 0000000000000001 R12: 72b61e5ef6fd49c6
[  609.239589] R13: 0000000000000a20 R14: 000000000000004b R15: ffff89767e401540
[  609.240040] FS:  00007fb79b9ef2c0(0000) GS:ffff89767ea00000(0000) knlGS:0000000000000000
[  609.240507] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  609.240964] CR2: 000055fd1b82f5d8 CR3: 000000002b94a002 CR4: 00000000000606f0
[  609.241472] Kernel panic - not syncing: Fatal exception in interrupt
[  609.241997] Kernel Offset: 0x31400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[  609.243100] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

investigate UBSAN: array-index-out-of-bounds

[ 6852.106541] UBSAN: array-index-out-of-bounds in /home/ubuntu/lunatik/lua/lstring.c:152:13
[ 6852.106959] index 17 is out of range for type 'char [1]'
[ 6852.107059] CPU: 5 PID: 3151 Comm: modprobe Tainted: P           OE      6.5.0-25-generic #25~22.04.1-Ubuntu
[ 6852.107060] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[ 6852.107061] Call trace:
[ 6852.107067]  dump_backtrace+0xa4/0x150
[ 6852.107071]  show_stack+0x24/0x50
[ 6852.107084]  dump_stack_lvl+0x78/0xf8
[ 6852.107103]  dump_stack+0x1c/0x38
[ 6852.107104]  __ubsan_handle_out_of_bounds+0xe0/0x138
[ 6852.107117]  internshrstr+0x1dc/0x1f8 [lunatik]
[ 6852.107130]  luaS_init+0x6c/0x118 [lunatik]
[ 6852.107138]  f_luaopen+0x8c/0xe0 [lunatik]
[ 6852.107146]  luaD_rawrunprotected+0x6c/0xb8 [lunatik]
[ 6852.107154]  lua_newstate+0x150/0x1b8 [lunatik]
[ 6852.107161]  luaL_newstate+0x2c/0x88 [lunatik]
[ 6852.107170]  lunatik_newruntime+0x38/0x308 [lunatik]
[ 6852.107178]  lunatik_runtime+0x2c/0x60 [lunatik]
[ 6852.107186]  lunatik_run_init+0x30/0xff8 [lunatik_run]
[ 6852.107189]  do_one_initcall+0x64/0x3b8
[ 6852.107190]  do_init_module+0x64/0x258
[ 6852.107196]  load_module+0x7b0/0x8e0
[ 6852.107197]  init_module_from_file+0x94/0x110
[ 6852.107199]  idempotent_init_module+0x194/0x2b0
[ 6852.107200]  __arm64_sys_finit_module+0x74/0x100
[ 6852.107202]  invoke_syscall+0x7c/0x130
[ 6852.107203]  el0_svc_common.constprop.0+0x5c/0x170
[ 6852.107203]  do_el0_svc+0x38/0x68
[ 6852.107204]  el0_svc+0x30/0xe0
[ 6852.107206]  el0t_64_sync_handler+0x128/0x158
[ 6852.107208]  el0t_64_sync+0x1b0/0x1b8
[ 6852.107209] ================================================================================
[ 6852.107384] ================================================================================
[ 6852.107540] UBSAN: array-index-out-of-bounds in /home/ubuntu/lunatik/lua/lstring.c:152:13
[ 6852.107691] index 50 is out of range for type 'char [1]'
[ 6852.107790] CPU: 5 PID: 3151 Comm: modprobe Tainted: P           OE      6.5.0-25-generic #25~22.04.1-Ubuntu
[ 6852.107791] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[ 6852.107791] Call trace:
[ 6852.107791]  dump_backtrace+0xa4/0x150
[ 6852.107792]  show_stack+0x24/0x50
[ 6852.107801]  dump_stack_lvl+0x78/0xf8
[ 6852.107802]  dump_stack+0x1c/0x38
[ 6852.107804]  __ubsan_handle_out_of_bounds+0xe0/0x138
[ 6852.107805]  luaS_newlstr+0x110/0x120 [lunatik]
[ 6852.107813]  luaS_new+0xb8/0x120 [lunatik]
[ 6852.107821]  lua_pushstring+0x28/0xa0 [lunatik]
[ 6852.107829]  luaopen_package+0x170/0x2a8 [lunatik]
[ 6852.107837]  luaD_precall+0xc0/0x2b8 [lunatik]
[ 6852.107845]  luaD_callnoyield+0x58/0xf8 [lunatik]
[ 6852.107852]  lua_callk+0x50/0x100 [lunatik]
[ 6852.107860]  luaL_requiref+0xf8/0x188 [lunatik]
[ 6852.107868]  luaL_openlibs+0x48/0xb0 [lunatik]
[ 6852.107876]  lunatik_newruntime+0xc8/0x308 [lunatik]
[ 6852.107884]  lunatik_runtime+0x2c/0x60 [lunatik]
[ 6852.107891]  lunatik_run_init+0x30/0xff8 [lunatik_run]
[ 6852.107894]  do_one_initcall+0x64/0x3b8
[ 6852.107895]  do_init_module+0x64/0x258
[ 6852.107896]  load_module+0x7b0/0x8e0
[ 6852.107898]  init_module_from_file+0x94/0x110
[ 6852.107899]  idempotent_init_module+0x194/0x2b0
[ 6852.107900]  __arm64_sys_finit_module+0x74/0x100
[ 6852.107902]  invoke_syscall+0x7c/0x130
[ 6852.107902]  el0_svc_common.constprop.0+0x5c/0x170
[ 6852.107903]  do_el0_svc+0x38/0x68
[ 6852.107904]  el0_svc+0x30/0xe0
[ 6852.107906]  el0t_64_sync_handler+0x128/0x158
[ 6852.107908]  el0t_64_sync+0x1b0/0x1b8
[ 6852.107908] ================================================================================
================================================================================
[ 6852.108377] UBSAN: array-index-out-of-bounds in /home/ubuntu/lunatik/lua/lfunc.c:40:30
[ 6852.108524] index 1 is out of range for type 'UpVal *[1]'
[ 6852.108624] CPU: 5 PID: 3151 Comm: modprobe Tainted: P           OE      6.5.0-25-generic #25~22.04.1-Ubuntu
[ 6852.108625] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[ 6852.108625] Call trace:
[ 6852.108625]  dump_backtrace+0xa4/0x150
[ 6852.108627]  show_stack+0x24/0x50
[ 6852.108628]  dump_stack_lvl+0x78/0xf8
[ 6852.108629]  dump_stack+0x1c/0x38
[ 6852.108630]  __ubsan_handle_out_of_bounds+0xe0/0x138
[ 6852.108632]  luaF_newLclosure+0xa8/0xb8 [lunatik]
[ 6852.108641]  luaV_execute+0xed8/0x3bb8 [lunatik]
[ 6852.108648]  luaD_callnoyield+0x70/0xf8 [lunatik]
[ 6852.108656]  f_call+0x28/0x58 [lunatik]
[ 6852.108664]  luaD_rawrunprotected+0x6c/0xb8 [lunatik]
[ 6852.108672]  luaD_pcall+0x44/0xf8 [lunatik]
[ 6852.108679]  lua_pcallk+0xa0/0x198 [lunatik]
[ 6852.108687]  lunatik_newruntime+0x118/0x308 [lunatik]
[ 6852.108695]  lunatik_runtime+0x2c/0x60 [lunatik]
[ 6852.108703]  lunatik_run_init+0x30/0xff8 [lunatik_run]
[ 6852.108705]  do_one_initcall+0x64/0x3b8
[ 6852.108706]  do_init_module+0x64/0x258
[ 6852.108707]  load_module+0x7b0/0x8e0
[ 6852.108709]  init_module_from_file+0x94/0x110
[ 6852.108710]  idempotent_init_module+0x194/0x2b0
[ 6852.108711]  __arm64_sys_finit_module+0x74/0x100
[ 6852.108713]  invoke_syscall+0x7c/0x130
[ 6852.108713]  el0_svc_common.constprop.0+0x5c/0x170
[ 6852.108714]  do_el0_svc+0x38/0x68
[ 6852.108715]  el0_svc+0x30/0xe0
[ 6852.108717]  el0t_64_sync_handler+0x128/0x158
[ 6852.108719]  el0t_64_sync+0x1b0/0x1b8
[ 6852.108719] ================================================================================
[ 6852.108875] ================================================================================
[ 6852.109030] UBSAN: array-index-out-of-bounds in /home/ubuntu/lunatik/lua/lvm.c:842:18
[ 6852.109175] index 1 is out of range for type 'UpVal *[1]'
[ 6852.109275] CPU: 5 PID: 3151 Comm: modprobe Tainted: P           OE      6.5.0-25-generic #25~22.04.1-Ubuntu
[ 6852.109275] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[ 6852.109276] Call trace:
[ 6852.109276]  dump_backtrace+0xa4/0x150
[ 6852.109277]  show_stack+0x24/0x50
[ 6852.109278]  dump_stack_lvl+0x78/0xf8
[ 6852.109279]  dump_stack+0x1c/0x38
[ 6852.109281]  __ubsan_handle_out_of_bounds+0xe0/0x138
[ 6852.109282]  luaV_execute+0x3b08/0x3bb8 [lunatik]
[ 6852.109290]  luaD_callnoyield+0x70/0xf8 [lunatik]
[ 6852.109298]  f_call+0x28/0x58 [lunatik]
[ 6852.109305]  luaD_rawrunprotected+0x6c/0xb8 [lunatik]
[ 6852.109313]  luaD_pcall+0x44/0xf8 [lunatik]
[ 6852.109321]  lua_pcallk+0xa0/0x198 [lunatik]
[ 6852.109329]  lunatik_newruntime+0x118/0x308 [lunatik]
[ 6852.109336]  lunatik_runtime+0x2c/0x60 [lunatik]
[ 6852.109344]  lunatik_run_init+0x30/0xff8 [lunatik_run]
[ 6852.109347]  do_one_initcall+0x64/0x3b8
[ 6852.109348]  do_init_module+0x64/0x258
[ 6852.109349]  load_module+0x7b0/0x8e0
[ 6852.109350]  init_module_from_file+0x94/0x110
[ 6852.109351]  idempotent_init_module+0x194/0x2b0
[ 6852.109353]  __arm64_sys_finit_module+0x74/0x100
[ 6852.109354]  invoke_syscall+0x7c/0x130
[ 6852.109355]  el0_svc_common.constprop.0+0x5c/0x170
[ 6852.109356]  do_el0_svc+0x38/0x68
[ 6852.109357]  el0_svc+0x30/0xe0
[ 6852.109358]  el0t_64_sync_handler+0x128/0x158
[ 6852.109360]  el0t_64_sync+0x1b0/0x1b8
[ 6852.109361] ================================================================================

ipairs is not showing error info

pairs

for _, _ in pairs(t) do end
ubuntu@ubuntu:~/lunatik$ sudo lunatik run examples/pairs
/lib/modules/lua/examples/pairs.lua:1: bad argument #1 to 'for iterator' (table expected, got nil)

ipairs

for _, _ in ipairs(t) do end
ubuntu@ubuntu:~/lunatik$ sudo lunatik run examples/ipairs
attempt to index a nil value

[GSoC 2024] update README.md with the base API for luanetfilter

Add the documentation for the base API for luanetfilter; that is, only for the functions that are strictly necessary for the base functionality of calling Lua from Netfilter rules. It shouldn't contain packet handling yet; just callbacks registering and actions (e.g., PASS, DROP). Thus, you can create issues, after discussing this specification, for implementing this foundation.

Failed to compile with kernel 5.6.19

Trying to compiling Lunatik with kernel 5.6.19 gives me the following message:

make: Entering directory '/usr/lib/modules/5.6.19-2-MANJARO/build'
  CC [M]  /home/matheus/gsoc/lunatik/lua/lapi.o
In file included from /home/matheus/gsoc/lunatik/lua/lua.h:18,
                 from /home/matheus/gsoc/lunatik/lua/lapi.c:18:
/home/matheus/gsoc/lunatik/lua/luaconf.h: In function ‘time’:
/home/matheus/gsoc/lunatik/lua/luaconf.h:846:19: error: storage size of ‘t’ isn’t known
  846 |   struct timespec t;
      |                   ^
/home/matheus/gsoc/lunatik/lua/luaconf.h:848:3: error: implicit declaration of function ‘getnstimeofday’ [-Werror=implicit-function-declaration]
  848 |   getnstimeofday(&t);
      |   ^~~~~~~~~~~~~~
/home/matheus/gsoc/lunatik/lua/luaconf.h:846:19: warning: unused variable ‘t’ [-Wunused-variable]
  846 |   struct timespec t;
      |                   ^
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:268: /home/matheus/gsoc/lunatik/lua/lapi.o] Error 1
make: *** [Makefile:1695: /home/matheus/gsoc/lunatik] Error 2
make: Leaving directory '/usr/lib/modules/5.6.19-2-MANJARO/build'

I think that this error is caused due a new way to handle with time implemented in kernel 5.6 ahead

failed to compile on debian bookworm kernel 6.1 on a RPi

When I do:

git clone https://github.com/luainkernel/lunatik.git
git submodule update --init --recursive
make

I get

make -C /lib/modules/6.1.0-rpi7-rpi-2712/build M=/home/endersonmaia/lunatik CONFIG_LUNATIK=m	\
CONFIG_LUNATIK_RUN=m CONFIG_LUNATIK_RUNTIME=y CONFIG_LUNATIK_DEVICE=m	\
CONFIG_LUNATIK_LINUX=m CONFIG_LUNATIK_NOTIFIER=m CONFIG_LUNATIK_SOCKET=m \
CONFIG_LUNATIK_RCU=m CONFIG_LUNATIK_THREAD=m CONFIG_LUNATIK_FIB=m \
CONFIG_LUNATIK_DATA=m CONFIG_LUNATIK_PROBE=m CONFIG_LUNATIK_SYSCALL=m
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-2712'
  CC [M]  /home/endersonmaia/lunatik/lua/lapi.o
during GIMPLE pass: *build_cgraph_edges
/home/endersonmaia/lunatik/lua/lapi.c: In function 'lua_checkstack':
/home/endersonmaia/lunatik/lua/lapi.c:111:13: internal compiler error: Illegal instruction
  111 | LUA_API int lua_checkstack (lua_State *L, int n) {
      |             ^~~~~~~~~~~~~~
0x7fff1085777f __libc_start_call_main
	../sysdeps/nptl/libc_start_call_main.h:58
0x7fff10857857 __libc_start_main_impl
	../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make[2]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/scripts/Makefile.build:255: /home/endersonmaia/lunatik/lua/lapi.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/Makefile:2039: /home/endersonmaia/lunatik] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-2712'
make: *** [Makefile:7: all] Error 2

My environment:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ uname -a
Linux turdusmerula 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0

Please add a top-level license file to this project

First, thank you for sharing this project with us!

I see that various files have their own license headers or designations
in the file, but there isn't a single overall license specified for the project.

E.g., some files have the MIT license header:

* Copyright (c) 2023 ring-0 Ltda.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

some say "Dual MIT/GPL":

MODULE_LICENSE("Dual MIT/GPL");

and the above designations are within the same file, so it's a bit confusing.

Could you please add an explicit LICENSE file to the repo so that it's clear
under what terms the project overall is provided, and under what terms user
contributions are licensed?

Thanks!

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.