9pnet_virtio
EOF
install gruntmaster-exec gruntmaster-compile vm/usr/bin/
-sed -i -e "s/setgid 65534/setgid $GROUP/" -e "s/setuid 65534/setuid $USER/" vm/usr/bin/gruntmaster-exec
+sed -i -e "s/USER => 65534/USER => $USER/" -e "s/GROUP => 65534/GROUP => $GROUP/" vm/usr/bin/gruntmaster-exec
chroot vm update-initramfs -d -k 3.2.0-4-amd64
chroot vm update-initramfs -c -k 3.2.0-4-amd64
umount vm/proc
DIED => 5,
REJ => 10,
};
+# These constants are changed by ex/makevm
+use constant USER => 65534;
+use constant GROUP => 65534;
use BSD::Resource qw/setrlimit RLIMIT_AS RLIMIT_FSIZE/;
use IPC::Signal qw/sig_name sig_num/;
use POSIX qw//;
use Time::HiRes qw/alarm/;
-my (@fds, $timeout, $mlimit, $olimit);
+my (@fds, $timeout, $mlimit, $olimit, $nobody);
my $close = 1;
GetOptions(
"mlimit=i" => \$mlimit,
"olimit=i" => \$olimit,
"close!" => \$close,
+ "nobody!" => \$nobody,
);
my $ret = fork // die 'Cannot fork';
%ENV = (ONLINE_JUDGE => 1, PATH => $ENV{PATH}, HOME => $ENV{HOME});
setrlimit RLIMIT_AS, $mlimit, $mlimit or die $! if $mlimit;
setrlimit RLIMIT_FSIZE, $olimit, $olimit or die $! if $olimit;
- POSIX::setgid 65534; # Set group id to nogroup
- POSIX::setuid 65534; # Set user id to nobody
+ POSIX::setgid $nobody ? 65534 : USER;
+ POSIX::setuid $nobody ? 65534 : GROUP;
exec @ARGV;
}
my ($name, %args) = @_;
get_logger->trace("Running $name...");
my $basename = fileparse $name, qr/[.][^.]*/s;
- my @args;
+ my @args = ('--nobody');
push @args, '--timeout', $args{timeout} if $args{timeout};
push @args, '--mlimit', $args{mlimit} if $args{mlimit};
push @args, '--olimit', $args{olimit} if $args{olimit};