tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposal: Disable autoload of compat_xyz modules



As you said, this argument also works the other way around: it is good to
have compat-specific code under sys/compat, and not randomly spread around
the tree.

In case you didn't notice, compat/linux/arch is already full of arch-
specific code that plays with trap frames, which by definition are tied to
the specific platform. So it's not like I'm introducing a new concept.

Given Taylor's proposal, I believe it is more important to have the compat
code together: in a modularised approach, we will certainly want all of the
linux code under compat/linux, to improve readability and maintainability.
It also has the advantage of forcing the removal of the #ifdefs in the
arch-specific code.

Typically, the situation I want to avoid is this [1], where you had some
random compat code next to critical native procedures. Note also that the
recent callgate vulnerability in amd64 wouldn't have existed, had the
separation between native and compat code been stark.

Maxime

[1] http://mail-index.netbsd.org/source-changes/2017/07/29/msg086828.html



Le 01/08/2017 à 18:34, Jaromír Doleček a écrit :
I like that all the arch-specific code is under sys/arch, and not randomly spread around tree, i.e. I prefer to keep the compat things under sys/arch.

For sure, same argument could be used the opposite direction, that it would be neater to have all the compat code together.

But IMO the arch-specific bits are more tied to the specific platform, so it makes sense to have them together with their native counterparts - like e.g. signal trampoline code.

Jaromir

2017-08-01 13:12 GMT+02:00 Maxime Villard <max%m00nbsd.net@localhost <mailto:max%m00nbsd.net@localhost>>:
 > Yes, that's the right thing to do.
 >
 > I haven't rechecked, but as far as I remember, there will be some issues with
 > the compat layers that have several #ifdefs deep into the machdep code.
 >
 > Apart from that, several files could usefully be moved into the appropriate
 > compat_xyz directory, instead of polluting sys/arch/. For example:
 >
 >         sys/arch/amd64/amd64/linux_*    ->   sys/compat/linux/arch/amd64/
 >         sys/arch/amd64/amd64/linux32_*  ->   sys/compat/linux32/arch/amd64/
 >
 > This would provide a better encapsulation.


Home | Main Index | Thread Index | Old Index