[OpenAFS-devel] Solaris afs.rc file damage

Dean Anderson dean@av8.com
Wed, 9 May 2007 19:54:44 -0400 (EDT)


On Wed, 9 May 2007, Russ Allbery wrote:

> Dean Anderson <dean@av8.com> writes:
> 
> > Then the Linux kernel has indeed made system calls not dynamically
> > loadable. This is a disappointing, but not unexpected event.  I think
> > this event should at least motivate some thought to create a patch
> > system similar to netfilter, that patches the kernel source according to
> > the kernel version. Or at least instructions on how to add the AFS
> > kernel code as a staticly linked module on linux. I don't think this is
> > hard.  Netfilter does it and all sorts of non-kernel developers build
> > patched kernels for netfilter updates.
> 
> Mostly, I think you're now on the right page.  However, there's still one
> error here.  Statically linking OpenAFS does nothing to give us a system
> call.

I think I understand your confusion. When I say 'static linking', I
don't mean adding -static to the linker. I mean the procedure of adding
an object file to the kernel by: 1) patching source code to add symbols
to the system call table source code, and 2) adding a Makefile that will
2a) compile the object files during the kernel build, and that will 2b)
cause the object file to be added to the link step of vmlinux.

> In order to add a system call in the regular, supported way, you have to
> *patch the kernel*.  

Exactly.

> If you patch the kernel to add the system call, you can then build
> OpenAFS dynamically and works fine.  

Uh, I think not. If you add a symbol to the system call table by
patching source code, you will need to add the necessary object files
that define the symbol to the link step of the kernel.  If you don't,
the kernel will have unresolved symbol errors.  Once you link the
objects to the kernel, the AFS kernel objects are then physically
located in the vmlinux binary.  No further dynamic loading is needed.

If you mean to patch the system call table so that there is an unused
entry, this also won't work, because, as you said, the system call table
is in read only memory and can't be modified while running.

A possibility is to add an staticly loaded (as above) AFS trampoline
that can be modified to jump to the address of the dynamically loaded
entry. This could be useful because the guts of AFS is still dynamically
loaded. But you have to make sure that it doesn't crash when AFS isn't
loaded.

		--Dean



-- 
Av8 Internet   Prepared to pay a premium for better service?
www.av8.net         faster, more reliable, better service
617 344 9000