LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 01-25-2004, 05:11 AM   #1
synna
Member
 
Registered: Jan 2004
Posts: 40

Rep: Reputation: 15
Controlling process and thread security in C/C++


How can I control thread and process (lauchned by my program):
1) read access.
2) write access.
3) execute access.

4) allow write access only in one directory with fixed maximum disk usage.
5) track CPU usage of thread and process.
6) limiting number of thread a plugin can create.
7) Controlling which dynamic library are being loaded.

The question is for Linux, Window$(I don't think it's possible) and Mac OS X.


I need this because i'm writting a software that will have some kind of plugin (executed or threaded) and I want to be sure that they won't damage the system in any way.

This is because, in these case, I can't trust all plugin (or check them all).

Any small response is welcome.

The program will be in C/C++

Thanks in advance !!!!

Last edited by synna; 01-25-2004 at 05:33 AM.
 
Old 01-25-2004, 08:42 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
4) can be achieved by setting the uid/gid permission bits on your program to a user/group that can only write to this particular directory then make sure you are running as this user before you execute the plugins code. the max disk space can be set by quota but ive never used it so dont know.

5) i would start by reading this
 
Old 01-25-2004, 03:36 PM   #3
synna
Member
 
Registered: Jan 2004
Posts: 40

Original Poster
Rep: Reputation: 15
Cool, your link fix problem 5 and 6. Thanks.

Is it possible to check all external stream like in java (something like redirecting all stream so they first pass by my program). Just thought about another way to do it. I know it's possible on java.

The problem with what is explain on the link is that you can control quantity (how many files, how many bits) but not which files.
 
Old 01-26-2004, 07:01 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
by synna
Is it possible to check all external stream like in java (something like redirecting all stream so they first pass by my program)

not that i know of.

to be honest i wouldnt bother trying to do this i would just say to the users that you are not responsible for the effects of 3rd party plugins, as far as i know none of the major apps that use plugins try and restrict there plugins in this way, look at the source for apache/gaim/mozilla/etc and see what they do/dont do.
 
Old 01-27-2004, 06:28 AM   #5
synna
Member
 
Registered: Jan 2004
Posts: 40

Original Poster
Rep: Reputation: 15
I found some source about trying to secure thread and execution.

I put them here so if you're interested you can check

Secure programming HOW-TO

and another one

Linux system calls

Hope this can help some.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what happens if i create a thread and then fork the process? Thinking Programming 7 10-31-2005 02:22 PM
controlling the linux boot up process bahadur Linux - Software 4 07-14-2005 06:55 AM
what advantage do kernel thread has over process? keiwu Linux - Software 1 03-04-2005 07:18 PM
Process and thread PIDs msriram_linux Programming 4 11-27-2004 11:43 AM
Sendmail config: security and controlling outgoing mail unknownrisk Linux - Software 1 03-21-2004 02:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration