version 1.10, 2018/07/29 10:59:29
|
version 1.11, 2018/07/31 22:22:28
|
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) |
Just by invoking `mpv` via: |
Just by invoking `mpv` via: |
|
|
% mpv |
% mpv |
Line 59 It SEGV as follows:
|
Line 59 It SEGV as follows:
|
#3 0x00000002001cbea4 in ta_strdup_append_buffer (str=str@entry=0xf96f6f4ff348, a=<optimized out>) at ../ta/ta_utils.c:165 |
#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 |
#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 |
#5 0x0000000200157eec in print_str_list (opt=<optimized out>, src=<optimized out>) at ../options/m_option.c:1477 |
#6 0x000000020015db90 in m_option_print (val_ptr=0xf96f6f4ff3c0, opt=0xf96f6f4ff430) at ../options/m_option.h:496 |
[...] |
#7 m_property_do (log=0xf96f71045130, prop_list=0xf96f71081040, name=name@entry=0xf96f6e139218 "property-list", |
|
action=action@entry=6, arg=arg@entry=0xf96f6f4ff598, ctx=ctx@entry=0xf96f71011040) at ../options/m_property.c:127 |
|
#8 0x000000020016f9f8 in mp_property_do_silent (name=0xf96f6e139218 "property-list", action=6, val=0xf96f6f4ff598, ctx=0xf96f71011040) |
|
at ../player/command.c:4167 |
|
#9 0x0000000200171014 in mp_property_do (name=0xf96f6e139218 "property-list", action=action@entry=6, val=<optimized out>, |
|
val@entry=0xf96f6f4ff5c8, ctx=0xf96f71011040) at ../player/command.c:4177 |
|
#10 0x00000002001637bc in getproperty_fn (arg=0xf96f6f4ff5d8, arg@entry=0xf96f6f4ff5e8) at ../player/client.c:1261 |
|
#11 0x00000002001655b0 in run_locked (fn_data=0xf96f6f4ff5e8, fn=0x200163648 <getproperty_fn>, ctx=0xf96f6f5071c0) |
|
at ../player/client.c:1003 |
|
#12 mpv_get_property (ctx=0xf96f6f5071c0, name=name@entry=0xf96f6e139218 "property-list", format=format@entry=MPV_FORMAT_STRING, |
|
data=data@entry=0xf96f6f4ff668) at ../player/client.c:1335 |
|
#13 0x0000000200179b4c in script_get_property (L=0xf96f6e103400) at ../player/lua.c:794 |
|
#14 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5 |
|
#15 0x0000f96f72b3877c in luaV_execute () from /usr/pkg/lib/liblua5.2.so.5 |
|
#16 0x0000f96f72b2cf04 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5 |
|
#17 0x0000f96f72b28e40 in lua_callk () from /usr/pkg/lib/liblua5.2.so.5 |
|
#18 0x0000000200178270 in load_builtin (L=0xf96f6e103400) at ../player/lua.c:214 |
|
#19 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5 |
|
#20 0x0000f96f72b2cef8 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5 |
|
#21 0x0000f96f72b28e40 in lua_callk () from /usr/pkg/lib/liblua5.2.so.5 |
|
#22 0x0000f96f72b43900 in ll_require () from /usr/pkg/lib/liblua5.2.so.5 |
|
#23 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5 |
|
---Type <return> to continue, or q <return> to quit--- |
|
#24 0x0000f96f72b3877c in luaV_execute () from /usr/pkg/lib/liblua5.2.so.5 |
|
#25 0x0000f96f72b2cf04 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5 |
|
#26 0x0000f96f72b28e40 in lua_callk () from /usr/pkg/lib/liblua5.2.so.5 |
|
#27 0x0000000200179524 in require (L=L@entry=0xf96f6e103400, name=name@entry=0xf96f6f503420 "@stats.lua") at ../player/lua.c:232 |
|
#28 0x000000020017963c in load_scripts (L=0xf96f6e103400) at ../player/lua.c:260 |
|
#29 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5 |
|
#30 0x0000f96f72b2cef8 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5 |
|
#31 0x0000f96f72b2c4b8 in luaD_rawrunprotected () from /usr/pkg/lib/liblua5.2.so.5 |
|
#32 0x0000f96f72b2d19c in luaD_pcall () from /usr/pkg/lib/liblua5.2.so.5 |
|
#33 0x0000f96f72b28f14 in lua_pcallk () from /usr/pkg/lib/liblua5.2.so.5 |
|
#34 0x000000020017b020 in run_lua (L=0xf96f6e103400) at ../player/lua.c:354 |
|
#35 0x0000f96f72b2cb80 in luaD_precall () from /usr/pkg/lib/liblua5.2.so.5 |
|
#36 0x0000f96f72b2cef8 in luaD_call () from /usr/pkg/lib/liblua5.2.so.5 |
|
#37 0x0000f96f72b2c4b8 in luaD_rawrunprotected () from /usr/pkg/lib/liblua5.2.so.5 |
|
#38 0x0000f96f72b2d19c in luaD_pcall () from /usr/pkg/lib/liblua5.2.so.5 |
|
#39 0x0000f96f72b28f14 in lua_pcallk () from /usr/pkg/lib/liblua5.2.so.5 |
|
#40 0x000000020017b4c8 in mp_cpcall (func=0x20017abd0 <run_lua>, ud=0xf96f6e1010c0, L=0xf96f6e103400) at ../player/lua.c:99 |
|
#41 load_lua (client=<optimized out>, fname=0xf96f6f503420 "@stats.lua") at ../player/lua.c:387 |
|
#42 0x00000002001815c0 in script_thread (p=0xf96f6f5050c0) at ../player/scripting.c:95 |
|
#43 0x0000f96f743ec588 in pthread__create_tramp (cookie=0xf96f6f515000) at /usr/src/lib/libpthread/pthread.c:593 |
|
#44 0x0000f96f727385ec in _lwp_makecontext (u=0x0, start=0x0, arg=0x0, private=0xff00000014, |
|
stack_base=0x1 <error: Cannot access memory at address 0x1>, stack_size=8589934592) at /usr/src/lib/libc/arch/aarch64/gen/_lwp.c:47 |
|
#45 0x0000f96f743df000 in ?? () |
|
#46 0x544a8f02d40034c1 in ?? () |
|
Backtrace stopped: previous frame identical to this frame (corrupt stack?) |
|
|
|
|
This happens because `strnlen(s, (size_t)-1)`, always returns -1, e.g.: |
|
|
|
% cat strnlen_size_max.c |
|
#include <stdio.h> |
|
#include <string.h> |
|
|
|
|
|
int |
|
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 |
|
|
|
(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$ |
|
|
|
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 |
Doing a (please note that also `python36` is affected): |
Doing a (please note that also `python36` is affected): |