[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setexc, Ssystem, Fcntl FSTAT in new kernel



Hi,

1) Setexc of logical GEMDOS vectors now works properly, thanks.

2) Ssystem: I think there are situations where Ssystem can't replace
a supervisor mode call. In a case like that, I would prefer to
gracefully fail and print an error message instead of having my
program terminated. To do that, I would like to try Ssystem mode 16
to inquire the current SECURELEVEL. However, even the inquire mode
is restricted to root... Or is there a better way?

3) Fcntl FSTAT on TOSFS: I think the patch for tosfs_write (which 
keeps the file information cached instead of invalidating it)
should be applied.

4) It seems that SECURELEVEL 2 terminates programs on Supexec(), but not
on Super(). Try this program:

static void
term_handler (void)
{
	fprintf (stderr, "SIGTERM received\n");
}

static long
getsyshdr (void)
{
	return *((long *)0x4f2L);
}

static long
check_supexec (void)
{
	return Supexec (getsyshdr);
}

static long
check_super (void)
{
	long oldsp = Super (NULL);
	long r;
	
	r = getsyshdr ();
	Super ((void *)oldsp);
	
	return r;
}


int main (int argc, char **argv)
{
	long l;

	fprintf (stderr, "running as user %d\n", (int) Pgetuid());

	Psignal (15, term_handler);

	if (argc == 2 && 0 == strcmp (argv[1], "super"))
		l = check_super ();
	else
		l = check_supexec ();

	fprintf (stderr, "syshdr @ %p\n", l);

	return 0;
}

It would also be nice if a "punished" program would at least get a
chance
to recover through SIGTERM...


Regards, jr