Bug 143568 - ktrace(1) is limited with other user's "filesize" limit
Summary: ktrace(1) is limited with other user's "filesize" limit
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-05 05:50 UTC by Eugene Grosbein
Modified: 2021-06-06 07:54 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein 2010-02-05 05:50:01 UTC
	ktrace stops writing trace file if "filesize" limit is enabled
	by traced process.

Fix: 

Unknown
How-To-Repeat: 
	Compile this test code: cc -o example example.c
	It needs two command line arguments: filesize limit (in bytes)
	and some user's uid (f.e., 65534 for "nobody").

#include <sys/types.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
  
  struct rlimit rl;

  if (argc > 2) {  
    rl.rlim_cur = atol(argv[1]);
    setrlimit(RLIMIT_FSIZE, &rl);
    seteuid(atol(argv[2]));
    while(1)
      usleep(10);
  }
  return 0;
}

	Use kernel with "options KTRACE" and run the example as root,
	it breaks as soon as trace file size hits limit:

# ktrace ./example 100000 65535
Filesize limit exceeded: 25

	Note that traced code does not write anything, it runs as another user
	and sets limit for itself only and not for ktrace.
	
	This makes it difficult to debug real services using "filesize"
	limit like stock ftpd serving users with limited login class assigned.
Comment 1 Remko Lodder freebsd_committer 2010-08-29 15:13:06 UTC
Responsible Changed
From-To: freebsd-bugs->secteam

For review / check to sectaem
Comment 2 Edward Tomasz Napierala freebsd_committer 2013-09-07 17:33:53 UTC
Responsible Changed
From-To: secteam->freebsd-bugs

Not a security issue.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:59 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped