NetBSD Problem Report #51597

From paul@whooppee.com  Thu Nov  3 21:30:45 2016
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 071037A26F
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  3 Nov 2016 21:30:45 +0000 (UTC)
Message-Id: <20161103213012.1D78F16E60@speedy.whooppee.com>
Date: Fri,  4 Nov 2016 05:30:12 +0800 (PHT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: Networking compat stuff is not fully modular
X-Send-Pr-Version: 3.95

>Number:         51597
>Category:       kern
>Synopsis:       Network stuff is not fully modular
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pgoyette
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 03 21:35:00 +0000 2016
>Closed-Date:    Tue Jan 29 11:56:24 +0000 2019
>Last-Modified:  Tue Jan 29 11:56:24 +0000 2019
>Originator:     Paul Goyette
>Release:        NetBSD 7.99.36
>Organization:
+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
>Environment:


System: NetBSD speedy.whooppee.com 7.99.36 NetBSD 7.99.36 (SPEEDY 2016-09-09 11:36:24) #0: Fri Sep 9 20:18:34 PHT 2016 paul@speedy.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
Some of the version-specific network changes are properly included in
the compat module - for example older ioctls are handled within
sys/compat/common/if_43.c

However, there are other parts of the network code that have not been
fully modularized.  For example, the sysctl() code in sys/net/rtsock.c,
even though it is properly conditionalized on the appropriate kernel
version using COMPAT_xx, will never be included in the separately-loaded
module.

This doesn't affect most people, since most people either use a standard
GENERIC kernel, or build their own with all modular code included as
built-in modules.  However, for anyone who relies on being able to load
the module code on an as-needed basis, the current code doesn't work.

>How-To-Repeat:
For one specific example, try to boot a NetBSD 7.99.42 kernel that does
NOT include COMPAT_70 in its configuration.  Once booted, load the
compat module using modload(8) and then try to execute an ifconfig(8)
image from 7.99.36.  ifconfig will fail to retrieve the interface list
because neither the kernel nor the module contains the OIFREQ sysctl(8)
code necessary.

>Fix:
Properly modularize the sys/net/rtsock.c code and include the version-
specific code in the compat module.


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Sat, 05 Nov 2016 02:42:01 +0000
Responsible-Changed-Why:
I'll give it a try.  It's likely mine anyway, since it involves modularization!


Responsible-Changed-From-To: pgoyette->kern-bug-people
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Sat, 05 Nov 2016 07:58:21 +0000
Responsible-Changed-Why:
Beyond my knowledge


From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51597: Networking compat stuff is not fully modular
Date: Sat, 5 Nov 2016 15:56:45 +0800 (PHT)

 Hmmm, taking a quick look at this, sys/net/rtsock.c is truly "spaghetti 
 code".  Some of the options actually #undefine some of the COMPAT_xx 
 version options, and I'm really unable to see a path forward here.

 We'll need someone who is familiar with this code to actually clean it 
 up and separate it into code which can be either built-in to the kernel 
 or loaded via a non-built-in module (in which case it needs to augment 
 the "native/current" code.  At the very least, the sysctl_iflist stuff 
 needs to be functional when the compat module is loaded.

 For now, I'm going to reassign this back to the "role" account, where 
 hopefully someone knowledgeable in the routing socket can pick it up.


 +------------------+--------------------------+------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
 +------------------+--------------------------+------------------------+

From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51597: Networking compat stuff is not fully modular
Date: Thu, 17 Jan 2019 16:21:44 +0800 (PST)

 This will be addressed soon, when the pgoyette-compat branch is merged
 into mainline.


 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Tue, 29 Jan 2019 11:56:24 +0000
Responsible-Changed-Why:
Take


State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Tue, 29 Jan 2019 11:56:24 +0000
State-Changed-Why:
Fixed with merge of [pgoyette-compat] branch


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.