File descriptor error for pdflatex.fmt creation on android 11

Henrik Grimler henrik at grimler.se
Fri Apr 2 15:45:55 CEST 2021


Dear all,

Android 11 introduced a new file descriptor sanitizer ("fdsan", see [1]
for docs) which detects possible issues when opening and closing files
across multiple threads.

Installing texlive on android 11 gives a fdsan error when creating
pdflatex.fmt. If I run:

  pdftex -ini -jobname=pdflatex -progname=pdflatex -translate-
file=cp227.tcx *pdflatex.ini

it aborts with an error

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

Does anyone have experience with this type of issue? For debugging it
the docs suggests replacing all `int fd` with a special `unique_fd fd`
type, but I am not yet sure how to use that for software like texlive
(rather than android apps), so any hints are greatly appreciated.

If I run the command above in gdb I get this backtrace (see [2] for
full log):

[...]
Hyphenation trie of length 6081 has 183 ops out of 35111
  2 for language 1
  181 for language 0
0 words of pdfTeX memory
fdsan: attempted to close file descriptor 3, expected to be unowned,
actually owned by FILE* 0xb6c6100c

Program received signal SIGABRT, Aborted.
0xb64ec9e8 in fdsan_error(char const*, ...) () from
/apex/com.android.runtime/lib/bionic/libc.so
(gdb) bt
#0  0xb64ec9e8 in fdsan_error(char const*, ...) () from
/apex/com.android.runtime/lib/bionic/libc.so
#1  0xb64ec6fe in android_fdsan_close_with_tag () from
/apex/com.android.runtime/lib/bionic/libc.so
#2  0xb64ecd6e in close () from
/apex/com.android.runtime/lib/bionic/libc.so
#3  0xb68b18f4 in gzclose_w () from
/data/data/com.termux/files/usr/lib/libz.so.1.2.11
#4  0x7f56abd8 in storefmtfile () at pdftexini.c:3584
#5  0x7f570806 in mainbody () at pdftexini.c:5651
#6  0x7f5609c0 in main (ac=<optimized out>, av=<optimized out>)
    at /home/builder/.termux-build/texlive-
bin/src/texk/web2c/lib/texmfmp.c:1098

The above output is for pdftex built from the svn54456 tag. 
Please let me know if I can provide any additional information!

Best regards
Henrik Grimler

[1]
https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md
[2] https://grimler.se/logs/pdftex.log



More information about the tex-live mailing list.