Module: Mesa
Branch: master
Commit: f173bf1be963a5df4379afd236fd843dd784733f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f173bf1be963a5df4379afd236fd843dd784733f

Author: Marijn Suijten <[email protected]>
Date:   Tue Dec  1 19:13:38 2020 +0100

util: Do not insert uninitialized data if Android property is not set

This prevents funky segfaults in seemingly unrelated codepaths like:

    pid: 20058, tid: 20086, name: Binder:20058_2  >>> 
/system/bin/surfaceflinger <<<
    uid: 1000
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x184
    Cause: null pointer dereference
    [...]
    #00 pc 000000000020b078  /vendor/lib64/dri/gallium_dri.so 
(ir3_shader_variant+56)
    #01 pc 00000000001dc168  /vendor/lib64/dri/gallium_dri.so (fd5_draw_vbo+920)
    #02 pc 00000000001a30f8  /vendor/lib64/dri/gallium_dri.so (fd_draw_vbo+1264)
    #03 pc 000000000077e714  /vendor/lib64/dri/gallium_dri.so 
(util_primconvert_draw_vbo+596)
    #04 pc 00000000001a2d60  /vendor/lib64/dri/gallium_dri.so (fd_draw_vbo+344)
    #05 pc 00000000007671e4  /vendor/lib64/dri/gallium_dri.so 
(dd_context_draw_vbo+300)
    #06 pc 00000000007b6c9c  /vendor/lib64/dri/gallium_dri.so 
(u_vbuf_draw_vbo+2268)
    #07 pc 000000000074d230  /vendor/lib64/dri/gallium_dri.so 
(cso_draw_arrays+96)
    #08 pc 00000000007a4258  /vendor/lib64/dri/gallium_dri.so 
(util_draw_user_vertex_buffer+96)
    #09 pc 00000000007b0968  /vendor/lib64/dri/gallium_dri.so 
(util_run_tests+480)
    #10 pc 000000000019e24c  /vendor/lib64/dri/gallium_dri.so 
(pipe_msm_create_screen+68)
    #11 pc 00000000006ada8c  /vendor/lib64/dri/gallium_dri.so 
(pipe_loader_create_screen+60)
    #12 pc 000000000020e958  /vendor/lib64/dri/gallium_dri.so 
(dri2_init_screen+120)
    #13 pc 00000000006ad088  /vendor/lib64/dri/gallium_dri.so 
(driCreateNewScreen2+544)

Fixes: eeecc21d935 ("util: Add property_get() fallback for android")
Reviewed-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7928>

---

 src/util/os_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/os_misc.c b/src/util/os_misc.c
index 2bac1bc2f8b..68fbb51051b 100644
--- a/src/util/os_misc.c
+++ b/src/util/os_misc.c
@@ -195,7 +195,7 @@ os_get_android_option(const char *name)
       opt = ralloc_strdup(options_tbl, value);
    }
 
-   _mesa_hash_table_insert(options_tbl, name, value);
+   _mesa_hash_table_insert(options_tbl, name, (void *)opt);
 
    return opt;
 }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to