kongfanshen-0801 commented on code in PR #1424:
URL: https://github.com/apache/cloudberry/pull/1424#discussion_r2480726483


##########
src/backend/crypto/bufenc.c:
##########
@@ -51,12 +51,9 @@ InitializeBufferEncryption(void)
 
        if (CheckIsSM4Method())
        {
-               bool found;
-               BufEncCtx = ShmemInitStruct("sm4 encryption method encrypt ctx",
-                                                                               
                sizeof(sm4_ctx), &found);
+               BufEncCtx = malloc(sizeof(sm4_ctx));

Review Comment:
   can not free the memory. when run initdb command, the database run in 
single-user mode. We still need the BufEncCtx and BufDecCtx in postmaster 
process.
   
   make create-demo-cluster  fail, because initdb raise error as follow:
   performing post-bootstrap initialization ... LOG:  gp_role forced to 
'utility' in single-user mode
   2025-10-31 17:27:02.463981 
CST,,,p27587,th407206016,,,,0,,,seg-10000,,,,sx1,"FATAL","XX001","invalid page 
in block 0 of relation global/1260",,,,,,,,"ReadBuffer_common","bufmgr.c",1138,
   initdb: error: error while reading cdb_init.d directory: Broken pipe
   initdb: removing data directory 
"/home/gpadmin/cloudberrydb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1
   
   Maybe the key is wrong in BufDecCtx  if we free the memory, then get wrong 
data after decrypt. At last get invalid page.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to