osaf/services/saf/cpsv/cpnd/cpnd_init.c |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


When installing a campaign a test component, the ckptnd trigger a core dump.
Following is the message in the syslog.

Jun 17 07:50:41 SC-2-2 osafckptnd[11361]: ER cpnd open request fail for RDWR 
mode (null)
Jun 17 07:50:51 SC-2-2 kernel: [ 494.474214] osafckptnd[11361]: segfault at 0 
ip 00007f25cd609608 sp 00007fffdb6290b8 error 4 in 
libc-2.19.so[7f25cd57f000+19e000]

Following is the bt:
(gdb) bt
0 0x00007fb733293608 in _wordcopy_fwd_dest_aligned () from /lib64/libc.so.6
1 0x00007fb73328db8a in __memmove_sse2 () from /lib64/libc.so.6
2 0x00007fb7343258cc in ncs_os_posix_shm (req=0x7fffe65e7090) at os_defs.c:836
3 0x0000000000415d1f in cpnd_find_free_loc ()
4 0x0000000000415f46 in cpnd_restart_shm_client_update ()
5 0x0000000000405a5b in cpnd_evt_proc_ckpt_init ()
6 0x000000000040d532 in cpnd_process_evt ()
7 0x000000000040e235 in cpnd_main_process ()
8 0x000000000040edf7 in main ()

Investigation:
--------------
At start up, when cpnd creates restart share memory, it doesn't handle faulty 
case where a NULL
shm_ptr pointer is returned. This leads triggering core dump when the pointer 
is used later.

Solution:
---------
To return fault code when creating restart share memory fails.

diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_init.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_init.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_init.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_init.c
@@ -270,6 +270,10 @@ static uint32_t cpnd_lib_init(CPND_CREAT
                gbl_shm_addr.ckpt_addr = (void *)((char *)gbl_shm_addr.cli_addr 
+ sizeof(CLIENT_HDR) +
                                                  (MAX_CLIENTS * 
sizeof(CLIENT_INFO)));
                cb->shm_addr = gbl_shm_addr;
+       } else {
+               LOG_ER("cpnd restart_shm create failed");
+               rc = NCSCC_RC_FAILURE;
+               goto amf_reg_err;
        }
 
        if ((rc = cpnd_mds_register(cb)) != NCSCC_RC_SUCCESS) {

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to