Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Feb 2002 17:56:14 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        hackers@FreeBSD.org
Subject:   Re: Module versioning and linux.ko
Message-ID:  <3C6F0DBE.8C5C8718@mindspring.com>
References:  <20020216154043.A44137@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Kris Kennaway wrote:
> Is there anything which can be done in -stable to prevent new kernels
> from accepting old linux.ko modules?  At some point in the past 3
> months something changed in the kernel causing the old module to panic
> at runtime in elf_linux_fixup().  Yes, people should be upgrading
> their old modules when they upgrade the kernel, but it's an obvious
> source of confusion if you forget or don't realise you're actually
> using the module.

Not in -stable, unless you are willing to change interfaces.

The proper place to do interface versioning is in the
interface, not in the consumer of the interface.  For
each interface, you end up with:

#define API_VERSION_FOO	0x00000001

struct api_foo {	/* interface foo*/
	int	version;
	int	(*fooA)(int i, char *p);
	int	(*fooB)(char *p);
};

int	api_use_foo( struct api_foo *);

...

static struct api_foo linux_api_foo = { API_VERSION_FOO };

int
linux_abi_init(...)
{
	...
	if( api_use_foo( &linux_api_foo)) {
		printf( "linux_abi_init: can't register\n");
		return( -1);
	}

	...
}

int
linux_syscall_fooA( int i, char *p)
{
	char	*p2;
	int	rv;
	...
	p2 = linux_convert_p( p);

	rv = (*linux_api_foo.fooA)(int i, char *p2);

	... /* other stuff*/

	rv = linux_convert_result( rv);

	return( rv);
}

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C6F0DBE.8C5C8718>