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

whois: fdsan: attempted to close file descriptor #5980

Closed
Dmole opened this issue Oct 30, 2020 · 3 comments
Closed

whois: fdsan: attempted to close file descriptor #5980

Dmole opened this issue Oct 30, 2020 · 3 comments
Labels
android-11 Issue happens on devices running Android 11 bug report Something is not working properly

Comments

@Dmole
Copy link
Contributor

Dmole commented Oct 30, 2020

Problem description
Steps to reproduce

whois 127.0.0.1 > /dev/null
fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x7130a40578
Aborted

Expected behavior

whois 127.0.0.1 > /dev/null

Additional information

termux-info
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ stable main
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
Updatable packages:
All packages up to date
Android version:
11
Kernel build information:
Linux localhost 4.4.223-ga176abe6ae2a-ab6713882 #1 SMP PREEMPT Tue Jul 28 04:51:17 UTC 2020 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 2
@ghost
Copy link

ghost commented Oct 30, 2020

Same as #5790, related to https://developer.android.com/about/versions/11/behavior-changes-all.

@ghost ghost changed the title whois whois: fdsan: attempted to close file descriptor Oct 30, 2020
@ghost ghost added android-11 Issue happens on devices running Android 11 bug report Something is not working properly labels Jan 16, 2021
@Grimler91
Copy link
Member

gdb --args whois 127.0.0.1 with debug build of inetutils give

[...]

fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xb6c7b00c

Program received signal SIGABRT, Aborted.
0xb6b959e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
(gdb) bt
#0  0xb6b959e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
#1  0xb6b956fe in android_fdsan_close_with_tag () from /apex/com.android.runtime/lib/bionic/libc.so
#2  0xb6b95d6e in close () from /apex/com.android.runtime/lib/bionic/libc.so
#3  0x7f55866a in closeconn (fd=3) at /home/builder/.termux-build/inetutils/src/whois/whois.c:601
#4  0x7f55816a in main (argc=-1, argv=0xbefff50c) at /home/builder/.termux-build/inetutils/src/whois/whois.c:294

whois.c is smaller than emacs and texlive so a bit easier to dig into.

How the file descriptor is handled looks reasonable in the main function. Maybe the sanitizer does not like that the fd is obtained/replaced multiple times in a for loop in openconn.

ghost pushed a commit that referenced this issue Apr 10, 2021
@ghost
Copy link

ghost commented Apr 10, 2021

Fixed in 1.9.4-11.

@ghost ghost closed this as completed Apr 10, 2021
amuramatsu pushed a commit to amuramatsu/termux-packages that referenced this issue Jun 26, 2021
@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
android-11 Issue happens on devices running Android 11 bug report Something is not working properly
Projects
None yet
Development

No branches or pull requests

2 participants