Their is a limitation in Leap ncs_os_posix_shm() function
As the "maxSectionSize" defined in CKPT is of "SaUint64T" type and the "offset" which
is been derived from "+maxSectionSize" should also align to "uint64_t" type.
The memory allocation for the checkpoint:
CKPT_HEADER + MAXSECTION*(SECTIONSIZE + SECTIONHEADER)
|---------------|------------ |-------------- |------------|-------------|--- -------|-------------|-------------|
| CKPT_HDR | SEC_HDR | SEC_INFO |SEC_HDR | SEC_INFO |.............| SEC_HDR |SEC_INFO |
|---------------|------------ |-------------- |------------|-------------|--- -------|-------------|-------------|
The checkpoint section is read base on checkpoint pointer. For example: we need to read data from checkpoint section 5000.
Then it will get checkpoint + checkpoint section offset. The checkpoint section offset in this case is 4999*(SECTIONSIZE + SECTIONHEADER). If the section size is 2MB, is it overflow?
i_offset datatype is int32_t.
while (counter < ckpt_hdr.n_secs) { memset(&read_req, '\0', sizeof(NCS_OS_POSIX_SHM_REQ_INFO)); memset(§_hdr, '\0', sizeof(CPSV_SECT_HDR)); read_req.type = NCS_OS_POSIX_SHM_REQ_READ; read_req.info.read.i_addr = (void *)((char *)open_req->info.open.o_addr + sizeof(CPSV_CKPT_HDR)); read_req.info.read.i_read_size = sizeof(CPSV_SECT_HDR); read_req.info.read.i_offset = counter * (sizeof(CPSV_SECT_HDR) + (*cp_node)->create_attrib.maxSectionSize); read_req.info.read.i_to_buff = (CPSV_SECT_HDR *)§_hdr; rc = ncs_os_posix_shm(&read_req); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("cpnd sect HDR read failed"); /* assert(0); */ return rc; }…
}
Tickets: #1271
Tickets: #1372
Wiki: ChangeLog-4.5.2
Wiki: ChangeLog-4.6.1
Diff:
changeset: 6599:512659e50b5c
branch: opensaf-4.5.x
parent: 6593:49e69afbd0df
user: A V Mahesh mahesh.valla@oracle.com
date: Thu Jun 04 14:18:37 2015 +0530
summary: leap: enhance posix_shm() to accommodate SaOffsetT [#1271]
changeset: 6601:d7368041f931
branch: opensaf-4.6.x
parent: 6594:447615c80905
user: A V Mahesh mahesh.valla@oracle.com
date: Thu Jun 04 14:23:22 2015 +0530
summary: leap: enhance posix_shm() to accommodate SaOffsetT [#1271]
changeset: 6603:5133a0a441a6
parent: 6598:ca169b780407
user: A V Mahesh mahesh.valla@oracle.com
date: Thu Jun 04 14:24:05 2015 +0530
summary: leap: enhance posix_shm() to accommodate SaOffsetT [#1271]
Related
Tickets:
#1271