Skip to content

Fix: tde encrypt buffer context don't use share memory#1424

Merged
my-ship-it merged 1 commit intoapache:mainfrom
kongfanshen-0801:not_use_share_mem
Nov 19, 2025
Merged

Fix: tde encrypt buffer context don't use share memory#1424
my-ship-it merged 1 commit intoapache:mainfrom
kongfanshen-0801:not_use_share_mem

Conversation

@kongfanshen-0801
Copy link
Copy Markdown
Contributor

@kongfanshen-0801 kongfanshen-0801 commented Oct 31, 2025

Now we Fix: tde encrypt buffer context don't use share memory

We did not calculate the size of shared memory for BufEncCtx and BufDecCtx in the CreateSharedMemoryAndMemories function, which is a potential issue. There is actually no need to use shared memory here, as the parent process does not read the values of BufEncCtx and BufDecCtx. When we use AES algorithm the BufEncCtx and BufDecCtx also does not use shared memory. In order to maintain a consistent code style,we use malloc. cann't use palloc to apply for memory here, as TopmemoryContext is NULL during initialization and the memoryContext has not been setted yet.

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


Comment thread src/backend/crypto/bufenc.c Outdated
Comment thread src/backend/crypto/bufenc.c Outdated
Comment thread src/backend/crypto/bufenc.c Outdated
Copy link
Copy Markdown
Contributor

@gfphoenix78 gfphoenix78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@my-ship-it my-ship-it force-pushed the not_use_share_mem branch 2 times, most recently from 769f782 to 4c1e083 Compare November 18, 2025 01:44
Now we Fix: tde encrypt buffer context don't use share memory

We did not calculate the size of shared memory for BufEncCtx and BufDecCtx
in the CreateSharedMemoryAndMemories function, which is a potential issue.
There is actually no need to use shared memory here, as the parent process
does not read the values of BufEncCtx and BufDecCtx. When we use AES algorithm
the BufEncCtx and BufDecCtx also does not use shared memory. In order to
maintain a consistent code style,we use malloc. cann't use palloc to apply
for memory here, as TopmemoryContext is NULL during initialization and
the memoryContext has not been setted yet.
@my-ship-it my-ship-it merged commit c71271e into apache:main Nov 19, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants