Hacker News new | past | comments | ask | show | jobs | submit login
Writing Assembly on OpenBSD (x86) (2012) (archive.org)
38 points by mulander on Jan 25, 2016 | hide | past | web | favorite | 5 comments

What I'm curious about is whether there's a good writeup of what you need to do to handle the (presumably) ASLR that OpenBSD has.

I've been having a hell of a time figuring out what's going on when I try to port Myrddin -- the code I generate will often segfault, on a string that GDB seems to think is perfectly valid, and happily prints. Some of the strings have clearly wonky addresses, (eg, within the zero page), others don't look insane.

Not related to your comment, but...

Thanks for Myrddin! It's a very promising language! Well designed and using the right tools.

People of #cat-v showed it to me and since then I look forward to play with it!

What is the purpose of the .note section? If it is left out, it appears from ktrace that the kernel assumes the binary uses some other ABI, e.g., Linux, etc. (compat_linux, etc.) and the /emul shadow directory gets searched.

From the document: "OpenBSD native executables usually contain a .note.openbsd.ident section to identify themselves, for the kernel to bypass any compatibility ELF binary emulation tests when loading the file"

OpenBSD is a great platform to find those bugs in your asm/c. Segfaults that would not happen on Linux. (e.g. closing a file before exit that you never opened). http://nixdoc.net/man-pages/OpenBSD/malloc.conf.5.html is also another great place to tweak memory allocation behaviors to find those application corner cases that break.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact