xref: /netbsd-src/doc/roadmaps/mess (revision 07710e15fb33a36070f1999aa95fc743c3df6dec)
1*07710e15Sdholland$NetBSD: mess,v 1.2 2017/01/14 20:50:15 dholland Exp $
2298a4bfaSdholland
3298a4bfaSdhollandNetBSD Messes and Tentacular Horrors Roadmap
4298a4bfaSdholland============================================
5298a4bfaSdholland
6298a4bfaSdhollandThere are a number of places in NetBSD where the code is substandard,
7298a4bfaSdhollandor messy, or badly structured, or just excessively complicated. These
8298a4bfaSdhollandare liabilities. Fixing them is a goal, not just because they
9298a4bfaSdhollandthemselves cause problems but because every pile of glop in the system
10298a4bfaSdhollandfunctions as an implicit excuse to not clean up others.
11298a4bfaSdholland
12298a4bfaSdhollandThere are two kinds of these messes: with some, the consequences are
13298a4bfaSdhollandrelatively localized, and while dealing with that particular area of
14298a4bfaSdhollandthe code may be nasty the issues are otherwise mostly not visible.
15298a4bfaSdhollandWith others, the horror spreads and contaminates everything that comes
16298a4bfaSdhollandnear it. The latter are particularly important to clean out.
17298a4bfaSdholland
18298a4bfaSdhollandThe things listed here are listed here because they have been cited as
19298a4bfaSdhollandproblems; some of these are regularly cited as problems. The goal of
20298a4bfaSdhollandthis file is not to criticize the code or point fingers (some of these
21298a4bfaSdhollandmesses come down to us all the way from 4.3 and are the result of
22298a4bfaSdhollandalways patching and never fixing; but some of them have been
23298a4bfaSdhollandself-inflicted because they seemed like a good idea at the time, or
24298a4bfaSdhollandthey were what we had, or whatever) but to document areas that could
25298a4bfaSdhollanduse a good rototill or two.
26298a4bfaSdholland
27298a4bfaSdhollandThese are listed in a perceived order of priority based on how bad the
28298a4bfaSdhollandmess is, how toxic it is to things around it, how much it's
29298a4bfaSdhollandinterfering with other development, and how unreliable the affected
30298a4bfaSdhollandcode is as a result.
31298a4bfaSdholland
32298a4bfaSdholland 1. namei, ufs_lookup, vfs_rename
33298a4bfaSdholland 2. buffercache
34298a4bfaSdholland 3. network interfaces
35298a4bfaSdholland 4. mbufs
36298a4bfaSdholland 5. tty code
37298a4bfaSdholland 6. nsswitch code in libc
38298a4bfaSdholland 7. proplib
39298a4bfaSdholland 8. kauth
40298a4bfaSdholland 9. sysmon_envsys
41298a4bfaSdholland 10. atf
42298a4bfaSdholland 11. pam
43298a4bfaSdholland
44298a4bfaSdholland
45298a4bfaSdhollandExplanations
46298a4bfaSdholland============
47298a4bfaSdholland
48298a4bfaSdholland
49298a4bfaSdholland1. namei, ufs_lookup, vfs_rename
50298a4bfaSdholland
51298a4bfaSdhollandnamei is central to everything and it's been horrible since at least
52298a4bfaSdholland4.3 and maybe longer. A fair amount of work has been put into it, and
53298a4bfaSdhollanda number of the particular horrors have been eliminated, but there's
54298a4bfaSdhollandstill quite a bit left to do.
55298a4bfaSdholland
56298a4bfaSdhollandThe immediate next step is to introduce VOP_PARSEPATH (a new VOP call
57298a4bfaSdhollandto allow the two filesystems we have that consume more than one
58298a4bfaSdhollanddirectory component at a time to do so in a more tractable way) and
59298a4bfaSdhollandthen it's time to start implementing namei_parent, a version that
60298a4bfaSdhollandstops at the parent with one component name left to go. This will
61298a4bfaSdhollandallow a much saner interface to directory ops, including rename, and
62298a4bfaSdhollandonce those are done a lot of the complexity currently in namei and in
63298a4bfaSdhollandthe VOP_LOOKUP interface can be removed.
64298a4bfaSdholland
65298a4bfaSdholland - dholland is working on this intermittently.
66298a4bfaSdholland - VOP_PARSEPATH is ready to commit and is expected to make 8.0.
67298a4bfaSdholland   There is currently no clear timeframe for anything beyond that.
68298a4bfaSdholland - Responsible: dholland
69298a4bfaSdholland
70298a4bfaSdholland
71298a4bfaSdholland2. buffercache
72298a4bfaSdholland
73298a4bfaSdhollandThe buffercache code is messy and full of flag words that filesystems
74298a4bfaSdhollandmuck with freely and not necessarily with correct locking. It is
75298a4bfaSdhollandsuspected that there is a lot of incorrect locking. Also, a lot of the
76298a4bfaSdhollandnaming and terminology (things like BO_DELWRI) is really ancient and
77298a4bfaSdhollandreflects non-current assumptions about the way file system buffers
78298a4bfaSdhollandshould work.
79298a4bfaSdholland
80*07710e15SdhollandThe first step on this is to disentangle the buffer cache
81*07710e15Sdholland(buffercache(9)) from the buffer I/O path (bufferio(9)) -- right now
82*07710e15Sdhollandthey both abusively share the same struct buf.
83*07710e15Sdholland
84298a4bfaSdholland - As of January 2017 nobody is currently working on this.
85298a4bfaSdholland - There is currently no clear timeframe or release target.
86298a4bfaSdholland - Contact dholland for further information.
87298a4bfaSdholland
88298a4bfaSdholland
89298a4bfaSdholland3. network interfaces
90298a4bfaSdholland
91298a4bfaSdhollandThe network interface structure and its associated support code has no
92298a4bfaSdhollandabstraction, no encapsulation, and no safety. It badly needs
93298a4bfaSdhollandrationalization.
94298a4bfaSdholland
95298a4bfaSdholland - As of January 2017 nobody is currently working on this directly,
96298a4bfaSdholland   though some aspects fall under the multiprocessor network stack
97298a4bfaSdholland   project.
98298a4bfaSdholland - There is currently no clear timeframe or release target.
99298a4bfaSdholland - Contact rmind for further information.
100298a4bfaSdholland
101298a4bfaSdholland
102298a4bfaSdholland4. mbufs
103298a4bfaSdholland
104298a4bfaSdhollandThe mbuf code has some concept of an interface, but lots of the code
105298a4bfaSdhollandmanipulating mbufs doesn't use that interface, and there's still no
106298a4bfaSdhollandencapsulation and no safety.
107298a4bfaSdholland
108298a4bfaSdholland - As of January 2017 nobody is currently working on this directly,
109298a4bfaSdholland   though some aspects fall under the multiprocessor network stack
110298a4bfaSdholland   project.
111298a4bfaSdholland - There is currently no clear timeframe or release target.
112298a4bfaSdholland - Contact rmind or dholland for further information.
113298a4bfaSdholland
114298a4bfaSdholland
115298a4bfaSdholland5. tty code
116298a4bfaSdholland
117298a4bfaSdhollandThe tty subsystem has no concept of an interface at all, and there are
118298a4bfaSdhollandlarge wodges of code cutpasted all over everywhere in gazillions of
119298a4bfaSdhollandtty client drivers. There's no encapsulation either and absolutely no
120298a4bfaSdhollandsafety. Furthermore the locking model is bodgy.
121298a4bfaSdholland
122298a4bfaSdhollandIn addition to this the division of responsibility between "tty" and
123298a4bfaSdholland"serial port" is wrong. There are a number of drivers (e.g. for mice)
124298a4bfaSdhollandthat are partially ttys because they're things that are more or less
125298a4bfaSdhollandserial ports, but they were never meant to be used for logins and
126298a4bfaSdhollandcan't be. These should be disentangled from the tty layer.
127298a4bfaSdholland
128298a4bfaSdhollandFinally, the notion of line disciplines is a legacy mess that ought to
129298a4bfaSdhollandget turned into a system of device attachments - a line discipline is
130298a4bfaSdhollanda driver attached on top of the line, except that the concept appeared
131298a4bfaSdhollandlong before anyone really thought up device attachments as we know
132298a4bfaSdhollandthem now.
133298a4bfaSdholland
134298a4bfaSdholland - As of January 2017 nobody is currently working on this.
135298a4bfaSdholland - There is currently no clear timeframe or release target.
136298a4bfaSdholland - Contact dholland for further information.
137298a4bfaSdholland
138298a4bfaSdholland
139298a4bfaSdholland6. nsswitch code in libc
140298a4bfaSdholland
141298a4bfaSdhollandThe nsswitch code in libc is not all that bad in the sense of being
142298a4bfaSdhollandhorrible code you lose sanity points to look at, but it's structured
143298a4bfaSdhollandall wrong. It can't be cleaned up without doing a libc bump, which is
144298a4bfaSdhollanda big deal, but if we do ever manage to get that libc bump done it's
145298a4bfaSdhollandimportant that the nsswitch code get revised then.
146298a4bfaSdholland
147298a4bfaSdholland - As of January 2017 nobody is currently working on this.
148298a4bfaSdholland - There is currently no clear timeframe or release target.
149298a4bfaSdholland - Contact dholland or joerg for further information.
150298a4bfaSdholland
151298a4bfaSdholland
152298a4bfaSdholland7. proplib
153298a4bfaSdholland
154298a4bfaSdhollandRemoval of proplib is and has been a goal of several developers for
155298a4bfaSdhollandsome time, but there's not been any consensus on a replacement. Much
156298a4bfaSdhollandhas been written on this elsewhere so I'm not going to repeat it all
157298a4bfaSdhollandhere.
158298a4bfaSdholland
159298a4bfaSdholland - As of January 2017 nobody is currently working on this, but several
160298a4bfaSdholland   partly-finished proplib replacement candidates exist.
161298a4bfaSdholland - There is currently no clear timeframe or release target.
162298a4bfaSdholland - Contact dholland, rmind, riastradh, or any of a number of other
163298a4bfaSdholland   people for further information.
164298a4bfaSdholland
165298a4bfaSdholland
166298a4bfaSdholland8. kauth
167298a4bfaSdholland
168298a4bfaSdhollandkauth is far too complicated for security code and its API is full of
169298a4bfaSdhollandvoid pointers and horribly unsafe. There is no consensus on what to do
170298a4bfaSdhollandabout it, though. Part of the problem is that kauth itself is at least
171298a4bfaSdhollandthree different things that need to be disentangled: (a) an API for
172298a4bfaSdhollandrandom kernel code to issue security checks; (b) an implementation of
173298a4bfaSdhollandsecurity check logic; and (c) an extensibility framework for that
174298a4bfaSdhollandsecurity check logic.
175298a4bfaSdholland
176298a4bfaSdholland - As of January 2017 nobody is currently working on this.
177298a4bfaSdholland - There is currently no clear timeframe or release target.
178298a4bfaSdholland - Contact dholland for further information.
179298a4bfaSdholland
180298a4bfaSdholland
181298a4bfaSdholland9. sysmon_envsys
182298a4bfaSdholland
183298a4bfaSdhollandsysmon_envsys is also too complicated. XXX: someone fill in more here
184298a4bfaSdhollandplease.
185298a4bfaSdholland
186298a4bfaSdholland - As of January 2017 nobody is currently working on this.
187298a4bfaSdholland - There is currently no clear timeframe or release target.
188298a4bfaSdholland - Contact: ? (XXX)
189298a4bfaSdholland
190298a4bfaSdholland
191298a4bfaSdholland10. atf
192298a4bfaSdholland
193298a4bfaSdhollandatf is horribly complicated and very expensive (apparently it takes
194298a4bfaSdhollandall day to compile just atf on an sgimips) and doesn't provide a whole
195298a4bfaSdhollandlot of bang for the buck. It is also frequently cited as an impediment
196298a4bfaSdhollandto getting new tests written and deployed. It is not at all clear what
197298a4bfaSdhollandto do about it.
198298a4bfaSdholland
199298a4bfaSdholland - As of January 2017 nobody is currently working on this.
200298a4bfaSdholland - There is currently no clear timeframe or release target.
201298a4bfaSdholland - Contact: ? (XXX)
202298a4bfaSdholland
203298a4bfaSdholland
204298a4bfaSdholland11. pam
205298a4bfaSdholland
206298a4bfaSdhollandpam, though a more or less standard API/interface, has a range of
207298a4bfaSdhollandproblems, one being that after the manner of sysvinit it works by
208298a4bfaSdhollandexposing a mechanism and you configure it by mucking with the
209298a4bfaSdhollandmechanism until it produces the behavior you want. (Except that if you
210298a4bfaSdhollandmuck with its mechanism, you end up locking yourself out.) In practice
211298a4bfaSdhollandediting pam configs seems to be limited to specialists, and that's
212298a4bfaSdhollandreally not suitable for security software.
213298a4bfaSdholland
214298a4bfaSdhollandIt is very unclear what to do about it though. It's a standard API and
215298a4bfaSdhollandthere are a number of 3rd-party pam modules, some of which people need
216298a4bfaSdhollandto be able to use. Once upon a time there was a similar thing called
217298a4bfaSdhollandbsdauth, but it never really seems to have been a credible alternative.
218298a4bfaSdhollandProbably the right thing to do is to completely redesign
219298a4bfaSdhollandhow logging in works, but that's a Big Deal.
220298a4bfaSdholland
221298a4bfaSdholland - As of January 2017 nobody is currently working on this.
222298a4bfaSdholland - There is currently no clear timeframe or release target.
223298a4bfaSdholland - Contact: ? (XXX)
224