by chasil · 5y ago · 0 comments
My bet is that OpenBSD's X server has a far better security design, as the server itself no longer runs as root. The aggressive free() also exposed use-after-free bugs never before seen, and OpenBSD has superior mitigations for rop gadget abuse, aslr everywhere, and other exploits beyond the imagination of 1989.
The paper documents problems of Ada, particularly in linking to C (where the use of void * pointer casts was particularly difficult for Ada's type system), and that the Ada implementation had nearly double the lines of code as the C reference.
In the days of 1989, the fastest CPUs were under 100MHz. It is unlikely that any of this code could be salvaged for a modern server, but the accomplishment is interesting.
I'll point out to others in the audience: this is largely an artifact of Ada syntax being more verbose, and Ada programming practice favouring longer and more explanatory identifiers compared to C (where a lot of code looks like line noise). For example, see this post and compare the size of the C code vs. the equivalent Ada code:
I was going to say that as well. I only more recently hopped on the train, but I didn't see anything which would be problematic for Ada 2012. I've had no problems in my projects doing bit manipulation, using function pointers, dynamic dispatch, or interfacing with C code which uses `void*`.
> this is largely an artifact of Ada syntax being more verbose
There's a very negative connotation of "verbose" like it's the worst thing in the world. The better way of describing this is the language is explicit and focuses on describing intent. This means it doesn't take long to learn to read and understand standard library code or code from other projects.
I agree that it's good. But it's objectively longer, which is what I meant.
If you think Ada is actually verbose check out the Ada++ comparisons with other major languages like C++ and Java.
I'm presuming this is real (908MB would take a tad too long to download today), but if it isn't, that's definitely up there in terms of execution. I completely believe it.
Edit: Oh.
The code could easily be converted to later Ada versions and use C.Pointers where necessary (triple pointers), but void * are easy enough to handle now with an access to null record with convention => C.
# cat /etc/redhat-release; ps aux | grep X\ :0 | grep -v grep
Red Hat Enterprise Linux Server release 7.9 (Maipo)
root 2114 0.0 0.1 380804 33900 tty1 Ssl+ Aug03 0:51 /usr/bin/X :0 -background none
CentOS 8 does appear to run without root. Maybe someday I can use it in production. # cat /etc/redhat-release; ps aux | grep Xorg | grep -v grep
Red Hat Enterprise Linux release 8.4 (Ootpa)
gdm 1967 0.0 0.0 1586600 21436 tty1 Sl+ Jan13 2:38 /usr/libexec/Xorg vt1
I was not aware that this had happened.What do you mean by that? Is there an overview somewhere about "aggressive free()" that I can read?
https://www.openbsd.org/papers/eurobsdcon2009/otto-malloc.pd...
https://undeadly.org/cgi?action=article;sid=20090106070242
https://news.ycombinator.com/item?id=3286254
https://web.archive.org/web/20111231094521/http://os-blog.co...
General architecture: https://utcc.utoronto.ca/~cks/space/blog/unix/SbrkVersusMmap
OpenBSD altered malloc/free to use mmap instead of sbrk.
This allowed free to remove larger allocations from the address space, which caught a lot of programs that were using memory after free.
The author is @Java4First on Twitter. Give it a shot.