<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>No Content, No Fuss: Category openbsd</title>
    <link>http://anil.recoil.org/blog/articles/category/openbsd</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Anil Madhavapeddy</description>
    <item>
      <title>OpenBSD/Xen boots multi-user</title>
      <description>&lt;p&gt;I've been mentoring a few Xen projects as part of the &lt;a href="http://code.google.com/soc/"&gt;Google Summer of Code&lt;/a&gt; program.  One of the most fun is the &lt;a href="http://www.xensource.com/summerofcode.html#7"&gt;OpenBSD/Xen porting effort&lt;/a&gt; which Christoph Egger has been hacking on.   As of a few days ago, if you clone the &lt;a href="http://selenic.com/mercurial"&gt;Mercurial&lt;/a&gt; repository for the project, &lt;a href="http://hg.recoil.org/openbsd-xen-sys.hg"&gt;openbsd-xen-sys.hg&lt;/a&gt;, and build the kernel with with the i386 bsd.rd, you get the thrill of the following boot log:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[avsm@kremlin ~]$ sudo xm create -c openbsd
Using config file "/etc/xen/openbsd".
Started domain OpenBSD
[ using 187532 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2006 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 4.0-beta (RAMDISK_XENU) #0: Mon Aug 21 14:59:09 BST 2006
    root@mortar.cl.cam.ac.uk:/usr/src/sys/arch/xen/compile/ RAMDISK_XENU
cpu0: Genuine Intel(R) CPU 3.00GHz ("GenuineIntel" 686-class) 3 GHz
cpu0: FPU,V86,DE,TSC,MSR,PAE,MCE,CX8,APIC,MCA,CMOV,
    PAT,PSE36,CFLUSH,ACPI,MMX,SSE,SSE2,SS,HTT,TM,SBF,PNI,
    EST,CNXT-ID
cpu0: EST: unknown system bus clock
real mem  = 62554112 (61088K)
avail mem = 55603200 (54300K)
using 789 buffers containing 3231744 bytes (3156K) of memory
mainbus0 (root)
cpu0 at mainbus0
hypervisor0 at mainbus0
debug virtual interrupt using event channel 3
xenbus0 at hypervisor0: Xen Virtual Bus Interface
xencons0 at hypervisor0: Xen Virtual Console Driver
xencons0: console major 86, unit 0
xencons0: using event channel 2
npx0 at hypervisor0: using exception 16
Xen clock: using event channel 4
rd0: fixed, 3800 blocks
xenbus0: using event channel 1
xennet0 at xenbus0 id 0: Xen Virtual Network Interface
xennet0: MAC address 00:16:3e:05:83:11
xennet0: using event channel 5
root on rd0a
rootdev=0x1100 rrootdev=0x2f00 rawdev=0x2f02
erase ^?, werase ^W, kill ^U, intr ^C, status ^T
(I)nstall, (U)pgrade or (S)hell?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Christoph has done a superb job of porting the &lt;a href="http://www.netbsd.org/Ports/xen"&gt;NetBSD/Xen&lt;/a&gt; code over to OpenBSD.  There are still a few bugs to be worked out in the networking driver, the virtual block driver to finish up, and the rather more messy job of getting the user-land tools to run if we want an OpenBSD dom0.  But this initial booting is fantastic to see!&lt;/p&gt;&lt;p&gt;A final nice teaser from the console shell:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ifconfig -a
lo0: flags=8008&amp;lt;LOOPBACK,MULTICAST&amp;gt; mtu 33224
        groups: lo
pflog0: flags=0&amp;lt;&amp;gt; mtu 33224
pfsync0: flags=0&amp;lt;&amp;gt; mtu 1460
        groups: carp
enc0: flags=0&amp;lt;&amp;gt; mtu 1536
xennet0: flags=8822&amp;lt;BROADCAST,NOTRAILERS,SIMPLEX,MULTICAST&amp;gt; mtu 1500
        lladdr 00:16:3e:05:83:11
        media: Ethernet autoselect (autoselect)
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Mon, 21 Aug 2006 18:08:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:a23ff0fc-bc29-4045-a76f-0fc183c5c848</guid>
      <author>anil@recoil.org (Anil Madhavapeddy)</author>
      <link>http://anil.recoil.org/blog/articles/2006/08/21/openbsd-xen-boots-multi-user</link>
      <category>openbsd</category>
      <category>xen</category>
      <trackback:ping>http://anil.recoil.org/blog/articles/trackback/92</trackback:ping>
    </item>
    <item>
      <title>C2K5 thoughts</title>
      <description>&lt;p&gt;
Finally had some time to get back from the OpenBSD hackathon and take stock of what I worked on.  It was pretty interesting one this year, as I went without having much idea of what to work on (unlike last year, when I had a mad backlog to catch up on).   Some stuff I did during the week included:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean up the &lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/src/usr.bin/ssh/atomicio.c"&gt;atomicio&lt;/a&gt; interface used in &lt;a href="http://www.openssh.com"&gt;OpenSSH&lt;/a&gt; and &lt;i&gt;&lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=nc"&gt;nc(1)&lt;/a&gt;&lt;/i&gt; to provide simpler semantics.  Error checking from read/write functions are a real headache in C, as the functions return &lt;tt&gt;-1&lt;/tt&gt; on error, which means a signed &lt;tt&gt;ssize_t&lt;/tt&gt; is returned.  However, they accept an unsigned value as the size of the buffer to process, which means they could potentially return a value outside the range of the return value.  This means you have to check if the return is &lt;tt&gt;-1&lt;/tt&gt;, which indicates an error, and otherwise cast to a &lt;tt&gt;size_t&lt;/tt&gt; to correctly get the buffer size back.  With the new atomicio, it always returns a &lt;tt&gt;size_t&lt;/tt&gt;, and returns &lt;tt&gt;0&lt;/tt&gt; to signal an error (with &lt;tt&gt;errno&lt;/tt&gt; containing the error, and &lt;tt&gt;EPIPE&lt;/tt&gt; being set for an &lt;tt&gt;EOF&lt;/tt&gt; condition).&lt;/li&gt;
&lt;li&gt;Start looking at the Bluetooth stack to get L2CAP and RFCOMM support.  We are half-way through un-netgraphing the FreeBSD stack and having a more traditional &lt;tt&gt;netbt&lt;/tt&gt; socket interface (much like &lt;tt&gt;netinet&lt;/tt&gt; or &lt;tt&gt;netinet6&lt;/tt&gt;) to Bluetooth.&lt;/li&gt;
&lt;li&gt;Use &lt;a href="http://cil.sf.net/"&gt;CIL&lt;/a&gt; to implement a few fun kernel source-&gt;source transforms.  &lt;tt&gt;&lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/ports/devel/cil/files/kerneltrace.ml"&gt;kerneltrace&lt;/a&gt;&lt;/tt&gt; just accepts a regular expression and inserts a &lt;tt&gt;printf&lt;/tt&gt; in the function prologue which outputs the function name and any arguments passed into it.  Had this idea when chatting with &lt;a href="http://www.monkey.org/~marius/"&gt;Marius&lt;/a&gt;, and it turned out to be very useful when trying to figure out dataflow in the Bluetooth stack (just compile with &lt;tt&gt;make CC="/usr/local/bin/cilly --dokerneltrace --trace-regexp='ubt|ng_blue'"&lt;/tt&gt;).
The second one was even simpler; &lt;tt&gt;&lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/ports/devel/cil/files/randomvars.ml"&gt;randomvars&lt;/a&gt;&lt;/tt&gt; assigns a non-zero value to every local variable in a function call to help track down uninitialized-local-variable bugs. Heres &lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/src/usr.bin/mg/search.c.diff?r1=1.15&amp;amp;r2=1.16"&gt;one&lt;/a&gt; Chad Loder found in &lt;i&gt;&lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=mg"&gt;mg(1)&lt;/a&gt;&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;Other random &lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=111689009724884&amp;amp;w=2"&gt;signed/unsigned cleanups&lt;/a&gt; in OpenSSH.  Boring but important I guess...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All in all, the hackathon re-motivated me to continue work on the OCaml-based daemons that &lt;a href="http://recoil.org/~djs/"&gt;Dave&lt;/a&gt; and I have been hacking on.  I don't want to be fixing random buffer or integer overflows  in an OpenBSD hackathon 5 years from now; we need to move on to more high-level issues.&lt;/p&gt;</description>
      <pubDate>Sat, 04 Jun 2005 16:14:18 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:bda198f9-42f3-42c8-8742-4ad90f30c8fd</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/06/04/c2k5-thoughts</link>
      <category>hacking</category>
      <category>openbsd</category>
    </item>
    <item>
      <title>OpenBSD Hackathon in Royal visit shocker!</title>
      <description>&lt;p&gt;The hackathon is drumming along nicely, with all kinds of &lt;a href="http://kerneltrap.org/node/5169"&gt;crazy diffs&lt;/a&gt; being committed.  However, all of us have been rather worried about the lack of Royal appreciation for the hard work put in by the OpenBSD development team.  Luckily, word of the hackathon has spread far and wide, and the photos below reveal exclusively how the Queen now endorses&lt;sup&gt;*&lt;/sup&gt; OpenBSD!&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;* "Endorsement" does not imply actual endorsement, but rather "passing within 100 metres of project".&lt;/sup&gt;&lt;/p&gt;

&lt;table width="90%" align="center"&gt;
&lt;tr&gt;
&lt;td class="bimg"&gt;&lt;a href="http://anil.recoil.org/gallery/2005/05/25/index.html#calgary-queen-2"&gt;&lt;img border="0" src="http://anil.recoil.org/gallery/images/calgary-queen-2-medium.jpg" alt="A Royal Steed" width="140" height="140" /&gt;&lt;/a&gt;&lt;br /&gt;A Royal Steed&lt;/td&gt;
&lt;td class="bimg"&gt;&lt;a href="http://anil.recoil.org/gallery/2005/05/25/index.html#calgary-queen-3"&gt;&lt;img border="0" src="http://anil.recoil.org/gallery/images/calgary-queen-3-medium.jpg" alt="The crowds gather excitedly" width="140" height="140" /&gt;&lt;/a&gt;&lt;br /&gt;The crowds gather excitedly&lt;/td&gt;
&lt;td class="bimg"&gt;&lt;a href="http://anil.recoil.org/gallery/2005/05/25/index.html#calgary-queen-5"&gt;&lt;img border="0" src="http://anil.recoil.org/gallery/images/calgary-queen-5-medium.jpg" alt="Yes!! That pixel is the Queen!!" width="140" height="140" /&gt;&lt;/a&gt;&lt;br /&gt;Yes!! That pixel is the Queen!!&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</description>
      <pubDate>Wed, 25 May 2005 23:58:19 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:d4677161-8fac-46e6-9581-efa32e5561fe</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/05/25/openbsd-hackathon-in-royal-visit-shocker</link>
      <category>openbsd</category>
    </item>
    <item>
      <title>mmap-based malloc on OpenBSD</title>
      <description>&lt;p&gt;&lt;a href="http://www.deval.be/"&gt;Thierry Deval&lt;/a&gt; has recently &lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=109134993612461&amp;amp;w=2"&gt;committed&lt;/a&gt; an impressive implementation of
&lt;a href="openbsd3"&gt;malloc&lt;/a&gt; that uses &lt;a href="openbsd2"&gt;mmap&lt;/a&gt;
instead of the older &lt;a href="openbsd2"&gt;sbrk&lt;/a&gt; to allocate memory in &lt;a href="http://www.openbsd.org/"&gt;OpenBSD&lt;/a&gt;.
The advantage of the new approach is that it allows all the neat randomization
features that have been added to OpenBSD recently to happen transparently in malloc
(so that you don't just get consecutive pages back as in most operating systems).
The downside is a slight slowdown, but in this age of insane CPUs, who cares?
&lt;/p&gt;

&lt;p&gt;It has had the side-effect of exposing a number of latent bugs in programs which
silently access memory locations larger than the area they malloced; I
&lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=109199309502349&amp;amp;w=2"&gt;fixed&lt;/a&gt; one
which had remained lurking in my gcc bounds checker (see &lt;a href="openbsd1"&gt;gcc-local&lt;/a&gt;) for over a year, and
other bugs have cropped up in programs as important as &lt;a href="openbsd8"&gt;newfs&lt;/a&gt;.  Until someone
goes through the pain of porting the awesome &lt;a href="http://valgrind.kde.org/"&gt;Valgrind&lt;/a&gt; to
OpenBSD, being able to expose more bugs this way is pretty useful.
&lt;/p&gt;</description>
      <pubDate>Mon, 09 Aug 2004 00:02:08 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:efe5e3b4-ad0e-4f90-9199-03a198b2bd7e</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2004/08/09/mmap-based-malloc-on-openbsd</link>
      <category>hacking</category>
      <category>openbsd</category>
    </item>
    <item>
      <title>Everybody's kernel hacking</title>
      <description>&lt;p&gt;Had a great time in Las Vegas at &lt;a href="http://www.ashland.edu/~iajwa/conferences/2003/SAM/"&gt;SAM 03&lt;/a&gt;.  The conference wasn't up to much apart from a few interesting papers in our session (one on behaviour-based authentication from some guys at Reading was funny &lt;i&gt;and&lt;/i&gt; innovative).  We did however hire a car and have a really fun day wandering around the &lt;a href="http://recoil.org/~avsm/photos/vegas2003/vegas2003.html"&gt;desert&lt;/a&gt; checking out the natives.
&lt;br /&gt;
Back in Princeton, the work's pretty hectic.  Been stuck deep in the innards of the FreeBSD kernel for the last few days, ripping out bits of code to test out our cunning new networking idea.  We got it to work (late) last night, so now it's the spit and polish phase; the most painful ...
&lt;br /&gt;
On the OpenBSD front, I finally committed the &lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=105665219927976&amp;amp;w=2"&gt;gcc static bounds checker&lt;/a&gt; patch I've been playing with for a few months.   It found hundreds of really obviously bad bounds to functions such as &lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy&amp;amp;apropos=0&amp;amp;sektion=0&amp;amp;manpath=OpenBSD+Current&amp;amp;arch=i386&amp;amp;format=html"&gt;&lt;i&gt;strlcpy(3)&lt;/i&gt;&lt;/a&gt; and &lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=sscanf&amp;amp;apropos=0&amp;amp;sektion=0&amp;amp;manpath=OpenBSD+Current&amp;amp;arch=i386&amp;amp;format=html"&gt;&lt;i&gt;sscanf(3)&lt;/i&gt;&lt;/a&gt; in the source and ports trees.  The local compiler gurus (Scotty and Sharpy) have suggested various ways to improve it such as interval analysis, so I might hack on that if a burst of free time holds me to ransom any time soon.
&lt;br /&gt;
PS: &lt;a href="http://us.imdb.com/Title?0181852"&gt;T3&lt;/a&gt; was fun!&lt;/p&gt;</description>
      <pubDate>Fri, 11 Jul 2003 00:17:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:4e65dcc5-ea48-4bf1-99f7-6f2ca4e55bc8</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2003/07/11/everybodys-kernel-hacking</link>
      <category>travel</category>
      <category>hacking</category>
      <category>openbsd</category>
      <category>usa</category>
    </item>
  </channel>
</rss>
