Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-10-2007, 07:03 PM
|
#1
|
|
Senior Member
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian Squeeze, Gentoo
Posts: 1,147
Rep:
|
Shared memory authentification
Perhaps this question is better suited for the programming forum, but I thought I'd try here first. I somehow got the crazy idea that I could design a virtual file system like gnome-vfs or KIO, and I'm now stuck with a bunch of design choices.
Anyhow, I'm considering implementing the VFS as a per-user daemon, which applications would connect to and post requests to. However, if I ever intend for this model to work, it must be secure. Now, since a lot of data could potentially be getting pushed between two processes, I must use extremely fast IPC, which is why I settled on shared memory.
The basic idea is that the daemon would simply have an open socket that it listened to. Other processes would generate a unique shared memory segment, then communicate its ID over the socket. Then the daemon would connect to that piece of shared memory and from then on do all its IPC through that.
Now, the trick is enforcing the per-user daemon thing. That is, how to prevent a user process from connecting to the root daemon, effectively gaining root permissions to the file-system? I was wondering if there was any way to get the PID of the other processes attached to your piece of shared memory? By the way, I'm talking about shmget() shared memory, not mmaped shared memory.
I thought about using mmap as a way of doing this - it would allow you to use file permissions to control this - have a directory that the daemon watches, and when a process wants to connect it creates a file with its PID as the file name. Set the file permissions so that only to user can read or write to it. The trouble with this is that it might lead to corruption if one process exits and another is created with that PID between scans. Then the new connection wouldn't be made.
Anyhow, is there any way to verify the identity of the process on the other end of a bit of shared memory?
|
|
|
|
05-10-2007, 07:20 PM
|
#2
|
|
Senior Member
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian Squeeze, Gentoo
Posts: 1,147
Original Poster
Rep:
|
wow, never mind - I feel stupid. Upon another reading of the manpage for shmget, I see that one can specify the permissions on a piece of shared memory.
|
|
|
|
05-11-2007, 12:19 AM
|
#3
|
|
Moderator
Registered: May 2001
Posts: 24,779
|
Moved: This thread is more suitable in the Programming forum and has been moved accordingly to help your thread/question get the exposure it deserves.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:26 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|