From: Henrik Grimler <henrik@grimler.se>
To: 47596@debbugs.gnu.org
Subject: bug#47596: File descriptor error when exiting emacs on android 11
Date: Sun, 04 Apr 2021 21:20:35 +0200 [thread overview]
Message-ID: <b87a71b429bedaa8117320121936703633afd0e0.camel@grimler.se> (raw)
Hi,
Android 10 introduced a new "file descriptor sanitizer" (fdsan, see [1]
for docs) which detects issues when opening and closing files across
multiple threads. On android 10 warnings were given, while on android
11 programs are killed instantly if issues are detected.
Starting and then exiting emacs, or simply just running for example
`emacs --version`, gives an error. `gdb --args emacs --version` gives
this backtrace:
```
Starting program: /data/data/com.termux/files/usr/bin/emacs --version
GNU Emacs 27.2
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
fdsan: attempted to close file descriptor 2, expected to be unowned,
actually owned by FILE* 0xb6c8800c
Program received signal SIGABRT, Aborted.
0xb63789e8 in fdsan_error(char const*, ...) ()
from /apex/com.android.runtime/lib/bionic/libc.so
(gdb) bt full
#0 0xb63789e8 in fdsan_error(char const*, ...) ()
from /apex/com.android.runtime/lib/bionic/libc.so
No symbol table info available.
#1 0xb63786fe in android_fdsan_close_with_tag ()
from /apex/com.android.runtime/lib/bionic/libc.so
No symbol table info available.
#2 0xb63b83c0 in __sclose () from
/apex/com.android.runtime/lib/bionic/libc.so
No symbol table info available.
#3 0xb63b8f24 in __FILE_close(__sFILE*) ()
from /apex/com.android.runtime/lib/bionic/libc.so
No symbol table info available.
#4 0x7f7e6a76 in close_stream (stream=0xb63cde44 <__sF+168>)
at /home/builder/.termux-build/emacs/src/lib/close-stream.c:61
some_pending = false
prev_fail = false
fclose_fail = 243
#5 0x7f68a872 in close_output_streams ()
at /home/builder/.termux-build/emacs/src/src/sysdep.c:2840
err = false
#6 0xb63c10d6 in __cxa_finalize ()
from /apex/com.android.runtime/lib/bionic/libc.so
No symbol table info available.
#7 0xb63bc7b8 in exit () from
/apex/com.android.runtime/lib/bionic/libc.so
No symbol table info available.
#8 0x7f655d92 in main (argc=2, argv=0xbefff504)
at /home/builder/.termux-build/emacs/src/src/emacs.c:1132
version = 0xb5e68133 "27.2"
copyright = 0xb5e68138 "Copyright (C) 2021 Free Software
Foundation, Inc."
stack_bottom_variable = 0x7f655a61 <main>
do_initial_setlocale = false
no_loadup = false
junk = 0x0
dname_arg = 0x0
ch_to_dir = 0x0
original_pwd = 0x0
dump_mode = 0x0
skip_args = 1
temacs = 0x0
attempt_load_pdump = true
sockfd = -1225460908
module_assertions = 244
```
The emacs here was a debug build from the 27.2 tag, configured with:
'configure --disable-dependency-tracking
--prefix=/data/data/com.termux/files/usr
--libdir=/data/data/com.termux/files/usr/lib
--sbindir=/data/data/com.termux/files/usr/bin --disable-rpath
--disable-rpath-hack --host=arm-linux-androideabi --disable-autodepend
--with-gif=no --with-gnutls --with-jpeg=no --without-gconf
--without-gsettings --without-lcms2 --without-x --with-png=no
--with-tiff=no --with-xml2 --with-xpm=no --without-dbus
--without-selinux --with-modules --with-pdumper=yes --with-
dumping=none
--enable-checking=yes,glyphs --enable-check-lisp-object-type
emacs_cv_sanitize_address=yes emacs_cv_prog_cc_no_pie=no
ac_cv_lib_elf_elf_begin=no gl_cv_func_dup2_works=no
ac_cv_func_setrlimit=no emacs_cv_func__setjmp=no
emacs_cv_func_sigsetjmp=no --disable-nls --enable-shared
--enable-static --libexecdir=/data/data/com.termux/files/usr/libexec
'CFLAGS= -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb
-fstack-protector-strong -g3 -O0 -Wall -gdwarf-4' 'CPPFLAGS=
-D_FORTIFY_SOURCE=2 -D__USE_FORTIFY_LEVEL=2
-I/data/data/com.termux/files/usr/include'
'LDFLAGS=-L/data/data/com.termux/files/usr/lib
-Wl,-rpath=/data/data/com.termux/files/usr/lib -march=armv7-a -fopenmp
-static-openmp -Wl,--enable-new-dtags -Wl,--as-needed
-Wl,-z,relro,-z,now''
Debugging these issues are very tedious in my experience so far
(probably easier for actual android apps). I will try to boil down the
relevant emacs code into a smaller program that still reproduces the
error.
Based on the backtrace it seem to be how stderr is opened (and closed)
that is problematic somehow.
Please let me know if you have any insights, or if I can provide
additional useful information.
Best regards,
Henrik Grimler
[1]
https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md
next reply other threads:[~2021-04-04 19:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-04 19:20 Henrik Grimler [this message]
2021-04-04 19:31 ` bug#47596: File descriptor error when exiting emacs on android 11 Eli Zaretskii
2021-04-04 20:11 ` Henrik Grimler
2021-04-05 8:14 ` Henrik Grimler
2021-04-05 8:59 ` Henrik Grimler
2021-04-05 9:48 ` Henrik Grimler
2021-04-05 12:57 ` Eli Zaretskii
2021-04-05 13:38 ` Henrik Grimler
2021-04-05 12:52 ` Eli Zaretskii
2021-04-05 12:50 ` Eli Zaretskii
2021-04-05 17:29 ` Henrik Grimler
2021-05-06 10:45 ` Lars Ingebrigtsen
2021-05-10 7:23 ` Henrik Grimler
2021-05-11 17:06 ` Henrik Grimler
2021-05-12 13:52 ` Lars Ingebrigtsen
2021-05-12 14:01 ` Eli Zaretskii
2022-06-29 10:47 ` Lars Ingebrigtsen
2022-06-29 13:25 ` Henrik Grimler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-30 9:07 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b87a71b429bedaa8117320121936703633afd0e0.camel@grimler.se \
--to=henrik@grimler.se \
--cc=47596@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).