This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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]

[Bug runtime/6903] scripts can be run by non-sudo and non-stapdev users


------- Additional Comments From dsmith at redhat dot com  2008-09-18 21:26 -------
Originally, staprun.c:main() called cap.c:init_cap(), which did the following:


  void init_cap(void)
  {
	uid_t uid = getuid();
	gid_t gid = getgid();
  ...
	if (setresuid(uid, uid, uid) < 0)
		ferror("setresuid");

	if (setresgid(gid, gid, gid) < 0)
		ferror("setresgid");
  }

Which basically set the effective and saved user/group ids to the real
user/group id.

Then, staprun.c:main() called staprun_funcs.c:check_permissions()

  int check_permissions(void)
  {
	/* If we're root, we can do anything. */
	if (geteuid() == 0)
		return 1;
       ...
  }

Without the code in init_cap(), the euid of staprun is always 0, since staprun
is setuid 0.  Changing that 'geteuid()' call to 'getuid()' seems to fix the problem.

Fixed in commit 0387bde.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=6903

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


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