Skip to content

[WRAPPER] fix libc argp_parse bridging; add selinux symbols#3462

Merged
ptitSeb merged 1 commit intoptitSeb:mainfrom
yzewei:miss_libc/libse
Feb 5, 2026
Merged

[WRAPPER] fix libc argp_parse bridging; add selinux symbols#3462
ptitSeb merged 1 commit intoptitSeb:mainfrom
yzewei:miss_libc/libse

Conversation

@yzewei
Copy link
Contributor

@yzewei yzewei commented Feb 4, 2026

Added a callback bridge for libc's argp_parse (including children copying) to prevent program crashes caused by argp potentially being in .ro format;
also, filled in missing symbols and callback handling for libselinux to resolve runtime errors.

@ptitSeb
Copy link
Owner

ptitSeb commented Feb 4, 2026

this is getting really complex! Are you sure your are not overthinking it?

@yzewei
Copy link
Contributor Author

yzewei commented Feb 4, 2026

this is getting really complex! Are you sure your are not overthinking it?

I encountered this while trying to run dynamic ldconfig(fedora docker images). I did think it wasn't necessary before.
As for why it's needed, you can look it up. #3457

@yzewei
Copy link
Contributor Author

yzewei commented Feb 4, 2026

Before Error log:

[BOX64] 0039|SIGSEGV @0x100002d10 (argp_parse(/abi2-root/usr/lib64/libc.so.6)) (x64pc=0x300109d3/"box64/argp_parse(/abi2-root/usr/lib64/libc.so.6) + 0x13", rsp=0x7ffff1d7f408, stack=0x7ffff1580000:0x7ffff1d80000 own=(nil) fp=0x7ffff1d7f470), for accessing 0x100002d10 (code=2/prot=45), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0) handler=(nil)
RSP-0x20:0x0000000000000000 RSP-0x18:0x0000000000000000 RSP-0x10:0x0000000030000080 RSP-0x08:0x00007ffff1d7f470
RSP+0x00:0x00000001000025ce RSP+0x08:0x0000000000000000 RSP+0x10:0x0000000000000000 RSP+0x18:0x0000000000000000
RAX:0x0000000000000007 RCX:0x0000000000000000 RDX:0x00007ffffb834320 RBX:0x0000000000000002 
RSP:0x00007ffff1d7f408 RBP:0x00007ffff1d7f470 RSI:0x0000000000000000 RDI:0x0000000101000003 
 R8:0x00007ffff1d7f42c  R9:0x0000000000000000 R10:0x0000000000000000 R11:0x0000000000000000 
R12:0x00007ffff1d7f4a8 R13:0x0000000000000000 R14:0x0000000000000000 R15:0x0000000000000000 ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0000 GS:0x0000 FSBASE=0x4efb4650 GSBASE=(nil)

Segmentation fault         (core dumped) BOX64_LOG=1 ldconfig --help

@ptitSeb
Copy link
Owner

ptitSeb commented Feb 4, 2026

I'm not saying there is no need for a fix. I'm just wondering if there could be a simpler one.

@yzewei
Copy link
Contributor Author

yzewei commented Feb 5, 2026

I'm not saying there is no need for a fix. I'm just wondering if there could be a simpler one.

Alternatively, I could only handle the root argp and ignore the children for now, to see if that would resolve the current ldconfig issue.

@yzewei
Copy link
Contributor Author

yzewei commented Feb 5, 2026

I'm not saying there is no need for a fix. I'm just wondering if there could be a simpler one.

Alternatively, I could only handle the root argp and ignore the children for now, to see if that would resolve the current ldconfig issue.

Latest attempt: It seems the simple operation works fine. The problem lies with the parsing and scanning libraries, caused by other functions. After fixing these issues, I submitted the solution along with the shallow copy of my_argp_parse.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
@ptitSeb
Copy link
Owner

ptitSeb commented Feb 5, 2026

Thank you. That's indeed much simpler without the shallow copy of the argp structure!

@ptitSeb ptitSeb merged commit 8f9603b into ptitSeb:main Feb 5, 2026
27 checks passed
@yzewei
Copy link
Contributor Author

yzewei commented Feb 5, 2026

Thank you. That's indeed much simpler without the shallow copy of the argp structure!

I'm very happy to be able to help improve the project. This will allow the box64 to be used in more places.

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

Successfully merging this pull request may close these issues.

2 participants