From owner-freebsd-hackers Sat Feb 16 17:56:29 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by hub.freebsd.org (Postfix) with ESMTP id 48F3437B417 for ; Sat, 16 Feb 2002 17:56:26 -0800 (PST) Received: from pool0237.cvx21-bradley.dialup.earthlink.net ([209.179.192.237] helo=mindspring.com) by hawk.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 16cGYy-0003Y6-00; Sat, 16 Feb 2002 17:56:24 -0800 Message-ID: <3C6F0DBE.8C5C8718@mindspring.com> Date: Sat, 16 Feb 2002 17:56:14 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Kris Kennaway Cc: hackers@FreeBSD.org Subject: Re: Module versioning and linux.ko References: <20020216154043.A44137@xor.obsecurity.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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