Diff for /wikisrc/users/leot/aarch64_problems.mdwn between versions 1.8 and 1.12

version 1.8, 2018/07/24 00:09:53 version 1.12, 2019/01/04 22:26:31
Line 4  Here a list of possible problems of NetB Line 4  Here a list of possible problems of NetB
 investigation in order to write proper PR or better yet to fix them!  investigation in order to write proper PR or better yet to fix them!
 ## `mpv` and NetBSD crashes  ## `mpv` SIGSEGVs (strnlen(s, (size_t)-1) always returns -1)
   **UPDATE**: This was fixed by `<ryo>`, thanks!
 Just by invoking `mpv` via:  Just by invoking `mpv` via:
     $ mpv      % mpv
   It SEGV as follows:
 It is possible to completely crash NetBSD on aarch64. Investigate why and if      % mpv
 possible get a complete backtrace.      /usr/pkg/lib/ffmpeg4/libavcodec.so.58: text relocations
       mpv 0.29.0 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
        built on Sat Jul 28 21:02:57 CEST 2018
       ffmpeg library versions:
          libavutil       56.14.100
          libavcodec      58.18.100
          libavformat     58.12.100
          libswscale      5.1.100
          libavfilter     7.16.100
          libswresample   3.1.100
       ffmpeg version: 4.0.2
       Usage:   mpv [options] [url|path/]filename
       Basic options:
        --start=<time>    seek to given (percent, seconds, or hh:mm:ss) position
        --no-audio        do not play sound
        --no-video        do not play video
        --fs              fullscreen playback
        --sub-file=<file> specify subtitle file to use
        --playlist=<file> specify playlist file
        --list-options    list all mpv options
        --h=<string>      print options which contain the given string in their name
       [1]   Segmentation fault (core dumped) /usr/pkg/bin/mpv...
       % gdb -core mpv.core /usr/pkg/bin/mpv
       Reading symbols from /usr/pkg/bin/mpv...done.
       [New process 5]
       [New process 6]
       [New process 4]
       [New process 3]
       [New process 2]
       [New process 1]
       Core was generated by `mpv'.
       Program terminated with signal SIGSEGV, Segmentation fault.
       #0  0x0000f96f727f40b0 in memcpy () from /usr/lib/libc.so.12
       [Current thread is 1 (process 5)]
       (gdb) bt
       #0  0x0000f96f727f40b0 in memcpy () from /usr/lib/libc.so.12
       #1  0x00000002001cba34 in __memcpy_ichk (len=18446744073709551615, src=0xf96f6e10fec0, dst=<optimized out>)
           at /usr/include/ssp/string.h:82
       #2  strndup_append_at (str=str@entry=0xf96f6f4ff348, at=0, append=0xf96f6e10fec0 "speed", append_len=<optimized out>,
           append_len@entry=18446744073709551615) at ../ta/ta_utils.c:113
       #3  0x00000002001cbea4 in ta_strdup_append_buffer (str=str@entry=0xf96f6f4ff348, a=<optimized out>) at ../ta/ta_utils.c:165
       #4  0x00000002001cb7b8 in ta_talloc_strdup_append_buffer (s=<optimized out>, s@entry=0x0, a=<optimized out>) at ../ta/ta_talloc.c:31
       #5  0x0000000200157eec in print_str_list (opt=<optimized out>, src=<optimized out>) at ../options/m_option.c:1477
   This happens because `strnlen(s, (size_t)-1)`, always returns -1, e.g.:
       % cat strnlen_size_max.c
       #include <stdio.h>
       #include <string.h>
       main(int argc, char *argv[])
           int i;
           for (i = 1; i < argc; i++) {
                   printf("strnlen(\"%s\", (size_t)-1) -> %ld\n",
                       argv[i], strnlen(argv[i], ~(size_t)0));
           return 0;
       % gcc -Wall strnlen_size_max.c
       % ./a.out foo
       strnlen("foo", (size_t)-1) -> -1
 (Is it PaX MPROTECT related?)  (This should returns 3, not -1!)
   The following patch workaround the mpv problem by avoiding all
   `strnlen(s, (size_t)-1)` calls (and just using strlen() instead):
       $NetBSD: aarch64_problems.mdwn,v 1.11 2018/07/31 22:22:28 leot Exp $
       Avoid to directly call:
        strnlen(s, (size_t)-1)
       because on aarch64 ATM it (incorrectly) always returns -1 (also
       when s is a string with less than SIZE_MAX characters).
       Add a kludge in order to use strlen() in these cases.
       --- ta/ta_utils.c.orig      2018-07-31 21:45:47.492269366 +0000
       +++ ta/ta_utils.c
       @@ -98,7 +98,11 @@ static bool strndup_append_at(char **str
            if (!*str && !append)
                return true; // stays NULL, but not an OOM condition
       -    size_t real_len = append ? strnlen(append, append_len) : 0;
       +    size_t real_len = append ?
       +   append_len == (size_t)-1 ?
       +      strlen(append) :
       +      strnlen(append, append_len) :
       +   0;
            if (append_len > real_len)
                append_len = real_len;
 ## Python `import requests` SIGILLs  ## Python `import requests` SIGILLs
   **UPDATE**: A kludge was added since py-cffi-1.11.5nb1 to avoid that.
 Doing a (please note that also `python36` is affected):  Doing a (please note that also `python36` is affected):
     $ python2.7 -c 'import requests'      $ python2.7 -c 'import requests'
Line 130  Doing a (please note that also `python36 Line 235  Doing a (please note that also `python36
     #define _cffi_save_errno                                                 \      #define _cffi_save_errno                                                 \
         ((void(*)(void))_cffi_exports[14])          ((void(*)(void))_cffi_exports[14])
 The following patch workaround the issue:  Since py-cffi-1.11.5nb1 a kludge to workaround the issue is present (by
   disabling __thread).
     $NetBSD: aarch64_problems.mdwn,v 1.7 2018/07/23 22:51:09 leot Exp $  
     Kludge for NetBSD/aarch64 SIGILL.  
     --- setup.py.orig   2018-02-27 18:15:41.000000000 +0000  
     +++ setup.py  
     @@ -70,7 +70,7 @@ def ask_supports_thread():  
          ok = (sys.platform != 'win32' and  
                config.try_compile('__thread int some_threadlocal_variable_42;'))  
          if ok:  
     -        define_macros.append(('USE__THREAD', None))  
     +        pass  
              ok1 = config.try_compile('int some_regular_variable_42;')  
              if not ok1:  
 ## polkitd crashes  ## polkitd crashes

Removed from v.1.8  
changed lines
  Added in v.1.12

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb