Modify

Opened 10 years ago

Closed 7 years ago

#1080 closed Bugs (fixed)

boost::interprocess win32 global file mapping issue

Reported by: matroskin222@… Owned by: Ion Gaztañaga
Milestone: Boost 1.45.0 Component: interprocess
Version: Severity: Problem
Keywords: interprocess global shared memory win32 Cc:

Description

There is a serious bug in boost::interprocess library. It is unable to create global shared memory between services and simle applications. An exception is thrown ( m_err = 5, m_str = "Access is denied" ) I shortly investigated the way to fix this issue and found that call of CreateFileMappingA winAPI in winapi::create_file_mapping function sets lpAttributes parameter as NULL. To get rid of "Access is denied" error you can reimplement this function as: static inline void * create_file_mapping (void * handle, unsigned long access, unsigned long high_size, unsigned long low_size, const char * name) {

SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd;

InitializeSecurityDescriptor?(&sd,SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl?(&sd, true, NULL, false);

sa.lpSecurityDescriptor = &sd; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = FALSE; return CreateFileMappingA (handle, &sa, access, high_size, low_size, name);

}

Attachments (0)

Change History (5)

comment:1 Changed 10 years ago by Ion Gaztañaga

Owner: set to Ion Gaztañaga

comment:2 Changed 10 years ago by Marshall Clow

Component: Noneinterprocess

comment:3 Changed 10 years ago by Ion Gaztañaga

Changed SVN adding suggested code. Reporter: close this bug if the problem has completely disappeared.

comment:4 in reply to:  3 Changed 10 years ago by matroskin222@…

Replying to igaztanaga:

Changed SVN adding suggested code. Reporter: close this bug if the problem has completely disappeared.

Problem didn't completely disappeared. You have to pass such security attributes in each WinApi? call where SA parameter is required. Or allow users to specify SA by themselves.

comment:5 Changed 7 years ago by Ion Gaztañaga

Milestone: Boost 1.36.0Boost-1.45.0
Resolution: fixed
Status: newclosed

New permission scheme added for Boost 1.45, the user can specify permissions.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.