Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use Windows private namespace for kernel objects used in server-to-server IPC. #7213

Merged
merged 3 commits into from
Jun 20, 2022

Conversation

hvlad
Copy link
Member

@hvlad hvlad commented Jun 17, 2022

It allows to synchronize processes across different windows sessions.

…rver IPC.

It allows to synchronize processes across different windows sessions.
@hvlad hvlad self-assigned this Jun 17, 2022
if (!CreateWellKnownSid(WinWorldSid, NULL, &sid, &cbSid))
raiseError("CreateWellKnownSid");

// Create security desctriptor which allows generic access to the just created SID
Copy link
Member

Choose a reason for hiding this comment

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

typo here: desctriptor -> descriptor


void init()
{
char sid[SECURITY_MAX_SID_SIZE];
Copy link
Member

Choose a reason for hiding this comment

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

Can this be in the stack in unaligned location? Maybe some alignas should be used?

Here https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-sid I understand that AllocateAndInitializeSid would be needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here used CreateWellKnownSid() and I see no requirements for sid alignment.
Also, looking for usage samples one can see that its uses either LocalAlloc() or stack allocation.
Also, I see no notes about alignment of allocated by LocalAlloc() memory.

Anyway, I'll add alignas(SID) to be sure.

@hvlad hvlad merged commit 0c10243 into master Jun 20, 2022
@hvlad hvlad deleted the work/WinPrivateNS branch June 22, 2022 10:52
hvlad added a commit that referenced this pull request Apr 7, 2023
… objects used in server-to-server IPC.

Backport fix for bug #7535 : High CPU usage connect to Firebird 3 database using Firebird 4 Classic and SuperClassic service.
Implement new setting UseLegacyKernelObjectsNames for backward compatibility.
Preserve Win32 build compatibility with WinXP.
hvlad added a commit that referenced this pull request Apr 10, 2023
Backport improvement #7213 : Use Windows private namespace for kernel…
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants