Re: libgtop porting advice



Maciej Stachowiak <mstachow@viewlogic.com> writes:

> I am planning to port relative to the current CVS sources anyway.
> If my port gets done in time for 1.0, I would be happy if you included
> it but I don't think it will be stable enough to fairly do it by then.

Even better to do it in CVS ...

We have 10 days left until GNOME 1.0.

That means I have to release LibGTop on the 9th day.

> I do have one other question. Solaris (and for that matter SunOS) systems
> are notorious for changing the in-kernel structures that are of
> interest to top-like programs with more or less every minor OS revision,
> between different machine architectures, and between uniprocessor
> and multiprocessor kernels. Would it be a better approach to make a 
> compiled libgtop work only on the specific version it was compiled for, 
> or should I make an effort to provide multiple routines for different
> versions of the OS and hardware and select the appropriate one at runtime?
> The latter approach will be much harder as I will have to create my own
> header files describing the kernel layout for each architecture. It will
> also probably limit libgtop functionality to version/hardware combinations
> I personally have access to, or that other people can test on and contribute
> code for.

Good question and really a problem.

Well, the FreeBSD port was originally written by Josh Sled for FreeBSD 2.2
and I added #ifdefs for FreeBSD 3.0 and Open/NetBSD at a later time.

I don't know whether a libgtop binary that was compiled on FreeBSD 2.2
runs on FreeBSD 3.0, but I guess it does not. Oh, really good point!

However, I think for all suid/sgid systems (and thus every system except
Linux) we should make libgtop abort if someone tries to run it on an
other system than the one it was compiled on.

If we don't do this there may even be security exploits if the kernel
structures change in a future os version (and the server returns random
values from kernel address space).

For the moment it should be enough to have a port for the Solaris version
you are doing the port on. People can then at a later time use #ifdefs
to make it work on other os versions as well or - if the changes are
large - even create a totally new sysdeps directory for it.

-- 
Martin Baulig - martin@home-of-linux.org - http://www.home-of-linux.org



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