Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with LuaJIT2 on AArch64 #270

Open
TsarFox opened this issue Jul 31, 2021 · 2 comments
Open

Fails with LuaJIT2 on AArch64 #270

TsarFox opened this issue Jul 31, 2021 · 2 comments

Comments

@TsarFox
Copy link

TsarFox commented Jul 31, 2021

Noticed while trying to build AwesomeWM: lgi does not seem to work with LuaJIT on AARCH64.

In particular, with LuaJIT 2.1.0-beta3 (the only version packaged in Gentoo), I get the following error running the gtkhello.lua example.

jakob@Lambda ~/lgi/samples $ luajit-2.1.0-beta3 gtkhello.lua
luajit-2.1.0-beta3: bad light userdata pointer
stack traceback:
	[C]: at 0xffff94d66ed4
	[C]: in function 'require'
	/usr/share/lua/5.1/lgi/core.lua:14: in main chunk
	[C]: in function 'require'
	/usr/share/lua/5.1/lgi/init.lua:19: in main chunk
	[C]: at 0xffff9502ff80
	[C]: in function 'require'
	gtkhello.lua:9: in main chunk
	[C]: at 0xaaaab5602620

This may be relevant: neovim/neovim#7879

@psychon
Copy link
Collaborator

psychon commented Aug 1, 2021

https://github.com/LuaJIT/LuaJIT/blob/4deb5a1588ed53c0c578a343519b5ede59f3d928/src/lj_errmsg.h#L58
https://github.com/LuaJIT/LuaJIT/blob/e957737650e060d5bf1c2909b741cc3dffe073ac/src/lj_udata.c#L51
https://github.com/LuaJIT/LuaJIT/blob/3fbf51bb99e3795497c010e286cb749094da6bc2/src/lj_obj.h#L837-L838
https://github.com/LuaJIT/LuaJIT/blob/3fbf51bb99e3795497c010e286cb749094da6bc2/src/lj_obj.h#L292-L294

Looks like LJ_64 means that LuaJIT only supports lightuserdata with 39 bits and you are getting a pointer with more bits set.

Or alternatively, there is a limit on the number of light user data objects and the code exceeds this limit?

But I am not really sure since there is too much magic going on.

Personally, I don't have an AArch64 machine to debug on / to figure out where this pointer comes from and what it does. So 🤷 . Sorry.

@TsarFox
Copy link
Author

TsarFox commented Aug 1, 2021

No worries. I'll set aside some time this week to do some debugging, see if I can make any progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants