Modify

Ticket #1080 (closed Bugs: fixed)

Opened 7 years ago

Last modified 4 years ago

boost::interprocess win32 global file mapping issue

Reported by: matroskin222@… Owned by: igaztanaga
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

Change History

comment:1 Changed 7 years ago by igaztanaga

  • Owner set to igaztanaga

comment:2 Changed 7 years ago by marshall

  • Component changed from None to interprocess

comment:3 follow-up: ↓ 4 Changed 7 years ago by igaztanaga

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

comment:4 in reply to: ↑ 3 Changed 7 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 4 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from Boost 1.36.0 to Boost-1.45.0

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.