-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
W3M fdsan error #6410
Comments
Any chance of getting this fixed |
I think most of us do not have android 11 devices, making debugging these errors a hassle. |
With a debug build gdb gives a backtrace that shows where the error originates:
There is no easy fix however, we really need to dig into the code to solve it. The fdsan docs suggest to replace all I guess we need to implement something similar to Very annoying, google really screwed us over here by making this behavior standard and not providing better tools for debugging it. |
WARNING :-I am just a novice If you use lldb then I get something different. Maybe this could be of some help ❯ lldb ../usr/bin/w3m ~
libc.so`android_fdsan_get_owner_tag: |
@dipayand what device do you have, and are you using a custom ROM or original android? Could you try compiling and running this and see if it triggers the error? #include <stdio.h>
int main()
{
fdopen (2, "w");
fclose (stderr);
} Put it in for example test.c and then compile with |
@dipayand thanks, and what is your output of |
Application version: sources.list deb https://termux.mentality.rip/termux-packages-24/ stable maingame-repo (sources.list.d/game.list)deb https://grimler.se/game-packages-24 games stable science-repo (sources.list.d/science.list) deb https://grimler.se/science-packages-24 science stablesources.list.d/pointless.listdeb https://its-pointless.github.io/files/24 termux extras # x11-repo (sources.list.d/x11.list) unstable-repo (sources.list.d/unstable.list)deb https://ipfs.io/ipns/k51qzi5uqu5dj05z8mr958kwvrg7a0wqouj5nnoo5uqu1btnsljvpznfaav9nk unstable main |
@RalfWerner official stock android? Thanks for testing |
Adding this line to the beginning of
makes the issue disappear. |
The file descriptor sanitizer keeps track of opened file descriptors and kills programs that closes fds multiple times, or fails to close fds. In w3m's case a fd for a tty was obtained and saved in the ttyf variable, but when the tty was later closed is was done using the tty variable and not the obtained ttyf. To my current understanding this can lead to undesired behaviour when using multiple threads, as another thread might write to or read from ttyf after it has been closed. Error looks like fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xb6c8800c This commit fixes [1]. See also fdsan docs [2] and issue opened in the android bug tracker [3]. [1] #6410 [2] https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md [3] https://issuetracker.google.com/issues/184380442
That looks like a good workaround for the programs we don't have a fix for! I think I have a fix for w3m, pushed in fee1315. Still don't know for emacs, texlive, zsh or inetutils though. I suggest we set |
Here is what we need: void *lib_handle = dlopen("libc.so", RTLD_LAZY);
if (lib_handle) {
void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
if (set_fdsan_error_level) {
set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
}
dlclose(lib_handle);
} because |
Great! |
I see that Perhaps this issue can be closed? |
The file descriptor sanitizer keeps track of opened file descriptors and kills programs that closes fds multiple times, or fails to close fds. In w3m's case a fd for a tty was obtained and saved in the ttyf variable, but when the tty was later closed is was done using the tty variable and not the obtained ttyf. To my current understanding this can lead to undesired behaviour when using multiple threads, as another thread might write to or read from ttyf after it has been closed. Error looks like fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xb6c8800c This commit fixes [1]. See also fdsan docs [2] and issue opened in the android bug tracker [3]. [1] termux#6410 [2] https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md [3] https://issuetracker.google.com/issues/184380442
** Problem Description **
On launch, w3m gives the following error
fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x73797c20e8
fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x73797c20e8
Aborted
Additional information
I have moved to the F-Droid version of Termux
The text was updated successfully, but these errors were encountered: