kern/143568: ktrace is limited with other user's "filesize" limit
Eugene Grosbein
egrosbein at rdtc.ru
Fri Feb 5 05:50:02 UTC 2010
>Number: 143568
>Category: kern
>Synopsis: ktrace is limited with other user's "filesize" limit
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 05 05:50:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Eugene Grosbein
>Release: FreeBSD 8.0-STABLE i386
>Organization:
RDTC JSC
>Environment:
System: FreeBSD eg.sd.rdtc.ru 8.0-STABLE FreeBSD 8.0-STABLE #6: Mon Jan 11 15:04:08 KRAT 2010 root at eg.sd.rdtc.ru:/usr/local/obj/usr/local/src/sys/EG i386
>Description:
ktrace stops writing trace file if "filesize" limit is enabled
by traced process.
>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.
>Fix:
Unknown
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list