After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752919 - AddressSanitizer: heap-buffer-overflow on address 0x606000d96320
AddressSanitizer: heap-buffer-overflow on address 0x606000d96320
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: pkcs11
3.16.x
Other Linux
: Normal critical
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-07-27 12:35 UTC by Milan Crha
Modified: 2015-08-12 12:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (777 bytes, patch)
2015-08-06 12:04 UTC, Milan Crha
none Details | Review

Description Milan Crha 2015-07-27 12:35:10 UTC
I compiled evolution with an address sanitizer on and it cannot be run due to an issue in the below code. My packages are:
   gnome-keyring-3.16.0-1.fc22.x86_64
   p11-kit-0.23.1-1.fc22.x86_64


==29167==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606000d96320 at pc 0x7f7348af22b8 bp 0x7ffdbbd477f0 sp 0x7ffdbbd46f98
READ of size 32 at 0x606000d96320 thread T0
    #0 0x7f7348af22b7 in __asan_memmove (/lib64/libasan.so.2+0x8d2b7)
    #1 0x7f72e4586d11  (/usr/lib64/pkcs11/gnome-keyring-pkcs11.so+0xcd11)
    #2 0x7f72e45846e5  (/usr/lib64/pkcs11/gnome-keyring-pkcs11.so+0xa6e5)
    #3 0x336b222a0e  (/lib64/libp11-kit.so.0+0x336b222a0e)
    #4 0x336b2397d0  (/lib64/libp11-kit.so.0+0x336b2397d0)
    #5 0x334fa05b9e in ffi_closure_unix64_inner (/lib64/libffi.so.6+0x334fa05b9e)
    #6 0x334fa05f17 in ffi_closure_unix64 (/lib64/libffi.so.6+0x334fa05f17)
    #7 0x36a26546b8  (/lib64/libnss3.so+0x36a26546b8)
    #8 0x36a265515a  (/lib64/libnss3.so+0x36a265515a)
    #9 0x36a265569c  (/lib64/libnss3.so+0x36a265569c)
    #10 0x36a263f5de  (/lib64/libnss3.so+0x36a263f5de)
    #11 0x36a264b0da in SECMOD_LoadModule (/lib64/libnss3.so+0x36a264b0da)
    #12 0x36a264b1df in SECMOD_LoadModule (/lib64/libnss3.so+0x36a264b1df)
    #13 0x36a261a39a  (/lib64/libnss3.so+0x36a261a39a)
    #14 0x36a261ab57 in NSS_InitWithMerge (/lib64/libnss3.so+0x36a261ab57)
    #15 0x7f7343b9dc3a in camel_init /data/develop/local/evolution-data-server/camel/camel.c:161
    #16 0x7f733432a9a9 in initialize_nss /data/develop/local/evolution/smime/lib/e-cert-db.c:482
    #17 0x7f733432b097 in e_cert_db_class_init /data/develop/local/evolution/smime/lib/e-cert-db.c:598
    #18 0x7f733432952a in e_cert_db_class_intern_init /data/develop/local/evolution/smime/lib/e-cert-db.c:90
    #19 0x334fe2f43c in g_type_class_ref (/lib64/libgobject-2.0.so.0+0x334fe2f43c)
    #20 0x334fe16b3c in g_object_newv (/lib64/libgobject-2.0.so.0+0x334fe16b3c)
    #21 0x334fe172c3 in g_object_new (/lib64/libgobject-2.0.so.0+0x334fe172c3)
    #22 0x7f733432b28c in e_cert_db_peek /data/develop/local/evolution/smime/lib/e-cert-db.c:646
    #23 0x7f73345772c8 in smime_component_init /data/develop/local/evolution/smime/gui/component.c:129
    #24 0x7f72e9a3764b in book_shell_backend_constructed /data/develop/local/evolution/modules/addressbook/e-book-shell-backend.c:451
    #25 0x334fe14fa3  (/lib64/libgobject-2.0.so.0+0x334fe14fa3)
    #26 0x334fe16f44 in g_object_new_valist (/lib64/libgobject-2.0.so.0+0x334fe16f44)
    #27 0x334fe172b0 in g_object_new (/lib64/libgobject-2.0.so.0+0x334fe172b0)
    #28 0x7f73452a4f3d in extensible_load_extension /data/develop/local/evolution-data-server/libedataserver/e-extensible.c:99
    #29 0x7f734535a979 in e_type_traverse /data/develop/local/evolution-data-server/libedataserver/e-data-server-util.c:2756
    #30 0x7f734535a944 in e_type_traverse /data/develop/local/evolution-data-server/libedataserver/e-data-server-util.c:2750
    #31 0x7f73452a514d in e_extensible_load_extensions /data/develop/local/evolution-data-server/libedataserver/e-extensible.c:144
    #32 0x7f73452a536f in e_extensible_list_extensions /data/develop/local/evolution-data-server/libedataserver/e-extensible.c:186
    #33 0x7f7348791a1f in e_shell_load_modules /data/develop/local/evolution/shell/e-shell.c:1919
    #34 0x40557d in main /data/develop/local/evolution/shell/main.c:618
    #35 0x7f73443c46ff in __libc_start_main (/lib64/libc.so.6+0x206ff)
    #36 0x4043e8 in _start (/build/local/bin/evolution+0x4043e8)

0x606000d96320 is located 0 bytes to the right of 64-byte region [0x606000d962e0,0x606000d96320)
allocated by thread T0 here:
    #0 0x7f7348afda0a in malloc (/lib64/libasan.so.2+0x98a0a)
    #1 0x36a221667c in PORT_Alloc_Util (/lib64/libnssutil3.so+0x36a221667c)
    #2 0x98b19cb7e2976dff  (<unknown module>)

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 __asan_memmove
Shadow bytes around the buggy address:
  0x0c0c801aac10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c801aac20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c801aac30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c801aac40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c801aac50: fa fa fa fa fa fa fa fa fa fa fa fa 00 00 00 00
=>0x0c0c801aac60: 00 00 00 00[fa]fa fa fa 00 00 00 00 00 00 03 fa
  0x0c0c801aac70: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
  0x0c0c801aac80: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
  0x0c0c801aac90: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 05
  0x0c0c801aaca0: fa fa fa fa 00 00 00 00 00 00 00 05 fa fa fa fa
  0x0c0c801aacb0: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==29167==ABORTING

The backtrace is:

Thread 1 (Thread 0x7f7349b84ac0 (LWP 29167))

  • #0 waitpid
  • #1 0x00007f7348aa744c in
  • #2 g_spawn_sync
  • #3 g_spawn_command_line_sync
  • #4 run_bug_buddy
    at gnome-segvhanlder.c line 245
  • #5 bugbuddy_segv_handle
    at gnome-segvhanlder.c line 196
  • #6 <signal handler called>
  • #7 raise
  • #8 abort
  • #9 0x00007f7348b13169 in
  • #10 0x00007f7348b05b59 in
  • #11 0x00007f7348b0a992 in
  • #12 __asan_report_error
  • #13 __asan_memmove
  • #14 gkm_rpc_mechanism_list_purge
    at /usr/include/bits/string3.h line 59
  • #15 gkm_rpc_mechanism_list_purge
    at pkcs11/rpc-layer/gkm-rpc-util.c line 86
  • #16 rpc_C_GetMechanismList
    at pkcs11/rpc-layer/gkm-rpc-module.c line 1380
  • #17 proxy_C_GetMechanismList
  • #18 binding_C_GetMechanismList
  • #19 ffi_closure_unix64_inner
  • #20 ffi_closure_unix64
  • #21 PK11_ReadMechanismList
  • #22 PK11_InitToken
  • #23 PK11_InitSlot
  • #24 secmod_LoadPKCS11Module
  • #25 SECMOD_LoadModule
  • #26 SECMOD_LoadModule
  • #27 nss_Init
  • #28 NSS_InitWithMerge
  • #29 camel_init
    at camel.c line 161
  • #30 initialize_nss
    at e-cert-db.c line 482
  • #31 e_cert_db_class_init
    at e-cert-db.c line 598
  • #32 e_cert_db_class_intern_init
    at e-cert-db.c line 90
  • #33 g_type_class_ref
  • #34 g_object_newv
  • #35 g_object_new
  • #36 e_cert_db_peek
    at e-cert-db.c line 646
  • #37 smime_component_init
    at component.c line 129
  • #38 book_shell_backend_constructed
    at e-book-shell-backend.c line 451
  • #39 g_object_new_internal
  • #40 g_object_new_valist
  • #41 g_object_new
  • #42 extensible_load_extension
    at e-extensible.c line 99
  • #43 e_type_traverse
    at e-data-server-util.c line 2756
  • #44 e_type_traverse
    at e-data-server-util.c line 2750
  • #45 e_extensible_load_extensions
    at e-extensible.c line 144
  • #46 e_extensible_list_extensions
    at e-extensible.c line 186
  • #47 e_shell_load_modules
    at e-shell.c line 1919
  • #48 main
    at main.c line 618

Comment 1 Milan Crha 2015-08-06 12:04:44 UTC
Created attachment 308846 [details] [review]
proposed patch

for gnome-keyring;

There was done a read of one item more than the array was allocated. This patch fixes the issue.
Comment 2 Stef Walter 2015-08-12 12:06:25 UTC
Thanks! Merged.