This is the mail archive of the mailing list for the frysk project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Permission to task and proc

When I write IsaFactory and test it, I get a problem, and I hope your
suggestions are helpful for me to resolve this problem.

When frysk starts up, it will iterate all the processes and tasks, and
initialize objects correspondingly.  setupMapsXXX() in LinuxTask will
get byteorder via isa(byteorder used to hardwired to little endian),
and then get isa via ELF header of /proc/<pid>/exe.  The problem here
is frysk do not have the read permission to all the processes and
task, even I start frysk as root, still fail to read /proc/<pid>/exe
if <pid> is a kernel thread, such as aio.

frysk, as a debugger or monitor, should only manipulate and inspect
the processes and tasks that it has the permission to.  If user want to
monitor process or task owned by root, please switch user to root, and
start up frysk again.

So, the policy to filter process and task, which frysk has not read
permission to, is needed.  In my working copy, I did it as follows,

1. Add a member boolean permission, and a member function protected
abstract void setPermission() to Class Task,

2. Override setPermission in LinuxTask like this,

protected void setPermission()
   File f = new File("/proc/"+ Integer.toString( + "/exe");
   permission = f.canRead();

3. Call setPermission() in constructor of LinuxTask, and then call
setupMapsXXX() if permission is true.

In this schema, frysk could skip the process or task it has no read
permission to, and does not set up maps.

Is there any api to check process or task permission in java?  I could
not find, so I equal permission of /proc/<pid>/exe to process permission.

Any comments?

In "Create a Frysk session" when FryskSessionDruid start up, all the 
processes in "Available Process Groups" box are owned by the currenty user,
and process owned by other users are not listed.  I read
frysk-gui/frysk/gui/druid/, but still not
know how these processes filtered.  Could anybody here clarify it for


Yao Qi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]