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

fix errno bug #1400

Closed
wants to merge 1 commit into from
Closed

fix errno bug #1400

wants to merge 1 commit into from

Conversation

ucgJhe
Copy link
Collaborator

@ucgJhe ucgJhe commented Oct 20, 2023

this is actually related to #1341, after dig more deeper, I found that the musl loader will try to locate and map library according to the path described in the file /etc/ld-musl-$ARCH-.path, the behavior of the binary is not correct due to the __do_open always return -1 on syscall error, and it will fail the process mapping library during runtime.

  1. use proper errno instead of always return -1 in __do_open

Copy link
Member

@elicn elicn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper code should test for negative value / non-negative value rather than looking for a specific one. Anyway, the QlSyscallError reflects the error code on the hosting environment; it might work if you emulate a Linux binary on top of a Linux host, but not if you do it on top of Windows.

For that to make sense, QlSyscallError should reflect a proper Linux error code rather than host-os error code.

@ucgJhe
Copy link
Collaborator Author

ucgJhe commented Oct 27, 2023

close this for now until we come out with a better solution for all plateform

@ucgJhe ucgJhe closed this Oct 27, 2023
@elicn
Copy link
Member

elicn commented Nov 2, 2023

Not sure why you closed it.
It is still an issue we should take care of.

@ucgJhe
Copy link
Collaborator Author

ucgJhe commented Nov 3, 2023

Not sure why you closed it. It is still an issue we should take care of.

just file an issue (#1405) for tracking this.

@DockTree
Copy link

DockTree commented Nov 4, 2023

In my opinion, write the path of the unfound file in /etc/ld-musl-$ARCH-.path can solve the error, however, at the same time, the different base address of stack or other mapping areas would be a cause of other errors.

@ucgJhe
Copy link
Collaborator Author

ucgJhe commented Nov 6, 2023

In my opinion, write the path of the unfound file in /etc/ld-musl-$ARCH-.path can solve the error, however, at the same time, the different base address of stack or other mapping areas would be a cause of other errors.

To create the unfound file could serve as a workaround for the related issue, similar to what we typically do in contexts where a symlink is broken. However, this errno issue leading to incorrect behavior still needs to be fixed, so that the error-catching mechanism can work as expected.

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.

3 participants