I think the symbol export system in general is a bad thing for Linux. People are removing exports to save memory and restrict access. It breaks drivers all the time. I had to use a driver in the kernel tree, which didn't work because it missed a symbol. Somebody had tried to be too smart about putting #ifdef's around EXPORT_SYMBOL to save a few exports. Trying to restrict access like that only gives a lot of pain and in the end very little gain. I worked with VxWorks in an earlier job. It exported _every_ global symbol. There where no administrative issues associatated with putting in EXPORT statements. Why can't Linux just do the same? There are 3 reasons, for all I can find a counter argument: 1) Memory. Storing symbols take a lot of memory. Solution: Let the symbols be stored in swapable memory, for instance by moving the linking of modules of to a user-space deamon, which keeps track of what is loaded and where. In embedded systems that wouldn't help much, but there I believe you shouldn't use modules anyway. And even in VxWorks running on a very memory constrained system, we didn't have problems before we started to use advanced C++ templates auto-generating a lot of very long symbols. Linux wouldn't have that problem as there is no C++ in the kernel. 2) Restrict access for non-GPL symbols. This is legally nonsense. The end user are allowed to load whatever into his kernel as long as he doesn't distribute the result. It is not within the spirit of free software to block him from doing that. On the other hand, nobody can distribute Linux along with non-GPL'ed modules as that is against GPL. EXPORT_SYMBOL/EXPORT_SYMBOL_GPL doesn't change any of that. 3) Trying to mark some interfaces as more stable than others by exporting those and not the others. Either you make a stable driver API or you don't. Having a stable driver API wouldn't allow non-GPL drivers anyway and is therefore not needed as the GPL'ed drivers should put into the kernel tree once they are stable. Make it possible to run drivers in user-space instead. In general I don't think you should try to block people from using anything. It is against the spirit of free software. On the contrary you should help people as much as possible. Therefore almost all symbols should be accessible but of course you can try to help the coder writing drivers, within or outside the kernel tree, choose the right symbols, by for instance sorting the declarations in public and private header files.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds