BSD Now

BSD Now

Download on the App Store

All BSD Now episodes

  • 221: BSD in Taiwan

    Allan reports on his trip to BSD Taiwan, new versions of Lumina and GhostBSD are here, a bunch of OpenBSD p2k17 hackathon reports.

    This episode was brought to you by

    Headlines
    Allan’s Trip Report from BSD Taiwan
    • BSD TW and Taiwan in general was a fun and interesting experience
    • I arrived Thursday night and took the high speed train to Taipei main station, and then got on the Red line subway to the venue. The dorm rooms were on par with BSDCan, except the mattress was better.
    • I spent Friday with a number of other FreeBSD developers doing touristy things. We went to Taipei 101, the world’s tallest building from 2004 - 2010. It also features the world’s fastest elevator (2004 - 2016), traveling at 60.6 km/h and transporting passengers from the 5th to 89th floor in 37 seconds.
    • We also got to see the “tuned mass damper”, a 660 tonne steel pendulum suspended between the 92nd and 87th floors. This device resists the swaying of the building caused by high winds. There are interesting videos on display beside the damper, of its reaction during recent typhoons and earthquakes. The Taipei 101 building sits just 200 meters from a major fault line.
    • Then we had excellent dumplings for lunch
    • After walking around the city for a few more hours, we retired to a pub to escape the heat of the sunny Friday afternoon.
    • Then came the best part of each day in Taipei, dinner!
    • We continued our efforts to cause a nation wide shortage of dumplings
    • Special thanks to Scott Tsai who took detailed notes for each of the presentations
    • Saturday marked the start of the conference:
      • Arun Thomas provided background and then a rundown of what is happening with the RISC-V architecture. Notes
      • George Neville-Neil talked about using DTrace in distributed systems as an in-depth auditing system (who did what to whom and when). Notes
      • Baptiste Daroussin presented Poudrière image, an extension of everyone’s favourite package building system, to build custom images of FreeBSD. There was discussion of making this generate ZFS based images as well, making it mesh very well with my talk the next day. Notes
      • Brooks Davis presented his work on an API design for a replacement for mmap. It started with a history of address space management in the BSD family of operating systems going all the way back to the beginning. This overview of the feature and how it evolved filled in many gaps for me, and showed why the newer work would be beneficial. The motivation for the work includes further extensions to support the CHERI hardware platform. Notes
      • Johannes M Dieterich gave an interesting presentation about using FreeBSD and GPU acceleration for high performance computing. One of the slides showed that amd64 has taken almost the entire market for the top 500 super computers, and that linux dominates the list, with only a few remaining non-linux systems. Sadly, at the supercomputing conference the next week, it was announced that linux has achieved 100% saturation of the top 500 super computers list. Johannes detailed the available tools, what ports are missing, what changes should be made to the base system (mostly OpenMP), and generally what FreeBSD needs to do to become a player in the supercomputer OS market. Johannes’ perspective is interesting, as he is a computational chemist, not a computer scientist. Those interested in improving the numerical libraries and GPU acceleration frameworks on FreeBSD should join the ports team. Notes
      • The final talk of the day was Peter Grehan, who spoke about how graphics support in bhyve came to be. He provided a history of how the feature evolved, and where it stands today. Notes
      • Afterwards, we traveled as a group to a large restaurant for dinner. There was even Mongolian Vodka, provided by Ganbold Tsagaankhuu of the FreeBSD project.
      • Sunday:
        • The first talk of the day Sunday was mine. I presented “ZFS: Advanced Integration”, mostly talking about how boot environments work, and the new libbe and be(1) tools that my GSoC student Kyle Kneitinger created to manage them. I talked about how they can be used for laptop and developer systems, but also how boot environments can be used to replace nanobsd for appliances (as already done in FreeNAS and pfSense). I also presented about zfsbootcfg (zfs nextboot), and some future extensions to it to make it even more useful in appliance type workloads. I also provided a rundown of new developments out of the ZFS developer summit, two weeks previous. Notes
        • Theo de Raadt presented “Mitigations and other real Security Features”, and made his case for changing to a ‘fail closed’ mode of interoperability. Computer’s cannot actually self heal, so lets stop pretending that they can. Notes
        • Ruslan Bukin talked about doing the port of FreeBSD for RISC-V and writing the Device Drivers. Ruslan walked through the process step by step, leading members of the audience to suggest he turn it into a developer’s handbook article, explaining how to do the initial bringup on new hardware. Ruslan also showed off a FreeBSD/MIPS board he designed himself and had manufactured in China. Notes
        • Mariusz Zaborski presented Case studies on sandboxing the base system with Capsicum. He discussed the challenges encountered as existing programs are modified to sandbox them, and recent advancements in the debugging tools available during that process. Mariusz also discussed the Casper service at length, including the features that are planned for 2018 and onwards. Notes
        • The final presentation of the day was Mark Johnston on Memory Management Improvements in FreeBSD 12.0. This talk provided a very nice overview of the memory management system in FreeBSD, and then detailed some of the recent improvements. Notes
        • The conference wrapped up with the Work-in-Progress session, including updates on: multi-device-at-once GELI attach, MP-safe networking on NetBSD, pkgsrc, NetBSD in general, BSD on Microsoft Azure, Mothra (send-pr for bugzilla), BSDMizer a machine learning compiler optimizer, Hyperledger Sawtooth (blockchain), and finally VIMAGE and pf testing on FreeBSD.
        • Notes
        • Group Photo
        • BSDTW was a great conference. They are still considering if it should be an annual thing, trade off every 2nd year with AsiaBSDCon, or something else. In order to continue, BSD Taiwan requires more organizers and volunteers. They have regular meetups in Taipei if you are interested in getting involved.
        • ***
          Lumina 1.4.0 released
          • The Lumina Theme Engine (and associated configuration utility)
          • The Lumina theme engine is a new component of the “core” desktop, and provides enhanced theming capabilities for the desktop as well as all Qt5 applications. While it started out life as a fork of the “qt5ct” utility, it quickly grew all sorts of new features and functionality such as system-defined color profiles, modular theme components, and built-in editors/creators for all components. The backend of this engine is a standardized theme plugin for the Qt5 toolkit, so that all Qt5 applications will now present a unified appearance (if the application does not enforce a specific appearance/theme of it’s own). Users of the Lumina desktop will automatically have this plugin enabled: no special action is required.
            • Please note that the older desktop theme system for Lumina has been rendered obsolete by the new engine, but a settings-conversion path has already been implemented which should transition your current settings to the new engine the first time you login to Lumina 1.4.0. Custom themes for the older system may not be converted though, but it is trivial to copy/paste any custom stylesheets from the old system into the editor for the new theme engine to register/re-apply them as desired.
            • Lumina-Themes Repository
            • I also want to give a shout-out to the trueos/lumina-themes github repository contributors. All of the wallpapers in the 1.4.0 screenshots I posted come from that package, and they are working on making more wallpapers, color palettes, and desktop styles for use with the Lumina Theme Engine. If your operating system does not currently provide a package for lumina-themes, I highly recommend that you make one as soon as possible!

              • The Lumina PDF Viewer (lumina-pdf)

                • This is a new, stand-alone desktop utility for viewing/printing/presenting PDF documents. It uses the poppler-qt5 library in the backend for rendering the document, but uses multi-threading in many ways (such as to speed up the loading of pages) to give the user a nice, streamlined utility for viewing PDF documents. There is also built-in presentation functionality which allows users to easily cast the document to a separate screen without mucking about in system menus or configuration utilities.
                • Lumina PDF Viewer (1.4.0)

                  • Important Packaging Changes
                  • One significant change of note for people who are packaging Lumina for their particular operating system is that the minimum supported versions of Qt for Lumina have been changed with this release:

                    lumina-core: Qt 5.4+
                    lumina-mediaplayer: Qt 5.7+
                    Everything else: Qt 5.2+

                    Of course, using the latest version of the Qt5 libraries is always recommended.

                    When packaging for Linux distributions, the theme engine also requires the availability of some of the “-dev” packages for Qt itself when compiling the theme plugin. For additional information (specifically regarding Ubuntu builds), please take a look at a recent ticket on the Lumina repository.

                    • The new lumina-pdf utility requires the availability of the “poppler-qt5” library. The includes for this library on Ubuntu 17.10 were found to be installed outside of the normal include directories, so a special rule for it was added to our OS-Detect file in the Lumina source tree. If your particular operating system also places the the poppler include files in a non-standard place, please patch that file or send us the information and we can add more special rules for your particular OS.
                      • Other Changes of Note (in no particular order)
                        • lumina-config:
                        • Add a new page for changing audio theme (login, logout, low battery)
                        • Add option to replace fluxbox with some other WM (with appropriate warnings)
                        • Have the “themes” page redirect to launching the Lumina theme engine configuration utility.
                        • start-lumina-desktop:
                        • Auto-detect the active X11 displays and create a new display for the Lumina session (prevent conflict with prior graphical sessions).
                        • Add a process-failure counter & restart mechanism. This is particularly useful for restarting Fluxbox from time to time (such as after any monitor addition/removal)
                        • lumina-xconfig:
                        • Restart fluxbox after making any monitor changes with xrandr. This ensures a more reliable session.
                        • Implement a new 2D monitor layout mechanism. This allows for the placement of monitors anywhere in the X/Y plane, with simplification buttons for auto-tiling the monitors in each dimension based on their current location.
                        • Add the ability to save/load monitor profiles.
                        • Distinguish between the “default” monitor arrangement and the “current” monitor arrangement. Allow the user to set the current arrangement as the new default.
                        • lumina-desktop:
                        • Completely revamp the icon loading mechanisms so it should auto-update when the theme changes.
                        • Speed up the initialization of the desktop quite a bit.
                        • Prevent loading/probing files in the “/net/” path for existence (assume they exist in the interest of providing shortcuts). On FreeBSD, these are special paths that actually pause the calling process in order to mount/load a network share before resuming the process, and can cause significant “hangs” in the desktop process.
                        • Add the ability to take a directory as a target for the wallpaper. This will open/probe the directory for any existing image files that it can use as a wallpaper and randomly select one.
                        • Remove the popup dialog prompting about system updates, and replace it with new “Restart (with updates)” buttons on the appropriate menus/windows instead.
                        • If no wallpapers selection is provided, try to use the “lumina-nature” wallpaper directory as the default, otherwise fall back on the original default wallpaper if the “lumina-themes” package is not installed.
                        • lumina-open:
                        • Make the *.desktop parsing a bit more flexible regarding quoted strings where there should not be any.
                        • If selecting which application to use, only overwrite the user-default app if the option is explicitly selected.
                        • lumina-fileinfo:
                        • Significant cleanup of this utility. Now it can be reliably used for creating/registering XDG application shortcuts.
                        • Add a whole host of new ZFS integrations:
                        • If a ZFS dataset is being examined, show all the ZFS properties for that dataset.
                        • If the file being examined exists within ZFS snapshots, show all the snapshots of the file
                        • lumina-fm:
                          • Significant use of additional multi-threading. Makes the loading of directories much faster (particularly ones with image files which need thumbnails)
                          • Add detection/warning when running as root user. Also add an option to launch a new instance of lumina-fm as the root user.
                          • [FreeBSD/TrueOS] Fix up the detection of the “External Devices” list to also list available devices for the autofs system.
                          • Fix up some drag and drop functionality.
                          • Expose the creation, extraction, and insertion of files into archives (requires lumina-archiver at runtime)
                          • Expand the “Open With” option into a menu of application suggestions in addition to the “Other” option which runs “lumina-open” to find an application.
                          • Provide an option to set the desktop wallpaper to the selected image file(s). (If the running desktop session is Lumina).
                          • lumina-mediaplayer:
                            • Enable the ability to playback local video files. (NOTE: If Qt5 is set to use the gstreamer multimedia backend, make sure you have the “GL” plugin installed for smooth video playback).
                            • lumina-archiver:
                              • Add CLI flags for auto-archive and auto-extract. This allows for programmatic/scriptable interactions with archives.
                              • That is not mentioning all of the little bugfixes, performance tweaks, and more that are also included in this release.
                              • ***
                                The strongest KASLR, ever?
                                • Re: amd64: kernel aslr support
                                • So, I did it. Now the kernel sections are split in sub-blocks, and are all randomized independently. See my drawing [1]. What it means in practice, is that Kernel ASLR is much more difficult to defeat: a cache attack will at most allow you to know that a given range is mapped as executable for example, but you don't know which sub-block of .text it is; a kernel pointer leak will at most allow you to reconstruct the layout of one sub-block, but you don't know the layout and address of the remaining blocks, and there can be many.

                                  The size and number of these blocks is controlled by the split-by-file parameter in Makefile.amd64. Right now it is set to 2MB, which produces a kernel with ~23 allocatable (ie useful at runtime) sections, which is a third of the total number supported (BTSPACE_NSEGS = 64). I will probably reduce this parameter a bit in the future, to 1.5MB, or even 1MB.
                                  All of that leaves us with about the most advanced KASLR implementation available out there. There are ways to improve it even more, but you'll have to wait a few weeks for that.
                                  If you want to try it out you need to make sure you have the latest versions of GENERIC_KASLR / prekern / bootloader. The instructions are still here, and haven't changed.

                                  • Initial design
                                  • As I said in the previous episode, I added in October a Kernel ASLR implementation in NetBSD for 64bit x86 CPUs. This implementation would randomize the location of the kernel in virtual memory as one block: a random VA would be chosen, and the kernel ELF sections would be mapped contiguously starting from there.

                                    This design had several drawbacks: one leak, or one successful cache attack, could be enough to reconstruct the layout of the entire kernel and defeat KASLR.
                                    NetBSD’s new KASLR design significantly improves this situation.

                                    • New design
                                    • In the new design, each kernel ELF section is randomized independently. That is to say, the base addresses of .text, .rodata, .data and .bss are not correlated. KASLR is already at this stage more difficult to defeat, since you would need a leak or cache attack on each of the kernel sections in order to reconstruct the in-memory kernel layout.

                                      Then, starting from there, several techniques are used to strengthen the implementation even more.

                                      • Sub-blocks
                                      • The kernel ELF sections are themselves split in sub-blocks of approximately 1MB. The kernel therefore goes from having:

                                        { .text .rodata .data .bss }

                                        to having

                                        { .text .text.0 .text.1 ... .text.i .rodata .rodata.0 ... .rodata.j ... .data ...etc }

                                        As of today, this produces a kernel with ~33 sections, each of which is mapped at a random address and in a random order.

                                        This implies that there can be dozens of .text segments. Therefore, even if you are able to conduct a cache attack and determine that a given range of memory is mapped as executable, you don’t know which sub-block of .text it is. If you manage to obtain a kernel pointer via a leak, you can at most guess the address of the section it finds itself in, but you don’t know the layout of the remaining 32 sections. In other words, defeating this KASLR implementation is much more complicated than in the initial design.

                                        • Higher entropy
                                        • Each section is put in a 2MB-sized physical memory chunk. Given that the sections are 1MB in size, this leaves half of the 2MB chunk unused. Once in control, the prekern shifts the section within the chunk using a random offset, aligned to the ELF alignment constraint. This offset has a maximum value of 1MB, so that once shifted the section still resides in its initial 2MB chunk:

                                          The prekern then maps these 2MB physical chunks at random virtual addresses; but addresses aligned to 2MB. For example, the two sections in Fig. A will be mapped at two distinct VAs:
                                          There is a reason the sections are shifted in memory: it offers higher entropy. If we consider a .text.i section with a 64byte ELF alignment constraint, and give a look at the number of possibilities for the location of the section in memory:
                                          The prekern shifts the 1MB section in its 2MB chunk, with an offset aligned to 64 bytes. So there are (2MB-1MB)/(64B)=214 possibilities for the offset.
                                          Then, the prekern uses a 2MB-sized 2MB-aligned range of VA, chosen in a 2GB window. So there are (2GB-2MB)/(2MB)=210-1 possibilities for the VA.
                                          Therefore, there are 214x(210-1)˜224 possible locations for the section. As a comparison with other systems:

                                          OS # of possibilities
                                          Linux 2^6
                                          MacOS 2^8
                                          Windows 2^13
                                          NetBSD 2^24

                                          Of course, we are talking about one .text.i section here; the sections that will be mapped afterwards will have fewer location possibilities because some slots will be already occupied. However, this does not alter the fact that the resulting entropy is still higher than that of the other implementations. Note also that several sections have an alignment constraint smaller than 64 bytes, and that in such cases the entropy is even higher.

                                          • Large pages
                                          • There is also a reason we chose to use 2MB-aligned 2MB-sized ranges of VAs: when the kernel is in control and initializes itself, it can now use large pages to map the physical 2MB chunks. This greatly improves memory access performance at the CPU level.

                                            • Countermeasures against TLB cache attacks
                                            • With the memory shift explained above, randomness is therefore enforced at both the physical and virtual levels: the address of the first page of a section does not equal the address of the section itself anymore.

                                              It has, as a side effect, an interesting property: it can mostly mitigate TLB cache attacks. Such attacks operate at the virtual-page level; they will allow you to know that a given large page is mapped as executable, but you don’t know where exactly within that page the section actually begins.

                                              • Strong?
                                              • This KASLR implementation, which splits the kernel in dozens of sub-blocks, randomizes them independently, while at the same time allowing for higher entropy in a way that offers large page support and some countermeasures against TLB cache attacks, appears to be the most advanced KASLR implementation available publicly as of today.

                                                Feel free to prove me wrong, I would be happy to know!

                                                • WIP
                                                • Even if it is in a functional state, this implementation is still a work in progress, and some of the issues mentioned in the previous blog post haven't been addressed yet. But feel free to test it and report any issue you encounter. Instructions on how to use this implementation can still be found in the previous blog post, and haven’t changed since.

                                                  See you in the next episode!

                                                  News Roundup
                                                  GhostBSD 11.1 Finally Ready and Available!
                                                  • Screenshots
                                                  • After a year of development, testing, debugging and working on our software package repository, we are pleased to announce the release of GhostBSD 11.1 is now available on 64-bit(amd64) architecture with MATE and XFCE Desktop on direct and torrent download. With 11.1 we drop 32-bit i386 supports, and we currently maintain our software packages repository for more stability.

                                                    • What's new on GhostBSD 11.1
                                                      • GhostBSD software repository
                                                      • Support VMware Workstation Guest Features
                                                      • New UFS full disk mirroring option on the installer
                                                      • New UFS full disk MBR and GPT option on the installer
                                                      • New UFS full disk swap size option on the installer
                                                      • Whisker Menu as default Application menu on XFCE
                                                      • All software developed by GhostBSD is now getting updated
                                                      • ZFS configuration for disk
                                                      • What has been fixed on 11.1?
                                                        • Fix XFCE sound plugin
                                                        • Installer ZFS configuration file setting
                                                        • Installer ZFS setup appears to be incomplete
                                                        • The installer was not listing ZFS disk correctly.
                                                        • The installer The partition list was not deleted when pressing back
                                                        • XFCE and MATE shutdown/suspend/hibernate randomly missing
                                                        • Clicking 'GhostBSD Bugs' item in the Main menu -> 'System Tools' brings up 'Server not found' page
                                                        • XFCE installation - incorrect keyboard layout
                                                        • Locale setting not filling correctly
                                                        • Update Station tray icon
                                                        • The image checksum's, hybrid ISO(DVD, USB) images are available at GhostBSD.
                                                        • ***
                                                          p2k17 Hackathon Reports
                                                          • p2k17 Hackathon Report: Matthias Kilian on xpdf, haskell, and more
                                                          • p2k17 Hackathon Report: Herzliche grusse vom Berlin (espie@ on mandoc, misc packages progress)
                                                          • p2k17 Hackathon Report: Paul Irofti (pirofti@) on hotplugd(8), math ports, xhci(4) and other kernel advancements
                                                          • p2k17 Hackathon report: Jeremy Evans on ruby progress, postgresql and webdriver work
                                                          • p2k17 Hackathon report: Christian Weisgerber on random devices, build failures and gettext
                                                          • p2k17 Hackathon report: Sebastian Reitenbach on Puppet progress
                                                          • p2k17 Hackathon Report: Anthony J. Bentley on firmware, games and securing pkg_add runs
                                                          • p2k17 Hackathon Report: Landry Breuil on Mozilla things and much more
                                                          • p2k17 Hackathon report: Florian Obser on network stack progress, kernel relinking and more
                                                          • p2k17 Hackathon report: Antoine Jacoutot on ports+packages progress
                                                          • ***
                                                            TrueOS Talks
                                                            • Tech and Open Source at Pellissippi State
                                                            • Ken Moore of the TrueOS project presented a talk to the AITP group at Pellissippi State today entitled “It’s A Unix(-like) system? An Introduction to TrueOS and Open source”. Joshua Smith of the TrueOS project was also in attendance.

                                                              We were happy to see a good attendance of about 40 individuals that came to hear more about TrueOS and how we continue to innovate along with the FreeBSD project. Many good questions were raised about development, snapshots, cryptocurrency, and cyber-security. We’ve included a copy of the slides if you’d like to have a look at the talk on open source. We’d like to offer a sincere thanks to everyone who attended and offer an extended invitation for you to join us at our KnoxBUG group on October 30th @ the iXsystems offices! We hope to see you soon!

                                                              • Open Source Talk – Slideshare PDF
                                                              • KnoxBug - Lumina Rising : Challenging Desktop Orthodoxy
                                                              • Ken gave his talk about the new Lumina 2.0 Window Manager that he gave at Ohio LinuxFest 2017
                                                              • KnoxBUG October 2017
                                                              • (OLF 2017) Lumina Rising: Challenging Desktop Orthodoxy
                                                              • ***
                                                                Official OpenBSD 6.2 CD set - the only one to be made!
                                                                • Our dear friend Bob Beck (beck@) writes:
                                                                • So, again this release the tradition of making Theo do art has continued!

                                                                  Up for sale by auction to the highest bidder on Ebay is the only OpenBSD 6.2 CD set to be produced.
                                                                  The case and CD's feature the 6.2 artwork, custom drawn and signed by Theo.
                                                                  All proceeds to support OpenBSD
                                                                  Go have a look at the auction

                                                                  • As with previous OpenBSD auctions, if you are not the successful bidder, we would like to encourage you to donate the equivalent of you highest bid to the project.
                                                                  • The Auction
                                                                  • ***
                                                                    Beastie Bits
                                                                    • HAMMER2 userspace on Linux
                                                                    • OpenBSD Porting Workshop (now changed to January 3, 2018)
                                                                    • Matt Ahrens on when Native Encryption for ZFS will land
                                                                    • The first successful build of OpenBSD base system
                                                                    • KnoxBug November Meeting
                                                                    • Absolute FreeBSD, 3rd Edition, pre-orders available
                                                                    • Feedback/Questions
                                                                      • Jon - Jails and Networking
                                                                      • Nathan - bhyve Provisioning
                                                                      • Lian - OpenSSL jumping the Shark
                                                                      • Kim - Suggestions
                                                                      • ***
                                                                        1 hr 57 min
                                                                      • 220: Opening ZFS in 2017

                                                                        We have a first PS4 kernel exploit, the long awaited OpenZFS devsummit report by Allan, DragonflyBSD 5.0 is out, we show you vmadm to manage jails, and parallel processing with Unix tools.

                                                                        This episode was brought to you by

                                                                        Headlines
                                                                        The First PS4 Kernel Exploit: Adieu
                                                                        • The First PS4 Kernel Exploit: Adieu
                                                                        • Plenty of time has passed since we first demonstrated Linux running on the PS4. Now we will step back a bit and explain how we managed to jump from the browser process into the kernel such that ps4-kexec et al. are usable. Over time, ps4 firmware revisions have progressively added many mitigations and in general tried to lock down the system. This post will mainly touch on vulnerabilities and issues which are not present on the latest releases, but should still be useful for people wanting to investigate ps4 security.

                                                                          • Vulnerability Discovery
                                                                          • As previously explained, we were able to get a dump of the ps4 firmware 1.01 kernel via a PCIe man-in-the-middle attack. Like all FreeBSD kernels, this image included “export symbols” - symbols which are required to perform kernel and module initialization processes. However, the ps4 1.01 kernel also included full ELF symbols (obviously an oversight as they have been removed in later firmware versions). This oversight was beneficial to the reverse engineering process, although of course not a true prerequisite. Indeed, we began exploring the kernel by examining built-in metadata in the form of the syscall handler table - focusing on the ps4-specific entries.

                                                                            Each process object in the kernel contains its own “idt” (ID Table) object. As can be inferred from the snippet above, the hash table essentially just stores pointers to opaque data blobs, along with a given kind and name. Entries may be accessed (and thus “locked”) with either read or write intent. Note that IDT_TYPE is not a bitfield consisting of only unique powers of 2. This means that if we can control the kind of an id_entry, we may be able to cause a type confusion to occur (it is assumed that we may control name).

                                                                            • Exploitation
                                                                            • To an exploiter without ps4 background, it might seem that the easiest way to exploit this bug would be to take advantage of the write off the end of the malloc’d namedobj_usr_t object. However, this turns out to be impossible (as far as I know) because of a side effect of the ps4 page size being changed to 0x4000 bytes (from the normal of 0x1000). It appears that in order to change the page size globally, the ps4 kernel developers opted to directly change the related macros. One of the many changes resulting from this is that the smallest actual amount of memory which malloc may give back to a caller becomes 0x40 bytes. While this also results in tons of memory being completely wasted, it does serve to nullify certain exploitation techniques (likely completely by accident…).

                                                                              • Adieu
                                                                              • The namedobj exploit was present and exploitable (albeit using a slightly different method than described here) until it was fixed in firmware version 4.06. This vulnerability was also found and exploited by (at least) Chaitin Tech, so props to them! Taking a quick look at the 4.07 kernel, we can see a straightforward fix (4.06 is assumed to be identical - only had 4.07 on hand while writing this post):

                                                                                int sys_namedobj_create(struct thread *td, void *args) {
                                                                                // ...
                                                                                rv = EINVAL;
                                                                                kind = *((_DWORD *)args + 4)
                                                                                if ( !(kind & 0x4000) && *(_QWORD *)args ) {
                                                                                // ... (unchanged)
                                                                                }
                                                                                return rv;
                                                                                }

                                                                                And so we say goodbye to a nice exploit. I hope you enjoyed this blast from the past :) Keep hacking!

                                                                                OpenZFS Developer Summit 2017 Recap

                                                                                The 5th annual OpenZFS Developer Summit was held in San Francisco on October 24-25. Hosted by Delphix at the Children’s Creativity Museum in San Francisco, over a hundred OpenZFS contributors from a wide variety of companies attended and collaborated during the conference and developer summit. iXsystems was a Gold sponsor and several iXsystems employees attended the conference, including the entire Technical Documentation Team, the Director of Engineering, the Senior Analyst, a Tier 3 Support Engineer, and a Tier 2 QA Engineer.

                                                                                Day 1 of the conference had 9 highly detailed, informative, and interactive technical presentations from companies which use or contribute to OpenZFS. The presentations highlighted improvements to OpenZFS developed “in-house” at each of these companies, with most improvements looking to be made available to the entire OpenZFS community in the near to long term. There’s a lot of exciting stuff happening in the OpenZFS community and this post provides an overview of the presented features and proof-of-concepts.
                                                                                The keynote was delivered by Mark Maybee who spoke about the past, present, and future of ZFS at Oracle. An original ZFS developer, he outlined the history of closed-source ZFS development after Oracle’s acquisition of Sun. ZFS has a fascinating history, as the project has evolved over the last decade in both open and closed source forms, independent of one another. While Oracle’s proprietary internal version of ZFS has diverged from OpenZFS, it has implemented many of the same features. Mark was very proud of the work his team had accomplished over the years, claiming Oracle’s ZFS products have accounted for over a billion dollars in sales and are used in the vast majority of Fortune 100 companies. However, with Oracle aggressively moving into cloud storage, the future of closed source ZFS is uncertain. Mark presented a few ideas to transform ZFS into a mainstream and standard file system, including adding more robust support for Linux.
                                                                                Allan Jude from ScaleEngine talked about ZStandard, a new compression method he is developing in collaboration with Facebook. It offers compression comparable to gzip, but at speeds fast enough to keep up with hard drive bandwidth. According to early testing, it improves both the speed and compression efficiency over the current LZ4 compression algorithm. It also offers a new “dictionary” feature for improving image compression, which is of particular interest to Facebook. In addition, when using ZFS send and receive, it will adapt the compression ratio to make the most efficient use of the network bandwidth.
                                                                                Currently, deleting a clone on ZFS is a time-consuming process, especially when dealing with large datasets that have diverged over time. Sara Hartse from Delphix described how “clone fast delete” speeds up clone deletion. Rather than traversing the entire dataset during clone deletion, changes to the clone are tracked in a “live list” which the delete process uses to determine which blocks to free. In addition, rather than having to wait for the clone to finish, the delete process backgrounds the task so you can keep working without any interruptions. Sara shared the findings of a test they ran on a clone with 500MB of data, which took 45 minutes to delete with the old method, and under a minute using the live list. This behavior is an optional property as it may not be appropriate for long-lived clones where deletion times are not a concern. At this time, it does not support promoted clones.
                                                                                Olaf Faaland from Lawrence Livermore National Labs demonstrated the progress his team has made to improve ZFS pool imports with MMP (Multi-Modifier Protection), a watchdog system to make sure that ZFS pools in clustered High Availability environments are not imported by more than one host at a time. MMP uses uberblocks and other low-level ZFS features to monitor pool import status and otherwise safeguard the import process. MMP adds fields to on-disk metadata so it does not depend on hardware, such as SAS. It supports multi-node HA configs and does not affect non-HA systems. However, it does have issues with long I/O delays so existing HA software is recommended as an additional fallback.
                                                                                Jörgen Lundman of GMO Internet gave an entertaining talk on the trials and tribulations of porting ZFS to OS X. As a bonus, he talked about porting ZFS to Windows, and showed a working demo. While not yet in a usable state, it demonstrated a proof-of-concept of ZFS support for other platforms.
                                                                                Serapheim Dimitropoulos from Delphix discussed Faster Allocation with the Log Spacemap as a means of optimizing ZFS allocation performance. He began with an in-depth overview of metaslabs and how log spacemaps are used to track allocated and freed blocks. Since blocks are only allocated from loaded metaslabs but freed blocks may apply to any metaslab, over time logging the freed blocks to each appropriate metaslab with every txg becomes less efficient. Their solution is to create a pool-wide metaslab for unflushed entries.
                                                                                Shailendra Tripathi from Tegile presented iFlash: Dynamic Adaptive L2ARC Caching. This was an interesting talk on what is required to allow very different classes of resources to share the same flash device–in their case, ZIL, L2ARC, and metadata. To achieve this, they needed to address the following differences for each class: queue priority, metaslab load policy, allocation, and data protection (as cache has no redundancy).
                                                                                Isaac Huang of Intel introduced DRAID, or parity declustered RAID. Once available, this will provide the same levels of redundancy as traditional RAIDZ, providing the administrator doubles the amount of options for providing redundancy for their use case. The goals of DRAID are to address slow resilvering times and the write throughput of a single replacement drive being a bottleneck. This solution skips block pointer tree traversal when rebuilding the pool after drive failure, which is the cause of long resilver times. This means that redundancy is restored quickly, mitigating the risk of losing additional drives before the resilver completes, but it does require a scrub afterwards to confirm data integrity. This solution supports logical spares, which must be defined at vdev creation time, which are used to quickly restore the array.
                                                                                Prakash Surya of Delphix described how ZIL commits currently occur in batches, where waiting threads have to wait for the batch to complete. His proposed solution was to replace batch commits and to instead notify the waiting thread after its ZIL commit in order to greatly increase throughput. A new tunable for the log write block timeout can also be used to log write blocks more efficiently.
                                                                                Overall, the quality of the presentations at the 2017 OpenZFS conference was high. While quite technical, they clearly explained the scope of the problems being addressed and how the proposed solutions worked. We look forward to seeing the described features integrated into OpenZFS. The videos and slides for the presentations should be made available over the next month or so at the OpenZFS website.

                                                                                • OpenZFS Photo Album
                                                                                • DragonflyBSD 5.0
                                                                                  • DragonFly version 5.0 brings the first bootable release of HAMMER2, DragonFly's next generation file system.
                                                                                  • HAMMER2
                                                                                    • Preliminary HAMMER2 support has been released into the wild as-of the 5.0 release. This support is considered EXPERIMENTAL and should generally not yet be used for production machines and important data. The boot loader will support both UFS and HAMMER2 /boot. The installer will still use a UFS /boot even for a HAMMER2 installation because the /boot partition is typically very small and HAMMER2, like HAMMER1, does not instantly free space when files are deleted or replaced.
                                                                                    • DragonFly 5.0 has single-image HAMMER2 support, with live dedup (for cp's), compression, fast recovery, snapshot, and boot support. HAMMER2 does not yet support multi-volume or clustering, though commands for it exist. Please use non-clustered single images for now.
                                                                                    • ipfw Updates
                                                                                      • IPFW has gone through a number of updates in DragonFly and now offers better performance. pf and ipfw3 are also still supported.
                                                                                      • Improved graphics support
                                                                                        • The i915 driver has been brought up to match what's in the Linux 4.7.10 kernel. Intel GPUs are supported up to the Kabylake generation.
                                                                                        • vga_switcheroo(4) module added, allowing the use of Intel GPUs on hybrid-graphics systems.
                                                                                        • The new apple_gmux driver enables switching to the Intel video chipset on dual Intel/NVIDIA and Intel/Radeon Macbook computers.
                                                                                        • Other user-affecting changes
                                                                                          • efisetup(8) added.
                                                                                          • DragonFly can now support over 900,000 processes on a single machine.
                                                                                          • Client-side SSH by default does not try password authentication, which is the default behavior in newer versions of OpenSSH. Pass an explicit '-o PasswordAuthentication=yes' or change /etc/ssh/ssh_config if you need the old behavior. Public key users are unaffected.
                                                                                          • Clang status
                                                                                            • A starting framework has been added for using clang as the alternate base compiler in DragonFly, to replace gcc 4.7. It's not yet complete. Clang can of course be added as a package.
                                                                                            • Package updates
                                                                                              • Many package updates but I think most notably we need to point to chrome60 finally getting into dports with accelerated video and graphics support.
                                                                                              • 64-bit status
                                                                                                • Note that DragonFly is a 64-bit-only operating system as of 4.6, and will not run on 32-bit hardware.
                                                                                                • AMD Ryzen is supported and DragonFly 5.0 has a workaround for a hardware bug.
                                                                                                • DragonFly quickly released a v5.0.1 with a few patches Download link
                                                                                                • News Roundup
                                                                                                  (r)vmadm – managing FreeBSD jails

                                                                                                  We are releasing the first version (0.1.0) of our clone of vmadm for FreeBSD jails today. It is not done or feature complete, but it does provides basic functionality. At this point, we think it would be helpful to get it out there and get some feedback. As of today, it allows basic management of datasets, as well as creating, starting, stopping, and destroying jails.

                                                                                                  • Why another tool to manage jails
                                                                                                  • However, before we go into details let’s talk why we build yet another jail manager? It is not the frequent NIH syndrome, actually quite the opposite. In FiFo 0.9.2 we experimented with iocage as a way to control jails. While iocage is a useful tool when used as a CLI utility it has some issues when used programmatically.

                                                                                                    When managing jails automatically and not via a CLI tool things like performance, or a machine parsable interface matter. While on a CLI it is acceptable if a call takes a second or two, for automatically consuming a tool this delay is problematic.
                                                                                                    Another reason for the decision was that vmadm is an excellent tool. It is very well designed. SmartOs uses vmadm for years now. Given all that, we opted for adopting a proven interface rather than trying to create a new one. Since we already interface with it on SmartOS, we can reuse a majority of our management code between SmartOS and FreeBSD.

                                                                                                    • What can we do
                                                                                                    • Today we can manage datasets, which are jail templates in the form of ZFS volumes. We can list and serve them from a dataset-server, and fetch those we like want. At this point, we provide datasets for FreeBSD 10.0 to 11.1, but it is very likely that the list will grow. As an idea here is a community-driven list of datasets that exist for SmartOS today. Moreover, while those datasets will not work, we hope to see the same for BSD jails.

                                                                                                      After fetching the dataset, we can define jails by using a JSON file. This file is compatible with the zone description used on SmartOS. It does not provide all the same features but a subset. Resources such as CPU and memory can be defined, networking configured, a dataset selected and necessary settings like hostname set.
                                                                                                      With the jail created, vmadm allows managing its lifetime, starting, stopping it, accessing the console and finally destroying it. Updates to jails are supported to however as of today they are only taken into account after restarting the jail. However, this is in large parts not a technical impossibility but rather wasn’t high up on the TODO list.
                                                                                                      It is worth mentioning that vmadm will not pick up jails created in other tools or manually. Only using vmadm created jails was a conscious decision to prevent it interfering with existing setups or other utilities. While conventional tools can manage jails set up with vmadm just fine we use some special tricks like nested jails to allow for restrictions required for multi-tenancy that are hard or impossible to achieve otherwise.

                                                                                                      • Whats next
                                                                                                      • First and foremost we hope to get some feedback and perhaps community engagement. In the meantime, as announced earlier this year, we are hard at work integrating FreeBSD hypervisors in FiFo, and as of writing this, the core actions work quite well.

                                                                                                        Right now only the barebone functions are supported, some of the output is not as clear as we would like. We hope to eventually add support for behyve to vmadm the same way that it supports KVM on SmartOS. Moreover, the groundwork for this already exists in the nested jail techniques we are using.
                                                                                                        Other than that we are exploring ways to allow for PCI pass through in jails, something not possible in SmartOS zones right now that would be beneficial for some users.
                                                                                                        In general, we want to improve compatibility with SmartOS as much as possible and features that we add over time should make the specifications invalid for SmartOS.

                                                                                                        • You can get the tool from github.
                                                                                                        • ***
                                                                                                          Parallel processing with unix tools
                                                                                                          • There are various ways to use parallel processing in UNIX:
                                                                                                          • piping

                                                                                                            An often under appreciated idea in the unix pipe model is that the components of the pipe run in parallel. This is a key advantage leveraged when combining simple commands that do "one thing well"
                                                                                                            split -n, xargs -P, parallel
                                                                                                            Note programs that are invoked in parallel by these, need to output atomically for each item processed, which the GNU coreutils are careful to do for factor and sha*sum, etc. Generally commands that use stdio for output can be wrapped with the stdbuf -oL command to avoid intermixing lines from parallel invocations
                                                                                                            make -j
                                                                                                            Most implementations of make(1) now support the -j option to process targets in parallel. make(1) is generally a higher level tool designed to process disparate tasks and avoid reprocessing already generated targets. For example it is used very effictively when testing coreutils where about 700 tests can be processed in 13 seconds on a 40 core machine.
                                                                                                            implicit threading
                                                                                                            This goes against the unix model somewhat and definitely adds internal complexity to those tools. The advantages can be less data copying overhead, and simpler usage, though its use needs to be carefully considered. A disadvantage is that one loses the ability to easily distribute commands to separate systems. Examples are GNU sort(1) and turbo-linecount

                                                                                                            • The example provided counts lines in parallel:
                                                                                                            • The examples below will compare the above methods for implementing multi-processing, for the function of counting lines in a file. First of all let's generate some test data. We use both long and short lines to compare the overhead of the various methods compared to the core cost of the function being performed:

                                                                                                              $ seq 100000000 > lines.txt # 100M lines
                                                                                                              $ yes $(yes longline | head -n9) | head -n10000000 > long-lines.txt # 10M lines

                                                                                                              We'll also define the add() { paste -d+ -s | bc; } helper function to add a list of numbers.

                                                                                                              Note the following runs were done against cached files, and thus not I/O bound. Therefore we limit the number of processes in parallel to $(nproc), though you would generally benefit to raising that if your jobs are waiting on network or disk etc.

                                                                                                              • We'll use this command to count lines for most methods, so here is the base non multi-processing performance for comparison:
                                                                                                              • $ time wc -l lines.txt
                                                                                                                $ time wc -l long-lines.txt
                                                                                                                split -n
                                                                                                                Note using -n alone is not enough to parallelize. For example this will run serially with each chunk, because since --filter may write files, the -n pertains to the number of files to split into rather than the number to process in parallel.
                                                                                                                $ time split -n$(nproc) --filter='wc -l' lines.txt | add
                                                                                                                • You can either run multiple invocations of split in parallel on separate portions of the file like:
                                                                                                                • $ time for i in $(seq $(nproc)); do

                                                                                                                  split -n$i/$(nproc) lines.txt | wc -l&
                                                                                                                  done | add

                                                                                                                  • Or split can do parallel mode using round robin on each line, but that's huge overhead in this case. (Note also the -u option significant with -nr):
                                                                                                                  • $ time split -nr/$(nproc) --filter='wc -l' lines.txt | add

                                                                                                                    • Round robin would only be useful when the processing per item is significant.
                                                                                                                    • Parallel isn't well suited to processing a large single file, rather focusing on distributing multiple files to commands. It can't efficiently split to lightweight processing if reading sequentially from pipe:
                                                                                                                    • $ time parallel --will-cite --block=200M --pipe 'wc -l' < lines.txt | add

                                                                                                                      • Like parallel, xargs is designed to distribute separate files to commands, and with the -P option can do so in parallel. If you have a large file then it may be beneficial to presplit it, which could also help with I/O bottlenecks if the pieces were placed on separate devices:
                                                                                                                      • split -d -n l/$(nproc) lines.txt l.

                                                                                                                        Those pieces can then be processed in parallel like:
                                                                                                                        $ time find -maxdepth 1 -name 'l.*' |
                                                                                                                        xargs -P$(nproc) -n1 wc -l | cut -f1 -d' ' | add

                                                                                                                        • If your file sizes are unrelated to the number of processors then you will probably want to adjust -n1 to batch together more files to reduce the number of processes run in total. Note you should always specify -n with -P to avoid xargs accumulating too many input items, thus impacting the parallelism of the processes it runs.
                                                                                                                        • make(1) is generally used to process disparate tasks, though can be leveraged to provide low level parallel processing on a bunch of files. Note also the make -O option which avoids the need for commands to output their data atomically, letting make do the synchronization. We'll process the presplit files as generated for the xargs example above, and to support that we'll use the following Makefile:
                                                                                                                        • %: FORCE # Always run the command

                                                                                                                          @wc -l < $@
                                                                                                                          FORCE: ;
                                                                                                                          Makefile: ; # Don't include Makefile itself

                                                                                                                          • One could generate this and pass to make(1) with the -f option, though we'll keep it as a separate Makefile here for simplicity. This performs very well and matches the performance of xargs.
                                                                                                                          • $ time find -name 'l.*' -exec make -j$(nproc) {} + | add

                                                                                                                            Note we use the POSIX specified "find ... -exec ... {} +" construct, rather than conflating the example with xargs. This construct like xargs will pass as many files to make as possible, which make(1) will then process in parallel.

                                                                                                                            OpenBSD gives a hint on forgetting unlock mutex
                                                                                                                            • OpenBSD gives a hint on forgetting unlock mutex
                                                                                                                            • Check following simple C++ program:
                                                                                                                            • > ```
                                                                                                                              #include

                                                                                                                              int main(void)

                                                                                                                              {
                                                                                                                              std::mutex m;
                                                                                                                              m.lock();

                                                                                                                              return 0;

                                                                                                                              }

                                                                                                                              + The mutex m forgot unlock itself before exiting main function:
                                                                                                                              > ```
                                                                                                                              m.unlock();
                                                                                                                              • Test it on GNU/Linux, and I chose ArchLinux as the testbed:
                                                                                                                              • $ uname -a
                                                                                                                                Linux fujitsu-i 4.13.7-1-ARCH #1 SMP PREEMPT Sat Oct 14 20:13:26 CEST 2017 x86_64 GNU/Linux
                                                                                                                                $ clang++ -g -pthread -std=c++11 test_mutex.cpp
                                                                                                                                $ ./a.out
                                                                                                                                $
                                                                                                                                • The process exited normally, and no more words was given. Build and run it on OpenBSD 6.2:
                                                                                                                                • clang++ -g -pthread -std=c++11 test_mutex.cpp
                                                                                                                                  ./a.out
                                                                                                                                  pthread_mutex_destroy on mutex with waiters!
                                                                                                                                  • The OpenBSD prompts “pthread_mutex_destroy on mutex with waiters!“. Interesting!
                                                                                                                                  • ***
                                                                                                                                    Beastie Bits
                                                                                                                                    • Updates to the NetBSD operating system since OSHUG #57 & #58
                                                                                                                                    • Creating a jail with FiFo and Digital Ocean
                                                                                                                                    • I'm thinking about OpenBSD again
                                                                                                                                    • Kernel ASLR on amd64
                                                                                                                                    • Call for Participation - BSD Devroom at FOSDEM
                                                                                                                                    • BSD Stockholm Meetup
                                                                                                                                    • ***
                                                                                                                                      Feedback/Questions
                                                                                                                                      • architect - vBSDCon
                                                                                                                                      • Brad - Packages and package dependencies
                                                                                                                                      • Lars - dpb
                                                                                                                                      • Alex re: PS4 Network Throttling
                                                                                                                                      • ***
                                                                                                                                        1 hr 55 min
                                                                                                                                      • 219: We love the ARC

                                                                                                                                        Papers we love: ARC by Bryan Cantrill, SSD caching adventures with ZFS, OpenBSD full disk encryption setup, and a Perl5 Slack Syslog BSD daemon.

                                                                                                                                        This episode was brought to you by

                                                                                                                                        Headlines
                                                                                                                                        Papers We Love: ARC: A Self-Tuning, Low Overhead Replacement Cache
                                                                                                                                        • Ever wondered how the ZFS ARC (Adaptive Replacement Cache) works?
                                                                                                                                        • How about if Bryan Cantrill presented the original paper on its design?
                                                                                                                                        • Today is that day.
                                                                                                                                        • Slides
                                                                                                                                        • It starts by looking back at a fundamental paper from the 40s where the architecture of general-purpose computers are first laid out
                                                                                                                                        • The main is the description of memory hierarchies, where you have a small amount of very fast memory, then the next level is slower but larger, and on and on. As we look at the various L1, L2, and L3 caches on a CPU, then RAM, then flash, then spinning disks, this still holds true today.
                                                                                                                                        • The paper then does a survey of the existing caching policies and tries to explain the issues with each. This includes ‘MIN’, which is the theoretically optimal policy, which requires future knowledge, but is useful for setting the upper bound, what is the best we could possibly do.
                                                                                                                                        • The paper ends up showing that the ARC can end up being better than manually trying to pick the best number for the workload, because it adapts as the workload changes
                                                                                                                                        • At about 1:25 into the video, Bryan start talking about the practical implementation of the ARC in ZFS, and some challenges they have run into recently at Joyent.
                                                                                                                                        • A great discussion about some of the problems when ZFS needs to shrink the ARC. Not all of it applies 1:1 to FreeBSD because the kernel and the kmem implementation are different in a number of ways
                                                                                                                                        • There were some interesting questions asked at the end as well
                                                                                                                                        • ***
                                                                                                                                          How do I use man pages to learn how to use commands?
                                                                                                                                          • nwildner on StackExchange has a very thorough answer to the question how to interpret man pages to understand complicated commands (xargs in this case, but not specifically).
                                                                                                                                          • Have in mind what you want to do.
                                                                                                                                          • When doing your research about xargs you did it for a purpose, right? You had a specific need that was reading standard output and executing commands based on that output.

                                                                                                                                            • But, when I don't know which command I want?
                                                                                                                                            • Use man -k or apropos (they are equivalent). If I don't know how to find a file: man -k file | grep search. Read the descriptions and find one that will better fit your needs.

                                                                                                                                              • Apropos works with regular expressions by default, (man apropos, read the description and find out what -r does), and on this example I'm looking for every manpage where the description starts with "report".
                                                                                                                                              • Always read the DESCRIPTION before starting

                                                                                                                                              • Take a time and read the description. By just reading the description of the xargs command we will learn that:

                                                                                                                                              • xargs reads from STDIN and executes the command needed. This also means that you will need to have some knowledge of how standard input works, and how to manipulate it through pipes to chain commands

                                                                                                                                                The default behavior is to act like /bin/echo. This gives you a little tip that if you need to chain more than one xargs, you don't need to use echo to print.
                                                                                                                                                We have also learned that unix filenames can contain blank and newlines, that this could be a problem and the argument -0 is a way to prevent things explode by using null character separators. The description warns you that the command being used as input needs to support this feature too, and that GNU find support it. Great. We use a lot of find with xargs.
                                                                                                                                                xargs will stop if exit status 255 is reached.

                                                                                                                                                • Some descriptions are very short and that is generally because the software works on a very simple way. Don't even think of skipping this part of the manpage ;)
                                                                                                                                                • Other things to pay attention...

                                                                                                                                                • You know that you can search for files using find. There is a ton of options and if you only look at the SYNOPSIS, you will get overwhelmed by those. It's just the tip of the iceberg. Excluding NAME, SYNOPSIS, and DESCRIPTION, you will have the following sections:

                                                                                                                                                • When this method will not work so well...

                                                                                                                                                  • Tips that apply to all commands
                                                                                                                                                    • Some options, mnemonics and "syntax style" travel through all commands making you buy some time by not having to open the manpage at all. Those are learned by practice and the most common are:
                                                                                                                                                    • Generally, -v means verbose. -vvv is a variation "very very verbose" on some software.

                                                                                                                                                      Following the POSIX standard, generally one dash arguments can be stacked. Example: tar -xzvf, cp -Rv.
                                                                                                                                                      Generally -R and/or -r means recursive.
                                                                                                                                                      Almost all commands have a brief help with the --help option.
                                                                                                                                                      --version shows the version of a software.
                                                                                                                                                      -p, on copy or move utilities means "preserve permissions".
                                                                                                                                                      -y means YES, or "proceed without confirmation" in most cases.

                                                                                                                                                      • Default values of commands.
                                                                                                                                                      • At the pager chunk of this answer, we saw that less -is is the pager of man. The default behavior of commands are not always shown at a separated section on manpages, or at the section that is most top placed.

                                                                                                                                                        You will have to read the options to find out defaults, or if you are lucky, typing /pager will lead you to that info. This also requires you to know the concept of the pager(software that scrolls the manpage), and this is a thing you will only acquire after reading lots of manpages.

                                                                                                                                                        • And what about the SYNOPSIS syntax?
                                                                                                                                                        • After getting all the information needed to execute the command, you can combine options, option-arguments and operands inline to make your job done. Overview of concepts:

                                                                                                                                                          Options are the switches that dictates a command behavior. "Do this" "don't do this" or "act this way". Often called switches.

                                                                                                                                                          • Check out the full answer and see if it helps you better grasp the meaning of a man page and thus the command.
                                                                                                                                                          • ***
                                                                                                                                                            My adventure into SSD caching with ZFS (Home NAS)
                                                                                                                                                            • Robert Putt as written about his adventure using SSDs for caching with ZFS on his home NAS.
                                                                                                                                                            • Recently I decided to throw away my old defunct 2009 MacBook Pro which was rotting in my cupboard and I decided to retrieve the only useful part before doing so, the 80GB Intel SSD I had installed a few years earlier. Initially I thought about simply adding it to my desktop as a bit of extra space but in 2017 80GB really wasn’t worth it and then I had a brainwave… Lets see if we can squeeze some additional performance out of my HP Microserver Gen8 NAS running ZFS by installing it as a cache disk.

                                                                                                                                                              I installed the SSD to the cdrom tray of the Microserver using a floppy disk power to SATA power converter and a SATA cable, unfortunately it seems the CD ROM SATA port on the motherboard is only a 3gbps port although this didn’t matter so much as it was an older 3gbps SSD anyway. Next I booted up the machine and to my suprise the disk was not found in my FreeBSD install, then I realised that the SATA port for the CD drive is actually provided by the RAID controller, so I rebooted into intelligent provisioning and added an additional RAID0 array with just the 1 disk to act as my cache, in fact all of the disks in this machine are individual RAID0 arrays so it looks like just a bunch of disks (JBOD) as ZFS offers additional functionality over normal RAID (mainly scrubbing, deduplication and compression).

                                                                                                                                                              • Configuration

                                                                                                                                                              • Lets have a look at the zpool before adding the cache drive to make sure there are no errors or uglyness:

                                                                                                                                                              • Now lets prep the drive for use in the zpool using gpart. I want to split the SSD into two seperate partitions, one for L2ARC (read caching) and one for ZIL (write caching). I have decided to split the disk into 20GB for ZIL and 50GB for L2ARC. Be warned using 1 SSD like this is considered unsafe because it is a single point of failure in terms of delayed writes (a redundant configuration with 2 SSDs would be more appropriate) and the heavy write cycles on the SSD from the ZIL is likely to kill it over time.

                                                                                                                                                                Now it’s time to see if adding the cache has made much of a difference. I suspect not as my Home NAS sucks, it is a HP Microserver Gen8 with the crappy Celeron CPU and only 4GB RAM, anyway, lets test it and find out. First off lets throw fio at the mount point for this zpool and see what happens both with the ZIL and L2ARC enabled and disabled.

                                                                                                                                                                • Observations
                                                                                                                                                                • Ok, so the initial result is a little dissapointing, but hardly unexpected, my NAS sucks and there are lots of bottle necks, CPU, memory and the fact only 2 of the SATA ports are 6gbps. There is no real difference performance wise in comparison between the results, the IOPS, bandwidth and latency appear very similar. However lets bare in mind fio is a pretty hardcore disk benchmark utility, how about some real world use cases?

                                                                                                                                                                  Next I decided to test a few typical file transactions that this NAS is used for, Samba shares to my workstation. For the first test I wanted to test reading a 3GB file over the network with both the cache enabled and disabled, I would run this multiple times to ensure the data is hot in the L2ARC and to ensure the test is somewhat repeatable, the network itself is an uncongested 1gbit link and I am copying onto the secondary SSD in my workstation. The dataset for these tests has compression and deduplication disabled.

                                                                                                                                                                  • Samba Read Test
                                                                                                                                                                  • Not bad once the data becomes hot in the L2ARC cache reads appear to gain a decent advantage compared to reading from the disk directly. How does it perform when writing the same file back accross the network using the ZIL vs no ZIL.

                                                                                                                                                                    • Samba Write Test
                                                                                                                                                                    • Another good result in the real world test, this certainately helps the write transfer speed however I do wonder what would happen if you filled the ZIL transferring a very large file, however this is unlikely with my use case as I typically only deal with a couple of files of several hundred megabytes at any given time so a 20GB ZIL should suit me reasonably well.

                                                                                                                                                                      • Is ZIL and L2ARC worth it?
                                                                                                                                                                      • I would imagine with a big beefy ZFS server running in a company somewhere with a large disk pool and lots of users with multiple enterprise level SSD ZIL and L2ARC would be well worth the investment, however at home I am not so sure. Yes I did see an increase in read speeds with cached data and a general increase in write speeds however it is use case dependant. In my use case I rarely access the same file frequently, my NAS primarily serves as a backup and for archived data, and although the write speeds are cool I am not sure its a deal breaker. If I built a new home NAS today I’d probably concentrate the budget on a better CPU, more RAM (for ARC cache) and more disks. However if I had a use case where I frequently accessed the same files and needed to do so in a faster fashion then yes, I’d probably invest in an SSD for caching. I think if you have a spare SSD lying around and you want something fun todo with it, sure chuck it in your ZFS based NAS as a cache mechanism. If you were planning on buying an SSD for caching then I’d really consider your needs and decide if the money can be spent on alternative stuff which would improve your experience with your NAS. I know my NAS would benefit more from an extra stick of RAM and a more powerful CPU, but as a quick evening project with some parts I had hanging around adding some SSD cache was worth a go.

                                                                                                                                                                        More Viewer Interview Questions for Allan
                                                                                                                                                                        News Roundup
                                                                                                                                                                        Setup OpenBSD 6.2 with Full Disk Encryption
                                                                                                                                                                        • Here is a quick way to setup (in 7 steps) OpenBSD 6.2 with the encryption of the filesystem.

                                                                                                                                                                        • First step: Boot and start the installation:

                                                                                                                                                                        • (I)nstall: I

                                                                                                                                                                          Keyboard Layout: ENTER (I'm french so in my case I took the FR layout)
                                                                                                                                                                          Leave the installer with: !

                                                                                                                                                                          • Second step: Prepare your disk for encryption.
                                                                                                                                                                          • Using a SSD, my disk is named : sd0, the name may vary, for example : wd0.

                                                                                                                                                                            Initiating the disk:
                                                                                                                                                                            Configure your volume:
                                                                                                                                                                            Now we'll use bioctl to encrypt the partition we created, in this case : sd0a (disk sd0 + partition « a »).
                                                                                                                                                                            Enter your passphrase.

                                                                                                                                                                            • Third step:
                                                                                                                                                                            • Let's resume the OpenBSD's installer. We follow the install procedure

                                                                                                                                                                              • Fourth step: Partitioning of the encrypted volume.
                                                                                                                                                                              • We select our new volume, in this case: sd1

                                                                                                                                                                                The whole disk will be used: W(hole)
                                                                                                                                                                                Let's create our partitions:
                                                                                                                                                                                NB: You are more than welcome to create multiple partitions for your system.

                                                                                                                                                                                • Fifth step: System installation
                                                                                                                                                                                • It's time to choose how we'll install our system (network install by http in my case)

                                                                                                                                                                                  • Sixth step: Finalize the installation.

                                                                                                                                                                                  • Last step: Reboot and start your system.

                                                                                                                                                                                  • Put your passphrase. Welcome to OpenBSD 6.2 with a full encrypted file system.

                                                                                                                                                                                    • Optional: Disable the swap encryption.
                                                                                                                                                                                    • The swap is actually part of the encrypted filesystem, we don't need OpenBSD to encrypt it. Sysctl is giving us this possibility.

                                                                                                                                                                                      Step-by-Step FreeBSD installation with ZFS and Full Disk Encryption
                                                                                                                                                                                      • 1. What do I need?
                                                                                                                                                                                        • For this tutorial, the installation has been made on a Intel Core i7 - AMD64 architecture.
                                                                                                                                                                                        • On a USB key, you would probably use this link : ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/11.1/FreeBSD-11.1-RELEASE-amd64-mini-memstick.img
                                                                                                                                                                                        • If you can't do a network installation, you'd better use this image : ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/11.1/FreeBSD-11.1-RELEASE-amd64-memstick.img
                                                                                                                                                                                        • You can write the image file on your USB device (replace XXXX with the name of your device) using dd : # dd if=FreeBSD-11.1-RELEASE-amd64-mini-memstick.img of=/dev/XXXX bs=1m
                                                                                                                                                                                        • 2. Boot and install: Screenshot
                                                                                                                                                                                        • 3. Configure your keyboard layout: Screenshot & Screenshot
                                                                                                                                                                                        • 4. Hostname and system components configuration :
                                                                                                                                                                                          • Set the name of your machine: [Screenshot](https://blog.cagedmonster.net/content/images/2017/09/F4.png_
                                                                                                                                                                                          • What components do you want to install? Screenshot
                                                                                                                                                                                          • 5. Network configuration:
                                                                                                                                                                                            • Select the network interface you want to configure. Screenshot
                                                                                                                                                                                            • First, we configure our IPv4 network. I used a static adress so you can see how it works, but you can use DHCP for an automated configuration, it depends of what you want to do with your system (desktop/server) Screenshot & Screenshot & Screenshot
                                                                                                                                                                                            • IPv6 network configuration. Same as for IPv4, you can use SLAAC for an automated configuration. Screenshot & Screenshot & Screenshot
                                                                                                                                                                                              • Here, you can configure your DNS servers, I used the Google DNS servers so you can use them too if needed. Screenshot
                                                                                                                                                                                              • 6. Select the server you want to use for the installation:
                                                                                                                                                                                                • I always use the IPv6 mirror to ensure that my IPv6 network configuration is good.Screenshot
                                                                                                                                                                                                • 7. Disk configuration:
                                                                                                                                                                                                  • As we want to do an easy full disk encryption, we'll use ZFS. Screenshot
                                                                                                                                                                                                  • Make sure to select the disk encryption :Screenshot
                                                                                                                                                                                                  • Launch the disk configuration :Screenshot
                                                                                                                                                                                                  • Here everything is normal, you have to select the disk you'll use :Screenshot
                                                                                                                                                                                                  • I have only one SSD disk named da0 :Screenshot
                                                                                                                                                                                                  • Last chance before erasing your disk :Screenshot
                                                                                                                                                                                                  • Time to choose the password you'll use to start your system : Screenshot & Screenshot & Screenshot
                                                                                                                                                                                                  • 8. Last steps to finish the installation:
                                                                                                                                                                                                    • The installer will download what you need and what you selected previously (ports, src, etc.) to create your system: Screenshot
                                                                                                                                                                                                    • 8.1. Root password:
                                                                                                                                                                                                      • Enter your root password: Screenshot
                                                                                                                                                                                                      • 8.2. Time and date:
                                                                                                                                                                                                        • Set your timezone, in my case: Europe/France Screenshot & Screenshot & Screenshot
                                                                                                                                                                                                        • Make sure the date and time are good, or you can change them :Screenshot & Screenshot
                                                                                                                                                                                                        • 8.3. Services:
                                                                                                                                                                                                          • Select the services you'll use at system startup depending again of what you want to do. In many cases powerd and ntpd will be useful, sshd if you're planning on using FreeBSD as a server. Screenshot
                                                                                                                                                                                                          • 8.4. Security:
                                                                                                                                                                                                            • Security options you want to enable. You'll still be able to change them after the installation with sysctl. Screenshot
                                                                                                                                                                                                            • 8.5. Additionnal user:
                                                                                                                                                                                                              • Create an unprivileged system user: Screenshot
                                                                                                                                                                                                              • Make sure your user is in the wheel group so he can use the su command. Screenshot & Screenshot
                                                                                                                                                                                                              • 8.6. The end:
                                                                                                                                                                                                              • End of your configuration, you can still do some modifications if you want : Screenshot & Screenshot & Screenshot
                                                                                                                                                                                                              • 9. First boot:
                                                                                                                                                                                                                • Enter the passphrase you have chosen previously : Screenshot & Screenshot & Screenshot
                                                                                                                                                                                                                • Welcome to Freebsd 11.1 with full disk encryption!
                                                                                                                                                                                                                • ***
                                                                                                                                                                                                                  The anatomy of ldd program on OpenBSD

                                                                                                                                                                                                                  In the past week, I read the ldd source code on OpenBSD to get a better understanding of how it works. And this post should also be a reference for other*NIX OSs.

                                                                                                                                                                                                                  • The ELF file is divided into 4 categories: relocatable, executable, shared, and core. Only the executable and shared object files may have dynamic object dependencies, so the ldd only check these 2 kinds of ELF file:
                                                                                                                                                                                                                  • (1) Executable. ldd leverages the LD_TRACE_LOADED_OBJECTS environment variable in fact, and the code is as following:
                                                                                                                                                                                                                  • if (setenv("LD_TRACE_LOADED_OBJECTS", "true", 1) < 0)
                                                                                                                                                                                                                    err(1, "setenv(LD_TRACE_LOADED_OBJECTS)");

                                                                                                                                                                                                                    When LD_TRACE_LOADED_OBJECTS is set to 1 or true, running executable file will show shared objects needed instead of running it, so you even not needldd to check executable file. See the following outputs:

                                                                                                                                                                                                                    $ /usr/bin/ldd
                                                                                                                                                                                                                    usage: ldd program ...
                                                                                                                                                                                                                    $ LD_TRACE_LOADED_OBJECTS=1 /usr/bin/ldd
                                                                                                                                                                                                                    Start End Type Open Ref GrpRef Name
                                                                                                                                                                                                                    00000b6ac6e00000 00000b6ac7003000 exe 1 0 0 /usr/bin/ldd
                                                                                                                                                                                                                    00000b6dbc96c000 00000b6dbcc38000 rlib 0 1 0 /usr/lib/libc.so.89.3
                                                                                                                                                                                                                    00000b6d6ad00000 00000b6d6ad00000 rtld 0 1 0 /usr/libexec/ld.so
                                                                                                                                                                                                                    • (2) Shared object. The code to print dependencies of shared object is as following:
                                                                                                                                                                                                                    • if (ehdr.e_type == ET_DYN && !interp) {
                                                                                                                                                                                                                      if (realpath(name, buf) == NULL) {
                                                                                                                                                                                                                      printf("realpath(%s): %s", name,
                                                                                                                                                                                                                      strerror(errno));
                                                                                                                                                                                                                      fflush(stdout);
                                                                                                                                                                                                                      _exit(1);
                                                                                                                                                                                                                      }
                                                                                                                                                                                                                      dlhandle = dlopen(buf, RTLD_TRACE);
                                                                                                                                                                                                                      if (dlhandle == NULL) {
                                                                                                                                                                                                                      printf("%s\n", dlerror());
                                                                                                                                                                                                                      fflush(stdout);
                                                                                                                                                                                                                      _exit(1);
                                                                                                                                                                                                                      }
                                                                                                                                                                                                                      _exit(0);
                                                                                                                                                                                                                      }

                                                                                                                                                                                                                      Why the condition of checking a ELF file is shared object or not is like this:

                                                                                                                                                                                                                      if (ehdr.e_type == ET_DYN && !interp) {
                                                                                                                                                                                                                      ......
                                                                                                                                                                                                                      }

                                                                                                                                                                                                                      That’s because the file type of position-independent executable (PIE) is the same as shared object, but normally PIE contains a interpreter program header since it needs dynamic linker to load it while shared object lacks (refer this article). So the above condition will filter PIE file.

                                                                                                                                                                                                                      The dlopen(buf, RTLD_TRACE) is used to print dynamic object information. And the actual code is like this:

                                                                                                                                                                                                                      if (_dl_traceld) {
                                                                                                                                                                                                                      _dl_show_objects();
                                                                                                                                                                                                                      _dl_unload_shlib(object);
                                                                                                                                                                                                                      _dl_exit(0);
                                                                                                                                                                                                                      }

                                                                                                                                                                                                                      In fact, you can also implement a simple application which outputs dynamic object information for shared object yourself:

                                                                                                                                                                                                                      # include
                                                                                                                                                                                                                      int main(int argc, char **argv)
                                                                                                                                                                                                                      {
                                                                                                                                                                                                                      dlopen(argv[1], RTLD_TRACE);
                                                                                                                                                                                                                      return 0;
                                                                                                                                                                                                                      }

                                                                                                                                                                                                                      Compile and use it to analyze /usr/lib/libssl.so.43.2:

                                                                                                                                                                                                                      $ cc lddshared.c
                                                                                                                                                                                                                      $ ./a.out /usr/lib/libssl.so.43.2
                                                                                                                                                                                                                      Start End Type Open Ref GrpRef Name
                                                                                                                                                                                                                      000010e2df1c5000 000010e2df41a000 dlib 1 0 0 /usr/lib/libssl.so.43.2
                                                                                                                                                                                                                      000010e311e3f000 000010e312209000 rlib 0 1 0 /usr/lib/libcrypto.so.41.1

                                                                                                                                                                                                                      The same as using ldd directly:

                                                                                                                                                                                                                      $ ldd /usr/lib/libssl.so.43.2
                                                                                                                                                                                                                      /usr/lib/libssl.so.43.2:
                                                                                                                                                                                                                      Start End Type Open Ref GrpRef Name
                                                                                                                                                                                                                      00001d9ffef08000 00001d9fff15d000 dlib 1 0 0 /usr/lib/libssl.so.43.2
                                                                                                                                                                                                                      00001d9ff1431000 00001d9ff17fb000 rlib 0 1 0 /usr/lib/libcrypto.so.41.1

                                                                                                                                                                                                                      Through the studying of ldd source code, I also get many by-products: such as knowledge of ELF file, linking and loading, etc. So diving into code is a really good method to learn *NIX deeper!

                                                                                                                                                                                                                      Perl5 Slack Syslog BSD daemon

                                                                                                                                                                                                                      So I have been working on my little Perl daemon for a week now.

                                                                                                                                                                                                                      It is a simple syslog daemon that listens on port 514 for incoming messages. It listens on a port so it can process log messages from my consumer Linux router as well as the messages from my server. Messages that are above alert are sent, as are messages that match the regex of SSH or DHCP (I want to keep track of new connections to my wifi). The rest of the messages are not sent to slack but appended to a log file. This is very handy as I can get access to info like failed ssh logins, disk failures, and new devices connecting to the network all on my Android phone when I am not home.

                                                                                                                                                                                                                      • Screenshot
                                                                                                                                                                                                                      • The situation arose today that the internet went down and I thought to myself what would happen to all my important syslog messages when they couldn’t be sent? Before the script only ran an eval block on the botsend() function. The error was returned, handled, but nothing was done and the unsent message was discarded. So I added a function that appended unsent messengers to an array that are later sent when the server is not busy sending messages to slack.

                                                                                                                                                                                                                        Slack has a limit of one message per second. The new addition works well and means that if the internet fails my server will store these messages in memory and resend them at a rate of one message per second when the internet connectivity returns. It currently sends the newest ones first but I am not sure if this is a bug or a feature at this point! It currently works with my Linux based WiFi router and my FreeBSD server. It is easy to scale as all you need to do is send messages to syslog to get them sent to slack. You could sent CPU temp, logged in users etc.

                                                                                                                                                                                                                        • There is a github page: https://github.com/wilyarti/slackbot
                                                                                                                                                                                                                        • Lscpu for OpenBSD/FreeBSD
                                                                                                                                                                                                                          • Github Link
                                                                                                                                                                                                                          • There is a neat command, lscpu, which is very handy to display CPU information on GNU/Linux OS:

                                                                                                                                                                                                                            $ lscpu
                                                                                                                                                                                                                            Architecture: x86_64
                                                                                                                                                                                                                            CPU op-mode(s): 32-bit, 64-bit
                                                                                                                                                                                                                            Byte Order: Little Endian
                                                                                                                                                                                                                            CPU(s): 32
                                                                                                                                                                                                                            On-line CPU(s) list: 0-31
                                                                                                                                                                                                                            Thread(s) per core: 2
                                                                                                                                                                                                                            Core(s) per socket: 8
                                                                                                                                                                                                                            Socket(s): 2

                                                                                                                                                                                                                            But unfortunately, the BSD OSs lack this command, maybe one reason is lscpu relies heavily on /proc file system which BSD don’t provide, :-). TakeOpenBSD as an example, if I want to know CPU information, dmesg should be one choice:

                                                                                                                                                                                                                            $ dmesg | grep -i cpu
                                                                                                                                                                                                                            cpu0 at mainbus0: apid 0 (boot processor)
                                                                                                                                                                                                                            cpu0: Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz, 2527.35 MHz
                                                                                                                                                                                                                            cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,
                                                                                                                                                                                                                            PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
                                                                                                                                                                                                                            cpu0: 3MB 64b/line 8-way L2 cache
                                                                                                                                                                                                                            cpu0: apic clock running at 266MHz
                                                                                                                                                                                                                            cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2.1.3, IBE

                                                                                                                                                                                                                            But the output makes me feeling messy, not very clear. As for dmidecode, it used to be another option, but now can’t work out-of-box because it will access /dev/mem which for security reason, OpenBSD doesn’t allow by default (You can refer this discussion):

                                                                                                                                                                                                                            $ ./dmidecode
                                                                                                                                                                                                                            $ dmidecode 3.1
                                                                                                                                                                                                                            Scanning /dev/mem for entry point.
                                                                                                                                                                                                                            /dev/mem: Operation not permitted

                                                                                                                                                                                                                            Based on above situation, I want a specified command for showing CPU information for my BSD box. So in the past 2 weeks, I developed a lscpu program for OpenBSD/FreeBSD, or more accurately, OpenBSD/FreeBSD on x86 architecture since I only have some Intel processors at hand. The application getsCPU metrics from 2 sources:

                                                                                                                                                                                                                            • (1) sysctl functions. The BSD OSs provide sysctl interface which I can use to get general CPU particulars, such as how many CPUs the system contains, the byte-order of CPU, etc.
                                                                                                                                                                                                                            • (2) CPUID instruction. For x86 architecture, CPUID instruction can obtain very detail information of CPU. This coding work is a little tedious and error-prone, not only because I need to reference both Intel and AMD specifications since these 2 vendors have minor distinctions, but also I need to parse the bits of register values.
                                                                                                                                                                                                                            • The code is here, and if you run OpenBSD/FreeBSD on x86 processors, please try it. It will be better you can give some feedback or report the issues, and I appreciate it very much. In the future if I have other CPUs resource, such as ARM or SPARC64, maybe I will enrich this small program.
                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                              Beastie Bits
                                                                                                                                                                                                                              • OpenBSD Porting Workshop - Brian Callahan will be running an OpenBSD porting workshop in NYC for NYC*BUG on December 6, 2017.
                                                                                                                                                                                                                              • Learn to tame OpenBSD quickly
                                                                                                                                                                                                                              • Detect the operating system using UDP stack corner cases
                                                                                                                                                                                                                              • ***
                                                                                                                                                                                                                                Feedback/Questions
                                                                                                                                                                                                                                • Awesome Mike - ZFS Questions
                                                                                                                                                                                                                                • Michael - Expanding a file server with only one hard drive with ZFS - information based on Allan's IRC response
                                                                                                                                                                                                                                • Brian - Optimizing ZFS for a single disk
                                                                                                                                                                                                                                • ***
                                                                                                                                                                                                                                  2 hr 11 min
                                                                                                                                                                                                                                • 218: A KRACK in the WiFi

                                                                                                                                                                                                                                  FreeBSD 10.4-RELEASE is here, more EuroBSDcon travel notes, the KRACK attack, ZFS and DTrace on NetBSD, and pfsense 2.4.

                                                                                                                                                                                                                                  This episode was brought to you by

                                                                                                                                                                                                                                  Headlines
                                                                                                                                                                                                                                  FreeBSD 10.4-RELEASE Available
                                                                                                                                                                                                                                  • FreeBSD 10.4-RELEASE is out. The FreeBSD Project dedicates the FreeBSD 10.4-RELEASE to the memory of Andrey A. Chernov.
                                                                                                                                                                                                                                  • Some of the highlights:
                                                                                                                                                                                                                                  • 10.4-RELEASE is the first FreeBSD release to feature full support for eMMC storage, including eMMC partitions, TRIM and bus speed modes up to HS400. Please note, though, that availability of especially the DDR52, HS200 and HS400 modes requires support in the actual sdhci(4) front-end as well as by the hardware used. Also note, that the SDHCI controller part of Intel® Apollo Lake chipsets is affected by several severe silicon bugs. Apparently, it depends on the particular Apollo Lake platform whether the workarounds in place so far are sufficient to avoid timeouts on attaching sdhci(4) there.

                                                                                                                                                                                                                                    Also in case a GPT disk label is used, the fsck_ffs(8) utility now is able to find alternate superblocks.
                                                                                                                                                                                                                                    The aesni(4) driver now no longer shares a single FPU context across multiple sessions in multiple threads, addressing problems seen when employing aesni(4) for accelerating ipsec(4).
                                                                                                                                                                                                                                    Support for the Kaby Lake generation of Intel® i219(4)/ i219(5) devices has been added to the em(4) driver.
                                                                                                                                                                                                                                    The em(4) driver is now capable of enabling Wake On LAN (WOL) also for Intel® i217, i218 and i219 chips. Note that stale interface configurations from previous unsuccessful attempts to enable WOL for these devices now will actually take effect. For example, an ifconfig em0 wol activates all WOL variants including wol_mcast, which might be undesirable.
                                                                                                                                                                                                                                    Support for WOL has been added to the igb(4) driver, which was not able to activate this feature on any device before. The same remark regarding stale WOL configurations as for the em(4) driver applies.
                                                                                                                                                                                                                                    Userland coredumps can now trigger events such as generating a human readable crash report via devd(8). This feature is off by default.
                                                                                                                                                                                                                                    The firmware shipping with the qlxgbe(4) driver has been updated to version 5.4.66. Additionally, this driver has received some TSO and locking fixes, performance optimizations as well as SYSCTLs providing MAC, RX and TX statistics.
                                                                                                                                                                                                                                    Mellanox® ConnectX-4 series adapters are now supported by the newly added mlx5ib(4) driver.
                                                                                                                                                                                                                                    OpenSSH received an update to version 7.3p1.
                                                                                                                                                                                                                                    GNOME has been updated to version 3.18.
                                                                                                                                                                                                                                    Xorg-Server has been updated to version 1.18.4.

                                                                                                                                                                                                                                    • Check out the full release notes and upgrade your systems to 10.4-RELEASE. Thanks to the FreeBSD Release Engineering Team for their efforts.
                                                                                                                                                                                                                                    • ***
                                                                                                                                                                                                                                      EuroBSDcon 2017: "travel notes" after the conference
                                                                                                                                                                                                                                      • Leonardo Taccari posted in the NetBSD blog about his experiences at EuroBSDcon 2017:
                                                                                                                                                                                                                                      • Let me tell you about my experience at EuroBSDcon 2017 in Paris, France. We will see what was presented during the NetBSD developer summit on Friday and then we will give a look to all of the NetBSD and pkgsrc presentations given during the conference session on Saturday and Sunday. Of course, a lot of fun also happened on the "hall track", the several breaks during the conference and the dinners we had together with other *BSD developers and community! This is difficult to describe and I will try to just share some part of that with photographs that we have taken. I can just say that it was a really beautiful experience, I had a great time with others and, after coming back home... ...I miss all of that! :) So, if you have never been in any BSD conferences I strongly suggest you to go to the next ones, so please stay tuned via NetBSD Events. Being there this is probably the only way to understand these feelings!

                                                                                                                                                                                                                                        • Thursday (21/09): NetBSD developers dinner
                                                                                                                                                                                                                                        • Arriving in Paris via a night train from Italy I literally sleep-walked through Paris getting lost again and again. After getting in touch with other developers we had a dinner together and went sightseeing for aWseveral beers!

                                                                                                                                                                                                                                          Friday (22/09): NetBSD developers summit
                                                                                                                                                                                                                                          On Friday morning we met for the NetBSD developers summit kindly hosted by Arolla.
                                                                                                                                                                                                                                          NetBSD on Google Compute Engine -- Benny Siegert (bsiegert)
                                                                                                                                                                                                                                          Scripting DDB with Forth -- Valery Ushakov (uwe)
                                                                                                                                                                                                                                          News from the version control front -- Jörg Sonnenberger (joerg)
                                                                                                                                                                                                                                          Afternoon discussions and dinner
                                                                                                                                                                                                                                          After the lunch we had several non-scheduled discussions, some time for hacking, etc.
                                                                                                                                                                                                                                          We then had a nice dinner together (it was in a restaurant with a very nice waiter who always shouted after every order or after accidentally dropping and crashing dishes!, yeah! That's probably a bit weird but I liked that attitude! :)) and then did some sightseeing and had a beer together.

                                                                                                                                                                                                                                          • Saturday (23/09): First day of conference session and Social Event
                                                                                                                                                                                                                                          • A Modern Replacement for BSD spell(1) -- Abhinav Upadhyay (abhinav)

                                                                                                                                                                                                                                            Portable Hotplugging: NetBSD's uvm_hotplug(9) API development -- Cherry G.
                                                                                                                                                                                                                                            Mathew (cherry)
                                                                                                                                                                                                                                            Hardening pkgsrc -- Pierre Pronchery (khorben)
                                                                                                                                                                                                                                            Reproducible builds on NetBSD -- Christos Zoulas (christos)

                                                                                                                                                                                                                                            • Social event
                                                                                                                                                                                                                                            • The social event on Saturday evening took place on a boat that cruised on the Seine river.

                                                                                                                                                                                                                                              It was a very nice and different way to sightsee Paris, eat and enjoy some drinks and socialize and discuss with other developers and community.

                                                                                                                                                                                                                                              • Sunday (24/09): Second day of conference session
                                                                                                                                                                                                                                              • The school of hard knocks - PT1 -- Sevan Janiyan (sevan)
                                                                                                                                                                                                                                                The LLDB Debugger on NetBSD -- Kamil Rytarowski (kamil)
                                                                                                                                                                                                                                                What's in store for NetBSD 8.0? -- Alistair Crooks (agc)
                                                                                                                                                                                                                                                • Sunday dinner
                                                                                                                                                                                                                                                • After the conference we did some sightseeing in Paris, had a dinner together and then enjoyed some beers!

                                                                                                                                                                                                                                                  • Conclusion
                                                                                                                                                                                                                                                  • It was a very nice weekend and conference. It is worth to mention that EuroBSDcon 2017 was the biggest BSD conference (more than 300 people attended it!).

                                                                                                                                                                                                                                                    I would like to thank the entire EuroBSDcon organising committee (Baptiste Daroussin, Antoine Jacoutot, Jean-Sébastien Pédron and Jean-Yves Migeon), EuroBSDcon programme committee (Antoine Jacoutot, Lars Engels, Ollivier Robert, Sevan Janiyan, Jörg Sonnenberger, Jasper Lievisse Adriaanse and Janne Johansson) and EuroBSDcon Foundation for organizing such a wonderful conference!
                                                                                                                                                                                                                                                    I also would like to thank the speakers for presenting very interesting talks, all developers and community that attended the NetBSD devsummit and conference, in particular Jean-Yves and Jörg, for organizing and moderating the devsummit and Arolla that kindly hosted us for the NetBSD devsummit!
                                                                                                                                                                                                                                                    A special thanks also to Abhinav (abhinav) and Martin (martin) for photographs and locals Jean-Yves (jym) and Stoned (seb) for helping us in not get lost in Paris' rues! :)

                                                                                                                                                                                                                                                    • Thank you!
                                                                                                                                                                                                                                                    • ***
                                                                                                                                                                                                                                                      WiFi Vulnerability in WPA2: KRACK

                                                                                                                                                                                                                                                      “We discovered serious weaknesses in WPA2, a protocol that secures all modern protected Wi-Fi networks. An attacker within range of a victim can exploit these weaknesses using key reinstallation attacks (KRACKs). Concretely, attackers can use this novel attack technique to read information that was previously assumed to be safely encrypted. This can be abused to steal sensitive information such as credit card numbers, passwords, chat messages, emails, photos, and so on. The attack works against all modern protected Wi-Fi networks. Depending on the network configuration, it is also possible to inject and manipulate data. For example, an attacker might be able to inject ransomware or other malware into websites.”

                                                                                                                                                                                                                                                      “Note that if your device supports Wi-Fi, it is most likely affected. During our initial research, we discovered ourselves that Android, Linux, Apple, Windows, OpenBSD, MediaTek, Linksys, and others, are all affected by some variant of the attacks. For more information about specific products, consult the database of CERT/CC, or contact your vendor.”

                                                                                                                                                                                                                                                      • FreeBSD Advisory
                                                                                                                                                                                                                                                      • As of the date of this recording, a few weeks ahead of when this episode will air, the issue is fixed in FreeBSD 11.0 and 11.1, and a workaround has been provided for 10.3 and 10.4 (install newer wpa_supplicant from ports). A fix for 10.3 and 10.4 is expected soon. They will more than likely be out by time you are watching this.
                                                                                                                                                                                                                                                      • The fix for 10.3 and 10.4 is more complicated because the version of wpa_supplicant included in the base system is 2.0, from January 2013, so is nearly 5 years old, so the patches do not apply cleanly. The security team is still considering if it will try to patch 2.0, or just replace the version of wpa_supplicant with 2.5 from FreeBSD 11.x.
                                                                                                                                                                                                                                                      • OpenBSD was unwilling to wait when the embargo was extended on this vulnerability and stealth fixed the issue on Aug 30th
                                                                                                                                                                                                                                                      • [email protected] ‘s Mastodon post
                                                                                                                                                                                                                                                      • Lobste.rs conversation about flaw and OpenBSD’s reaction
                                                                                                                                                                                                                                                      • “What happened is that he told me on July 15, and gave a 6 weeks embargo until end of August. We already complained back then that this was way too long and leaving people exposed. Then he got CERT (and, thus, US gov agencies) involved and had to extend the embargo even further until today. At that point we already had the ball rolling and decided to stick to the original agreement with him, and he gave us an agreeing nod towards that as well.”

                                                                                                                                                                                                                                                        “In this situation, a request for keeping the problem and fix secret is a request to leave our users at risk and exposed to insiders who will potentially use the bug to exploit our users. And we have no idea who the other insiders are. We have to assume that information of this kind leaks and dissipates pretty fast in the security “community”.”
                                                                                                                                                                                                                                                        “We chose to serve the needs of our users who are the vulnerable people in this drama. I stand by that choice.”

                                                                                                                                                                                                                                                        • As a result of this:
                                                                                                                                                                                                                                                        • “To avoid this problem in the future, OpenBSD will now receive vulnerability notifications closer to the end of an embargo.”

                                                                                                                                                                                                                                                          • NetBSD: “patches for the WPA issues in KRACK Attacks were committed Oct 16th to HEAD & are pending pullup to 6/7/8 branches”
                                                                                                                                                                                                                                                          • As of this recording, Dragonfly appears to use wpa_supplicant 2.1 which they imported in 2014 and has not been touched in over a year
                                                                                                                                                                                                                                                          • ***
                                                                                                                                                                                                                                                            News Roundup
                                                                                                                                                                                                                                                            NetBSD - dtrace and ZFS update
                                                                                                                                                                                                                                                            • Chuck Silvers writes to the tech-kern mailing list of NetBSD:
                                                                                                                                                                                                                                                            • I've been working on updating netbsd's copy of the dtrace and zfs code to rebase from the existing ancient opensolaris version to a recent freebsd version. most of the freebsd changes are pretty close to what netbsd needs, so that seems like a more useful upstream for us. I have things working well enough now that I want to share the code in preparation for committing.

                                                                                                                                                                                                                                                              • this update improves upon our existing dtrace/zfs code in several ways:
                                                                                                                                                                                                                                                              • picks up all the upstream zfs fixes and enhancements from the last decade

                                                                                                                                                                                                                                                                zfs now supports mmap on netbsd, so you can run executables stored in zfs
                                                                                                                                                                                                                                                                dtrace fbt probes can now be used in kernel modules (such as zfs)

                                                                                                                                                                                                                                                                • A patch is provided here: http://ftp.netbsd.org/pub/NetBSD/misc/chs/diff.cddl.20171012 which needs to be applied using “patch -E” as it adds and removes files.
                                                                                                                                                                                                                                                                • He provides the following summary for the diff:
                                                                                                                                                                                                                                                                • freebsd's dtrace/zfs code as of r315983 (2017-03-26), adapted for netbsd.

                                                                                                                                                                                                                                                                  a few updates to our copy of freebsd's libproc.
                                                                                                                                                                                                                                                                  build system support for using -fno-omit-frame-pointer everywhere and disabling other compiler optimizations that confuse dtrace.
                                                                                                                                                                                                                                                                  sample kernel config changes for a couple evbarm configs (the ones I tested).
                                                                                                                                                                                                                                                                  module/ksyms enhancements for dtrace integration.
                                                                                                                                                                                                                                                                  genfs API enhancements to support zfs.
                                                                                                                                                                                                                                                                  an option to have mutexes not become no-ops during a panic.
                                                                                                                                                                                                                                                                  uvm_aobj API change to support 64-bit aobj sizes (eg. for tmpfs).

                                                                                                                                                                                                                                                                  • Known issues with the patch include:
                                                                                                                                                                                                                                                                  • unloading the zfs module fails even with no zpools imported if you've done much with zfs since it was loaded. there's some refcounting problem that I haven't tracked down yet.

                                                                                                                                                                                                                                                                    the module refcounting for active fbt probes is bogus. currently module refcounting is protected by kernconfig_lock(), but taking that lock down in the bowels of dtrace seems likely to create deadlocks. I plan to do something fancier but haven't gotten to it yet.
                                                                                                                                                                                                                                                                    the dtrace uregs[] stuff is probably still wrong.
                                                                                                                                                                                                                                                                    the CTF typeid overflow problem is still there (more on this below).

                                                                                                                                                                                                                                                                    • Unsupported features include:
                                                                                                                                                                                                                                                                    • the ".zfs" virtual directory, eg. ".zfs/snapshot/foo@bar"

                                                                                                                                                                                                                                                                      zvols
                                                                                                                                                                                                                                                                      ZFS ACLs (aka. NFSv4 ACLs)
                                                                                                                                                                                                                                                                      NFS exporting a ZFS file system
                                                                                                                                                                                                                                                                      setting dtrace probes in application code
                                                                                                                                                                                                                                                                      using ZFS as the root fs
                                                                                                                                                                                                                                                                      new crypto hashes SHA512_256, skein, and edonr (the last one is not in freebsd yet either)
                                                                                                                                                                                                                                                                      zio delay injection (used for testing zfs)
                                                                                                                                                                                                                                                                      dtrace support for platforms other than x86 and arm

                                                                                                                                                                                                                                                                      • A more detailed description of the CTF typeid overflow is also provided. Check out the full thread with followups and try out the patch if you’re on NetBSD.
                                                                                                                                                                                                                                                                      • ***
                                                                                                                                                                                                                                                                        pfSense 2.4.0-RELEASE Now Available!
                                                                                                                                                                                                                                                                        • Jim Pingle writes about the new release:
                                                                                                                                                                                                                                                                        • We are excited to announce the release of pfSense® software version 2.4, now available for new installations and upgrades!

                                                                                                                                                                                                                                                                          pfSense software version 2.4.0 was a herculean effort! It is the culmination of 18 months of hard work by Netgate and community contributors, with over 290 items resolved. According to git, 671 files were changed with a total 1651680 lines added, and 185727 lines deleted. Most of those added lines are from translated strings for multiple language support!

                                                                                                                                                                                                                                                                          • Highlights
                                                                                                                                                                                                                                                                          • FreeBSD 11.1-RELEASE as the base Operating System

                                                                                                                                                                                                                                                                            New pfSense installer based on bsdinstall, with support for ZFS, UEFI, and multiple types of partition layouts (e.g. GPT, BIOS)
                                                                                                                                                                                                                                                                            Support for Netgate ARM devices such as the SG-1000
                                                                                                                                                                                                                                                                            OpenVPN 2.4.x support, which brings features like AES-GCM ciphers, speed improvements, Negotiable Crypto Parameters (NCP), TLS encryption, and dual stack/multihome
                                                                                                                                                                                                                                                                            Translation of the GUI into 13 different languages! For more information on contributing to the translation effort, read our previous blog post and visit the project on Zanata
                                                                                                                                                                                                                                                                            WebGUI improvements, such as a new login page, improved GET/POST CSRF handling, significant improvements to the Dashboard and its AJAX handling
                                                                                                                                                                                                                                                                            Certificate Management improvements including CSR signing and international character support
                                                                                                                                                                                                                                                                            Captive Portal has been rewritten to work without multiple instances of ipfw

                                                                                                                                                                                                                                                                            • Important Information:
                                                                                                                                                                                                                                                                            • 32-bit x86 and NanoBSD have been deprecated and are not supported on pfSense 2.4.

                                                                                                                                                                                                                                                                              • Read the full release notes and let them know how you like the new release.
                                                                                                                                                                                                                                                                              • ***
                                                                                                                                                                                                                                                                                OpenBSD changes of note 629
                                                                                                                                                                                                                                                                                • Use getrusage to measure CPU time in md5 benchmarking.
                                                                                                                                                                                                                                                                                • Add guard pages at the end of kernel stacks so overflows don’t run into important stuff.
                                                                                                                                                                                                                                                                                  • This would be useful in FreeBSD, even just to detect the condition. I had all kinds of strange crashes when I was accidently overflowing the stack when working on the initial version of the ZSTD patches before ZSTD gained a working heap mode.
                                                                                                                                                                                                                                                                                  • Add dwxe driver for ethernet found on Allwinner A64, H3 and H5 SoCs.
                                                                                                                                                                                                                                                                                  • Fix a regression caused by removal of SIGIO from some devices.
                                                                                                                                                                                                                                                                                  • In malloc, always delay freeing chunks and change ‘F’ option to perform a more extensive check for double free.
                                                                                                                                                                                                                                                                                  • Change sendsyslog prototype to take a string, since there’s little point logging not strings.
                                                                                                                                                                                                                                                                                  • The config program tries to modify zero initialized variables. Previous versions of gcc were patched to place these in the data segment, instead of the bss, but clang has no such patches. Long long ago, this was the default behavior for compilers, which is why gcc was patched to maintain that existing behavior, but now we want a slightly less unusual toolchain. Fix the underlying issue for now by annotating such variables with a data section attribute.
                                                                                                                                                                                                                                                                                  • ***
                                                                                                                                                                                                                                                                                    t2k17 Hackathon Report: Philip Guenther: locking and libc
                                                                                                                                                                                                                                                                                    • Next up in our series of t2k17 hackathon reports is this one from Philip Guenther:
                                                                                                                                                                                                                                                                                    • I showed up at t2k17 with a couple hold-over diffs from e2k17 that weren't stable then and hadn't gotten much better since, so after a red-eye through Chicago I arrived in the hackroom, fired up my laptop and synced trees.

                                                                                                                                                                                                                                                                                      Meanwhile, people trickled in and the best part of hackathons, the conversations and "what do you think about this?" chats started. Theo introduced me to Todd Mortimer (mortimer@), who's been hacking on clang to implement RETGUARD for C programs. Over the hackathon we discussed a few loose ends that cropped up and what the correct behavior should be for them as well as the mechanics of avoiding 0xc3 bytes (the RET opcode) embedded in the middle of other multi-byte x86 machine code. Fun stuff.
                                                                                                                                                                                                                                                                                      Martin (mpi@) and I had a conversation about the desirability of being able to sleep while holding netlock and pretty much came down on "oof, the scheduler does need work before the underlying issue driving this question can be resolved enough to answer it". :-(
                                                                                                                                                                                                                                                                                      After some final hammering I got in an enhancement to pool(9) to let a pool use (sleeping) rwlocks instead of (spinning) mutexes and then immediately used that for the per-CPU pool cache pool as well as the futex pool. Further pools are likely to be converted as well kernel upper-level locking changes are made.
                                                                                                                                                                                                                                                                                      Speaking of, a larger diff I had been working on for said upper-level locking was still suffering deadlock issues so I took a stab at narrowing it down to just a lock for the process tree, mostly mirroring the FreeBSD proctree_lock. That appears to be holding up much better and I just have some code arrangement issues around sys_ptrace() before that'll go out for final review.
                                                                                                                                                                                                                                                                                      Then most of the way through the week, Bob (beck@) vocally complained that life would be easier for libressl if we had some version of pthread_once() and the pthread mutex routines in libc. This would make some other stuff easier too (c.f. /usr/X11R6/lib/libpthread-stubs.*) and the TIB work over the last couple years has basically eliminated the runtime costs of doing so, so I spent most the rest of the hackathon finding the right place to draw a line through libpthread and move everything on the one side of the line into libc. That code seems pretty stable and the xenocara and ports people seem to like—or at least accept—the effects, so it will almost certainly go in with the next libc bump.
                                                                                                                                                                                                                                                                                      Lots of other random conversations, hacking, meals, and beer. Many thanks to Ken (krw@) and local conspirators for another excellent Toronto hackathon!

                                                                                                                                                                                                                                                                                      Beastie Bits
                                                                                                                                                                                                                                                                                      • 2017 NetBSD Foundation Officers
                                                                                                                                                                                                                                                                                      • New BSDMag is out - Military Grade Data Wiping in FreeBSD with BCWipe
                                                                                                                                                                                                                                                                                      • LibertyBSD 6.1 released
                                                                                                                                                                                                                                                                                      • ***
                                                                                                                                                                                                                                                                                        Feedback/Questions
                                                                                                                                                                                                                                                                                        • Eddy - EuroBSDCon 2017 video and some help
                                                                                                                                                                                                                                                                                        • Eric - ZFS monitoring
                                                                                                                                                                                                                                                                                        • Tom - BSD Hosting
                                                                                                                                                                                                                                                                                        • ***
                                                                                                                                                                                                                                                                                          1 hr 15 min
                                                                                                                                                                                                                                                                                        • 217: Your questions, part II

                                                                                                                                                                                                                                                                                          OpenBSD 6.2 is here, style arguments, a second round of viewer interview questions, how to set CPU affinity for FreeBSD jails, containers on FreeNAS & more!

                                                                                                                                                                                                                                                                                          Headlines
                                                                                                                                                                                                                                                                                          OpenBSD 6.2 Released
                                                                                                                                                                                                                                                                                          • OpenBSD continues their six month release cadence with the release of 6.2, the 44th release
                                                                                                                                                                                                                                                                                          • On a disappointing note, the song for 6.2 will not be released until December
                                                                                                                                                                                                                                                                                          • Highlights:
                                                                                                                                                                                                                                                                                          • Improved hardware support on modern platforms including ARM64/ARMv7 and octeon, while amd64 users will appreciate additional support for the Intel Kaby Lake video cards.

                                                                                                                                                                                                                                                                                            Network stack improvements include extensive SMPization improvements and a new FQ-CoDel queueing discipline, as well as enhanced WiFi support in general and improvements to iwn(4), iwm(4) and anthn(4) drivers.
                                                                                                                                                                                                                                                                                            Improvements in vmm(4)/vmd include VM migration, as well as various compatibility and performance improvements.
                                                                                                                                                                                                                                                                                            Security enhancements including a new freezero(3) function, further pledge(2)ing of base system programs and conversion of several daemons to the fork+exec model.
                                                                                                                                                                                                                                                                                            Trapsleds, KARL, and random linking for libcrypto and ld.so, dramatically increase security by making it harder to find helpful ROP gadgets, and by creating a unique order of objects per-boot.
                                                                                                                                                                                                                                                                                            A unique kernel is now created by the installer to boot from after install/upgrade.
                                                                                                                                                                                                                                                                                            The base system compiler on the amd64 and i386 platforms has switched to clang(1).
                                                                                                                                                                                                                                                                                            New versions of OpenSSH, OpenSMTPd, LibreSSL and mandoc are also included.
                                                                                                                                                                                                                                                                                            The kernel no longer handles IPv6 Stateless Address Autoconfiguration (RFC 4862), allowing cleanup and simplification of the IPv6 network stack.
                                                                                                                                                                                                                                                                                            Improved IPv6 checks for IPsec policies and made them consistent with IPv4.
                                                                                                                                                                                                                                                                                            Enabled the use of per-CPU caches in the network packet allocators.
                                                                                                                                                                                                                                                                                            Improved UTF-8 line editing support for ksh(1) Emacs and Vi input mode.
                                                                                                                                                                                                                                                                                            breaking change for nvme(4) users with GPT: If you are booting from an nvme(4) drive with a GPT disk layout, you are affected by an off-by-one in the driver with the consequence that the sector count in your partition table may be incorrect. The only way to fix this is to re-initialize the partition table. Backup your data to another disk before you upgrade. In the new bsd.rd, drop to a shell and re-initialize the GPT:
                                                                                                                                                                                                                                                                                            fdisk -iy -g -b 960 sdN

                                                                                                                                                                                                                                                                                            Why we argue: style

                                                                                                                                                                                                                                                                                            I've been thinking about why we argue about code, and how we might transform vehement differences of opinion into active forces for good.

                                                                                                                                                                                                                                                                                            My thoughts spring from a very specific context. Ten or twelve times a year I go to an arbitrary business and spend three or more days teaching a course in object-oriented design. I'm an outsider, but for a few days these business let me in on their secrets.
                                                                                                                                                                                                                                                                                            Here's what I've noticed. In some places, folks are generally happy. Programmers get along. They feel as if they are all "in this together." At businesses like this I spend most of my time actually teaching object-oriented design.
                                                                                                                                                                                                                                                                                            Other places, folks are surprisingly miserable. There's a lot of discord, and the programmers have devolved into competing "camps." In these situations the course rapidly morphs away from OO Design and into wide-ranging group discussions about how to resolve deeply embedded conflicts.
                                                                                                                                                                                                                                                                                            Tolstoy famously said that "Happy families are all alike; every unhappy family is unhappy in its own way." This is known as the Anna Karenina Principle, and describes situations in which success depends on meeting all of a number of criteria. The only way to be happy is to succeed at every one of them. Unhappiness, unfortunately, can be achieved by any combination of failure. Thus, all happy businesses are similar, but unhappy ones appear unique in their misery.
                                                                                                                                                                                                                                                                                            Today I'm interested in choices of syntax, i.e whether or not your shop has agreed upon and follows a style guide. If you're surprised that I'm starting with this apparently mundane issue, consider yourself lucky in your choice of workplace. If you're shaking your head in rueful agreement about the importance of this topic, I feel your pain.
                                                                                                                                                                                                                                                                                            I firmly believe that all of the code that I personally have to examine should come to me in a consistent format. Code is read many more times than it is written, which means that the ultimate cost of code is in its reading. It therefore follows that code should be optimized for readability, which in turn dictates that an application's code should all follow the same style.

                                                                                                                                                                                                                                                                                            • This is why FreeBSD, and most other open source projects, have a preferred style. Some projects are less specific and less strict about it.
                                                                                                                                                                                                                                                                                            • Most programmers agree with the prior paragraph, but here's where things begin to break down. As far as I'm concerned, my personal formatting style is clearly the best. However, I'm quite sure that you feel the same. It's easy for a group of programmers to agree that all code should follow a common style, but surprisingly difficult to get them to agree on just what that common style should be.

                                                                                                                                                                                                                                                                                              Avoid appointing a human "style cop", which just forces someone to be an increasingly ill-tempered nag. Instead, supply programmers with the information they need to remedy their own transgressions. By the time a pull request is submitted, mis-stylings should long since have been put right. Pull request conversations ought to be about what code does rather than how code looks.
                                                                                                                                                                                                                                                                                              What about old code? Ignore it. You don't have to re-style all existing code, just do better from this day forward. Defer updating old code until you touch it for other reasons. Following this strategy means that the code you most often work on will gradually take on a common style. It also means that some of your existing code might never get updated, but if you never look at it, who cares?
                                                                                                                                                                                                                                                                                              If you choose to re-style code that you otherwise have no need to touch, you're declaring that changing the look of this old code has more value to your business than delivering the next item on the backlog. The opportunity cost of making a purely aesthetic change includes losing the benefit of what you could have done instead. The rule-of-thumb is: Don't bother updating the styling of stable, existing code unless not doing so costs you money.

                                                                                                                                                                                                                                                                                              • Most open source projects also avoid reformatting code just to change the style, because of the merge conflicts this will cause for downstream consumers
                                                                                                                                                                                                                                                                                              • If you disagree with the style guide upon which your team agrees, you have only two honorable options:

                                                                                                                                                                                                                                                                                                First, you can obey the guide despite your aversion. As with me in the Elm story above, this act is likely to change your thinking so that over time you come to prefer the new style. It's possible that if you follow the guide you'll begin to like it.
                                                                                                                                                                                                                                                                                                Alternatively, you can decide you will not obey the style guide. Making this decision demands that you leave your current project and find some other project whose guide matches your preferred style. Go there and follow that one.
                                                                                                                                                                                                                                                                                                Notice that both of these choices have you following a guide. This part is not optional.
                                                                                                                                                                                                                                                                                                The moral of this story? It's more important for all code to be formatted the same than it is for any one of us to get our own way. Commit to agreeing upon and following a style guide. And if you find that your team cannot come to an agreement, step away from this problem and start a discussion about power.

                                                                                                                                                                                                                                                                                                • There have been many arguments about style, and it can often be one of the first complaints of people new to any open source project
                                                                                                                                                                                                                                                                                                • This article covers it fairly well from both sides, a) you should follow the style guide of the project you are contributing to, b) the project should review your actual code, then comment on the style after, and provide gentle guidance towards the right style, and avoid being “style cops”
                                                                                                                                                                                                                                                                                                • ***
                                                                                                                                                                                                                                                                                                  Interview - The BSDNow Crew, Part II
                                                                                                                                                                                                                                                                                                  News Roundup
                                                                                                                                                                                                                                                                                                  Building FreeBSD for the Onion Omega 2
                                                                                                                                                                                                                                                                                                  • I got my Onion Omega 2 devices in the mail quite a while ago, but I had never gotten around to trying to install FreeBSD on them. They are a different MIPS SoC than the Onion Omega 1, so it would not work out of the box at the time. Now, the SoC is supported!
                                                                                                                                                                                                                                                                                                  • This guide provides the steps to build an image for the Omega 2 using the freebsd-wifi-build infrastructure
                                                                                                                                                                                                                                                                                                  • First some config files are modified to make the image small enough for the Omega 2’s flash chip
                                                                                                                                                                                                                                                                                                  • The DTS (Device Tree Source) files are not yet included in FreeBSD, so they are fetched from github
                                                                                                                                                                                                                                                                                                  • Then the build for the ralink SoC is run, with the provided DTS file and the MT7628_FDT kernel config
                                                                                                                                                                                                                                                                                                  • Once the build is complete, you’ll have a tftp image file. Then that image is compressed, and bundled into a uboot image
                                                                                                                                                                                                                                                                                                  • Write the files to a USB stick, and plug it into the Omega’s dock
                                                                                                                                                                                                                                                                                                  • Turn it on while holding the reset button with console open
                                                                                                                                                                                                                                                                                                  • Press 1 to get into the command line.

                                                                                                                                                                                                                                                                                                    • You will need to reset the usb:
                                                                                                                                                                                                                                                                                                    • usb reset

                                                                                                                                                                                                                                                                                                      • Then load the kernel boot image:
                                                                                                                                                                                                                                                                                                      • fatload usb 0:1 0x80800000 kernel.MT7628_FDT.lzma.uImage

                                                                                                                                                                                                                                                                                                        • And boot it:
                                                                                                                                                                                                                                                                                                        • bootm 0x80800000

                                                                                                                                                                                                                                                                                                          • At this point FreeBSD should boot
                                                                                                                                                                                                                                                                                                          • Mount a userland, and you should end up in multi-user mode
                                                                                                                                                                                                                                                                                                          • Hopefully this will get even easier in the next few weeks, and we’ll end up with a more streamlined process to tftp boot the device, then write FreeBSD into the onboard flash so it boots automatically.
                                                                                                                                                                                                                                                                                                          • ***
                                                                                                                                                                                                                                                                                                            Setting the CPU Affinity on FreeBSD Jails with ezjail
                                                                                                                                                                                                                                                                                                            • While there are more advanced resource controls available for FreeBSD jails, one of the most basic ways to control CPU usage is to limit the subset of CPUs that each jail can use. This can make sure that every jail has access to some dedicated resources, while at the same time doesn’t have the ability to entirely dominate the machine
                                                                                                                                                                                                                                                                                                            • I just got a new home server: a HP ProLiant ML110 G6. Being a FreeBSD person myself, it was natural that I used it on my server instead of Linux

                                                                                                                                                                                                                                                                                                              I chose to use ezjail to manage the jails on my ProLiant, with the initial one being a Tor middle node. Despite the fact that where my ML110 is, the upstream is only 35mbps (which is pretty good for cable), I did not want to give my Tor jail access to all four cores.
                                                                                                                                                                                                                                                                                                              Setting the CPU Affinity would let you choose a specific CPU core (or a range of cores) you want to use. However, it does not just let you pick the number of CPU cores you want and make FreeBSD choose the core running your jail. Going forward, I assumed that you have already created a jail using ezjail-admin. I also do not cover limiting a jail to a certain percentage of CPU usage.
                                                                                                                                                                                                                                                                                                              ezjail-admin config -c [CORE_NUMBER_FIRST]-[CORE_NUMBER_LAST] [JAIL_NAME]

                                                                                                                                                                                                                                                                                                              • or
                                                                                                                                                                                                                                                                                                              • ezjail-admin config -c [CORE_NUMBER_FIRST],[CORE_NUMBER_SECOND],...,[CORE_NUMBER_N] [JAIL_NAME]

                                                                                                                                                                                                                                                                                                                And hopefully, you should have your ezjail-managed FreeBSD jail limited to the CPU cores you want. While I did not cover a CPU percentage or RAM usage, this can be done with rctl
                                                                                                                                                                                                                                                                                                                I'll admit: it doesn't really matter which CPU a jail runs on, but it might matter if you don't want a jail to have access to all the CPU cores available and only want [JAIL_NAME] to use one core. Since it's not really possible just specify the number of CPU cores with ezjail (or even iocell), a fallback would be to use CPU affinity, and that requires you to specify an exact CPU core. I know it's not the best solution (it would be better if we could let the scheduler choose provided a jail only runs on one core), but it's what works.

                                                                                                                                                                                                                                                                                                                • We use this at work on high core count machines. When we have multiple databases colocated on the same machine, we make sure each one has a few cores to itself, while it shares other cores with the rest of the machine. We often reserve a core or two for the base system as well.
                                                                                                                                                                                                                                                                                                                • ***
                                                                                                                                                                                                                                                                                                                  A practical guide to containers on FreeNAS for a depraved psychopath.
                                                                                                                                                                                                                                                                                                                  • If you are interested in playing with Docker, this guide sets up a Linux VM running on FreeBSD or FreeNAS under bhyve, then runs linux docker containers on top of it
                                                                                                                                                                                                                                                                                                                  • You know that jails are dope and I know that jails are dope, yet no one else knows it. So here we are stuck with docker. Two years ago I would be the last person to recommend using docker, but a whole lot of things has changes past years…

                                                                                                                                                                                                                                                                                                                    • This tutorial uses iohyve to manage the VMs on the FreeBSD or FreeNAS
                                                                                                                                                                                                                                                                                                                    • There are many Linux variants you can choose from — RancherOS, CoreOS are the most popular for docker-only hosts. We going to use RancherOS because it’s more lightweight out of the box.

                                                                                                                                                                                                                                                                                                                      • Navigate to RancherOS website and grab link to latest version
                                                                                                                                                                                                                                                                                                                      • sudo iohyve setup pool=zpool kmod=1 net=em0

                                                                                                                                                                                                                                                                                                                        sudo iohyve fetch https://releases.rancher.com/os/latest/rancheros.iso
                                                                                                                                                                                                                                                                                                                        sudo iohyve renameiso rancheros.iso rancheros-v1.0.4.iso
                                                                                                                                                                                                                                                                                                                        sudo pkg install grub2-bhyve
                                                                                                                                                                                                                                                                                                                        sudo iohyve create rancher 32G
                                                                                                                                                                                                                                                                                                                        sudo iohyve set rancher loader=grub-bhyve ram=8G cpu=8 con=nmdm0 os=debian
                                                                                                                                                                                                                                                                                                                        sudo iohyve install rancher rancheros-v1.0.4.iso
                                                                                                                                                                                                                                                                                                                        sudo iohyve console rancher

                                                                                                                                                                                                                                                                                                                        • Then the tutorial does some basic configuration of RancherOS, and some house keeping in iohyve to make RancherOS come up unattended at boot
                                                                                                                                                                                                                                                                                                                        • The whole point of this guide is to reduce pain, and using the docker CLI is still painful. There are a lot of Web UIs to control docker. Most of them include a lot of orchestrating services, so it’s just overkill. Portainer is very lightweight and can be run even on Raspberry Pi

                                                                                                                                                                                                                                                                                                                          • Create a config file as described
                                                                                                                                                                                                                                                                                                                          • After reboot you will be able to access WebUI on 9000 port. Setup is very easy, so I won’t go over it

                                                                                                                                                                                                                                                                                                                            • The docker tools for FreeBSD are still being worked on. Eventually you will be able to host native FreeBSD docker containers on FreeBSD jails, but we are not quite there yet
                                                                                                                                                                                                                                                                                                                            • In the meantime, you can install sysutils/docker and use it to manage the docker instances running on a remote machine, or in this case, the RancherOS VM running in bhyve
                                                                                                                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                                                                                                                              Beastie Bits
                                                                                                                                                                                                                                                                                                                              • The Ghost of Invention: A Visit to Bell Labs, excerpt from the forthcoming book: “Kitten Clone: Inside Alcatel-Lucent”
                                                                                                                                                                                                                                                                                                                              • OpenBSD Cookbook (set of Ansible playbooks)
                                                                                                                                                                                                                                                                                                                              • 15 useful sockstat commands to find open ports on FreeBSD
                                                                                                                                                                                                                                                                                                                              • A prehistory of Slashdot
                                                                                                                                                                                                                                                                                                                              • Using ed, the unix line editor
                                                                                                                                                                                                                                                                                                                              • ***
                                                                                                                                                                                                                                                                                                                                Feedback/Questions
                                                                                                                                                                                                                                                                                                                                • Malcolm - ZFS snapshots
                                                                                                                                                                                                                                                                                                                                • Darryn - Zones
                                                                                                                                                                                                                                                                                                                                • Mohammad - SSH Keys

                                                                                                                                                                                                                                                                                                                                • Send questions, comments, show ideas/topics, or stories you want mentioned on the show to [email protected]

                                                                                                                                                                                                                                                                                                                                • 1 hr 43 min
                                                                                                                                                                                                                                                                                                                                • 216: Software is storytelling

                                                                                                                                                                                                                                                                                                                                  EuroBSDcon trip report, how to secure OpenBSD’s LDAP server, ZFS channel programs in FreeBSD HEAD and why software is storytelling.

                                                                                                                                                                                                                                                                                                                                  This episode was brought to you by

                                                                                                                                                                                                                                                                                                                                  Headlines
                                                                                                                                                                                                                                                                                                                                  EuroBSDcon Trip Report
                                                                                                                                                                                                                                                                                                                                  • This is from Frank Moore, who has been supplying us with collections of links for the show and who we met at EuroBSDcon in Paris for the first time. Here is his trip report.
                                                                                                                                                                                                                                                                                                                                  • My attendance at the EuroBSDCon 2017 conference in Paris was sprinkled with

                                                                                                                                                                                                                                                                                                                                    several 'firsts'. My first visit to Paris, my first time travelling on a EuroTunnel Shuttle train and my first time at any BSD conference. Hopefully, none of these will turn out to be 'lasts'.
                                                                                                                                                                                                                                                                                                                                    I arrived on the Wednesday afternoon before the conference started on Thursday morning. My hotel was conveniently located close to the conference centre in Paris' 3rd arrondissement. This area is well-known as a buzzy enclave of hip cafes, eateries, independent shops, markets, modern galleries and museums. It certainly lived up to its reputation. Even better, the weather held over the course of the conference, only raining once, with the rest of the time being both warm and sunny.
                                                                                                                                                                                                                                                                                                                                    The first two days were taken up with attending Dr Kirk McKusick's excellent tutorial 'An Introduction to the FreeBSD Open-Source Operating System'. This is training "straight from the horse's mouth". Kirk has worked extensively on The FreeBSD operating system since the 1980's, helping to design the original BSD filesystem (FFS) and later working on UFS as well. Not only is Kirk an engaging speaker, making what could be a dry topic very interesting, he also
                                                                                                                                                                                                                                                                                                                                    sprinkles liberal doses of history and war stories throughout his lectures. Want to know why a protocol was designed the way that it was? Or why a system flag has a particular value or position in a record? Kirk was there and has the first-hand answer. He reminisces about his meetings and work with other Unix and BSD luminaries and debunks and confirms common myths in equal measure.
                                                                                                                                                                                                                                                                                                                                    Kirk's teaching style and knowledge are impressive. Every section starts with an overview and a big picture diagram before drilling down into the nitty-gritty detail. Nothing feels superfluous, and everything fits together logically. It's easy to tell that the material and its delivery have been honed over many years, but without feeling stale. Topics covered included the kernel, processes, virtual memory, threads, I/O, devices, FFS, ZFS, and networking.
                                                                                                                                                                                                                                                                                                                                    The slides were just as impressive, with additional notes written by a previous student and every slide containing a reference back to the relevant page(s) in the 2nd edition of Kirk's operating system book. As well as a hard copy for those that requested it, Kirk also helpfully supplied soft copies of all the training materials.
                                                                                                                                                                                                                                                                                                                                    The breaks in between lectures were useful for meeting the students from the other tutorials and for recovering from the inevitable information overload.
                                                                                                                                                                                                                                                                                                                                    It's not often that you can get to hear someone as renowned as Dr McKusick give a lecture on something as important as the FreeBSD operating system. If you have any interest in FreeBSD, Unix history, or operating systems in general, I would urge you to grab the opportunity to attend one of his lectures. You won't be disappointed.
                                                                                                                                                                                                                                                                                                                                    The last two days of the conference consisted of various hour-long talks by members of each of the main BSD systems. All of them were fairly evenly represented except Dragonfly BSD which unfortunately only had one talk. With three talks going on at any one time, it was often difficult to pick which one to go to. At other times there might be nothing to pique the interest. Attendance at a talk is not mandatory, so for those times when no talks looked inviting, just hanging out in one of the lobby areas with other attendees was often just as interesting and informative.
                                                                                                                                                                                                                                                                                                                                    The conference centre itself was certainly memorable with the interior design of an Egyptian temple or pyramid. All the classrooms were more than adequate while the main auditorium was first-class and easily held the 300+ attendees comfortably. All in all, the facilities, catering and organisation were excellent. Kudos to the EuroBSDCon team, especially Bapt and Antoine for all their hard work and hospitality.
                                                                                                                                                                                                                                                                                                                                    As a long-time watcher and occasional contributor to the BSD Now podcast it was good to meet both Allan and Benedict in the flesh. And having done some proofreading for Michael Lucas previously, it was nice to finally meet him as well.
                                                                                                                                                                                                                                                                                                                                    My one suggestion to the organisers of the next conference would be to provide more
                                                                                                                                                                                                                                                                                                                                    hand-holding for newbies. As a first-time attendee at a BSD conference it would have been nice to have been formally introduced to various people within the projects as the goto people for their areas. I could do this myself, but it's not always easy finding the right person and wrangling an introduction. I also think it was a missed opportunity for each project to recruit new developers to their cause. Apparently, this is already in place at BSDCan, but should probably be rolled out across all BSD conferences.
                                                                                                                                                                                                                                                                                                                                    Having said all that, my aims for the conference were to take Dr McKusick's course, meet a few BSD people and make contacts within one of the BSD projects to start contributing. I was successful on all these fronts, so for me this was mission accomplished. Another first!

                                                                                                                                                                                                                                                                                                                                    autoconf/clang (No) Fun and Games
                                                                                                                                                                                                                                                                                                                                    • Robert Nagy (robert@) wrote in with a fascinating story of hunting down a recent problem with ports:
                                                                                                                                                                                                                                                                                                                                    • You might have been noticing the amount of commits to ports regarding autoconf and nested functions and asking yourself… what the hell is this all about?

                                                                                                                                                                                                                                                                                                                                      I was hanging out at my friend Antoine (ajacoutot@)'s place just before EuroBSDCon 2017 started and we were having drinks and he told me that there is this weird bug where Gnome hangs completely after just a couple of seconds of usage and the gnome-shell process just sits in the fsleep state. This started to happen at the time when inteldrm(4) was updated, the default compiler was switched to clang(1) and futexes were turned on by default.
                                                                                                                                                                                                                                                                                                                                      The next day we started to have a look at the issue and since the process was hanging in fsleep, it seemed clear that the cause must be futexes, so we had to start bisecting the base system, which resulted in random success and failure. In the end we figured out that it is neither futex nor inteldrm(4) related, so the only thing that was left is the switch to clang.
                                                                                                                                                                                                                                                                                                                                      Now the problem is that we have to figure out what part of the system needs to be build with clang to trigger this issue, so we kept on going and systematically recompiled the base system with gcc until everything was ruled out … and it kept on hanging.
                                                                                                                                                                                                                                                                                                                                      We were drunk and angry that now we have to go and check hundreds of ports because gnome is not a small standalone port, so between two bottles of wine a build VM was fired up to do a package build with gcc, because manually building all the dependencies would just take too long and we had spent almost two days on this already.
                                                                                                                                                                                                                                                                                                                                      Next day ~200 packages were available to bisect and figure out what's going on. After a couple of tries it turned out that the hang is being caused by the gtk+3 package, which is bad since almost everything is using gtk+3. Now it was time to figure out what file the gtk+3 source being built by clang is causing the issue. (Compiler optimizations were ruled out already at this point.) So another set of bisecting happened, building each subdirectory of gtk+3 with clang and waiting for the hang to manifest … and it did not. What the $f?
                                                                                                                                                                                                                                                                                                                                      Okay so something else is going on and maybe the configure script of gtk+3 is doing something weird with different compilers, so I quickly did two configure runs with gcc and clang and simply diff'd the two directories. Snippets from the diff:

                                                                                                                                                                                                                                                                                                                                      -GDK_HIDDEN_VISIBILITY_CFLAGS = -fvisibility=hidden

                                                                                                                                                                                                                                                                                                                                      GDK_HIDDEN_VISIBILITY_CFLAGS =

                                                                                                                                                                                                                                                                                                                                      -lt_cv_prog_compiler_rtti_exceptions=no

                                                                                                                                                                                                                                                                                                                                      lt_cv_prog_compiler_rtti_exceptions=yes

                                                                                                                                                                                                                                                                                                                                      -#define GDK_EXTERN __attribute_((visibility("default"))) extern

                                                                                                                                                                                                                                                                                                                                      -lt_prog_compiler_no_builtin_flag=' -fno-builtin'

                                                                                                                                                                                                                                                                                                                                      +lt_prog_compiler_no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
                                                                                                                                                                                                                                                                                                                                      Okay, okay that's something, but wait … clang has symbol visibility support so what is going on again? Let's take a peek at config.log:

                                                                                                                                                                                                                                                                                                                                      configure:29137: checking for -fvisibility=hidden compiler flag

                                                                                                                                                                                                                                                                                                                                      configure:29150: cc -c -fvisibility=hidden -I/usr/local/include -I/usr/X11R6/include conftest.c >&5

                                                                                                                                                                                                                                                                                                                                      conftest.c:82:17: error: function definition is not allowed here

                                                                                                                                                                                                                                                                                                                                      int main (void) { return 0; }

                                                                                                                                                                                                                                                                                                                                      ^
                                                                                                                                                                                                                                                                                                                                      1 error generated.

                                                                                                                                                                                                                                                                                                                                      Okay that's clearly an error but why exactly? autoconf basically generates a huge shell script that will check for whatever you throw at it by creating a file called conftest.c and putting chunks of code into it and then trying to compile it. In this case the relevant part of the code was:

                                                                                                                                                                                                                                                                                                                                      | int

                                                                                                                                                                                                                                                                                                                                      | main ()
                                                                                                                                                                                                                                                                                                                                      | {
                                                                                                                                                                                                                                                                                                                                      | int main (void) { return 0; }
                                                                                                                                                                                                                                                                                                                                      | ;
                                                                                                                                                                                                                                                                                                                                      | return 0;
                                                                                                                                                                                                                                                                                                                                      | }

                                                                                                                                                                                                                                                                                                                                      That is a nested function declaration which is a GNU extension and it is not supported by clang, but that's okay, the question is why the hell would you use nested functions to check for simple compiler flags. The next step was to go and check what is going on in configure.ac to see how the configure script is generated. In the gtk+3 case the following snippet is used:

                                                                                                                                                                                                                                                                                                                                      AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])

                                                                                                                                                                                                                                                                                                                                      AC_TRY_COMPILE([], [int main (void) { return 0; }],

                                                                                                                                                                                                                                                                                                                                      AC_MSG_RESULT(yes)
                                                                                                                                                                                                                                                                                                                                      enable_fvisibility_hidden=yes,
                                                                                                                                                                                                                                                                                                                                      AC_MSG_RESULT(no)
                                                                                                                                                                                                                                                                                                                                      enable_fvisibility_hidden=no)

                                                                                                                                                                                                                                                                                                                                      According to the autoconf manual the AC_TRY_COMPILE macro accepts the following parameters:

                                                                                                                                                                                                                                                                                                                                      That clearly states that a function body has to be specified because the function definition is already provided automatically, so doing AC_TRY_COMPILE([], [int main (void) { return 0;}], instead of AC_TRY_COMPILE([],[] will result in a nested function declaration, which will work just fine with gcc, even though the autoconf usage is wrong.
                                                                                                                                                                                                                                                                                                                                      After fixing the autoconf macro in gtk+3 and rebuilding the complete port from scratch with clang, the hang completely went away as the proper CFLAGS and LDFLAGS were picked up by autoconf for the build.
                                                                                                                                                                                                                                                                                                                                      At this point we realized that most of the ports tree uses autoconf so this issue might be a lot bigger than we thought, so I asked sthen@ to do a grep on the ports object directory and just search for "function definition is not allowed here", which resulted in about ~60 additional ports affected.
                                                                                                                                                                                                                                                                                                                                      Out of the list of ports there were only two false positive matches. These were actually trying to test whether the compiler supports nested functions. The rest were a combination of several autoconf macros used in a wrong way, e.g: AC_TRY_COMPILE, AC_TRY_LINK. Most of them were fixable by just removing the extra function declaration or by switching to other autoconf macros like AC_LANG_SOURCE where you can actually declare your own functions if need be.
                                                                                                                                                                                                                                                                                                                                      The conclusion is that this issue was a combination of people not reading documentation and just copy/pasting autoconf snippets, instead of reading their documentation and using the macros in the way they were intended, and the fact that switching to a new compiler is never easy and bugs or undefined behaviour are always lurking in the dark.
                                                                                                                                                                                                                                                                                                                                      Thanks to everyone who helped fixing all the ports up this quickly! Hopefully all of the changes can be merged upstream, so that others can benefit as well.

                                                                                                                                                                                                                                                                                                                                      Interview - David Carlier - @devnexen
                                                                                                                                                                                                                                                                                                                                      • Software Engineer at Afilias
                                                                                                                                                                                                                                                                                                                                      • ***
                                                                                                                                                                                                                                                                                                                                        News Roundup
                                                                                                                                                                                                                                                                                                                                        Setting up OpenBSD's LDAP Server (ldapd) with StartTLS and SASL
                                                                                                                                                                                                                                                                                                                                        • A tutorial on setting up OpenBSD’s native LDAP server with TLS encryption and SASL authentication
                                                                                                                                                                                                                                                                                                                                        • OpenBSD has its own LDAP server, ldapd. Here's how to configure it for use with StartTLS and SASL authentication

                                                                                                                                                                                                                                                                                                                                          Create a certificate (acme-client anyone?)
                                                                                                                                                                                                                                                                                                                                          Create a basic config file
                                                                                                                                                                                                                                                                                                                                          listen on em0 tls certificate ldapserver

                                                                                                                                                                                                                                                                                                                                          • This will listen on the em0 interface with tls using the certificate called ldapserver.crt / ldapserver.key
                                                                                                                                                                                                                                                                                                                                          • Validate the configuration:
                                                                                                                                                                                                                                                                                                                                          • /usr/sbin/ldapd -n

                                                                                                                                                                                                                                                                                                                                            • Enable and start the service:
                                                                                                                                                                                                                                                                                                                                            • rcctl enable ldapd

                                                                                                                                                                                                                                                                                                                                              rcctl start ldapd

                                                                                                                                                                                                                                                                                                                                              • On the client machine:
                                                                                                                                                                                                                                                                                                                                              • pkg_add openldap-client
                                                                                                                                                                                                                                                                                                                                                • Copy the certificate to /etc/ssl/trusted.crt
                                                                                                                                                                                                                                                                                                                                                • Add this line to /etc/openldap/ldap.conf
                                                                                                                                                                                                                                                                                                                                                • TLS_CACERT /etc/ssl/trusted.crt

                                                                                                                                                                                                                                                                                                                                                  • Enable and start the service
                                                                                                                                                                                                                                                                                                                                                  • rcctl enable saslauthd

                                                                                                                                                                                                                                                                                                                                                    rcctl start saslauthd

                                                                                                                                                                                                                                                                                                                                                    • Connect to ldapd (-ZZ means force TLS, use -H to specify URI):
                                                                                                                                                                                                                                                                                                                                                    • ldapsearch -H ldap://ldapserver -ZZ

                                                                                                                                                                                                                                                                                                                                                      FreeBSD Picks Up Support for ZFS Channel Programs in -current

                                                                                                                                                                                                                                                                                                                                                      ZFS channel programs (ZCP) adds support for performing compound ZFS administrative actions via Lua scripts in a sandboxed environment (with time and memory limits).

                                                                                                                                                                                                                                                                                                                                                      This initial commit includes both base support for running ZCP scripts, and a small initial library of API calls which support getting properties and listing, destroying, and promoting datasets.
                                                                                                                                                                                                                                                                                                                                                      Testing: in addition to the included unit tests, channel programs have been in use at Delphix for several months for batch destroying filesystems.

                                                                                                                                                                                                                                                                                                                                                      • Take a simple task as an example: Create a snapshot, then set a property on that snapshot. In the traditional system for this, when you issue the snapshot command, that closes the currently open transaction group (say #100), and opens a new one, #101. While #100 is being written to disk, other writes are accumulated in #101. Once #100 is flushed to disk, the ‘zfs snapshot’ command returns. You can then issue the ‘zfs set’ command. This actually ends up going into transaction group #102. Each administrative action needs to wait for the transaction group to flush, which under heavy loads could take multiple seconds. Now if you want to create AND set, you need to wait for two or three transaction groups. Meanwhile, during transaction group #101, the snapshot existed without the property set, which could cause all kinds of side effects.

                                                                                                                                                                                                                                                                                                                                                      • ZFS Channel programs solves this by allowing you to perform a small scripted set of actions as a single atomic operation.

                                                                                                                                                                                                                                                                                                                                                      • In Delphix’s appliance, they often needed to do as many as 15 operations together, which might take multiple minutes. Now with channel programs it is much faster, far safer, and has fewer chances of side effects

                                                                                                                                                                                                                                                                                                                                                      • BSDCan 2017 - Matt Ahrens: Building products based on OpenZFS, using channel programs -- Video Soon

                                                                                                                                                                                                                                                                                                                                                      • Software Is About Storytelling
                                                                                                                                                                                                                                                                                                                                                        • Tyler Treat writes on the brave new geek blog:
                                                                                                                                                                                                                                                                                                                                                        • Software engineering is more a practice in archeology than it is in building. As an industry, we undervalue storytelling and focus too much on artifacts and tools and deliverables. How many times have you been left scratching your head while looking at a piece of code, system, or process? It’s the story, the legacy left behind by that artifact, that is just as important—if not more—than the artifact itself.

                                                                                                                                                                                                                                                                                                                                                          And I don’t mean what’s in the version control history—that’s often useless. I mean the real, human story behind something. Artifacts, whether that’s code or tools or something else entirely, are not just snapshots in time. They’re the result of a series of decisions, discussions, mistakes, corrections, problems, constraints, and so on. They’re the product of the engineering process, but the problem is they usually don’t capture that process in its entirety. They rarely capture it at all. They commonly end up being nothing but a snapshot in time.
                                                                                                                                                                                                                                                                                                                                                          It’s often the sign of an inexperienced engineer when someone looks at something and says, “this is stupid” or “why are they using X instead of Y?” They’re ignoring the context, the fact that circumstances may have been different. There is a story that led up to that point, a reason for why things are the way they are. If you’re lucky, the people involved are still around. Unfortunately, this is not typically the case. And so it’s not necessarily the poor engineer’s fault for wondering these things. Their predecessors haven’t done enough to make that story discoverable and share that context.
                                                                                                                                                                                                                                                                                                                                                          I worked at a company that built a homegrown container PaaS on ECS. Doing that today would be insane with the plethora of container solutions available now. “Why aren’t you using Kubernetes?” Well, four years ago when we started, Kubernetes didn’t exist. Even Docker was just in its infancy. And it’s not exactly a flick of a switch to move multiple production environments to a new container runtime, not to mention the politicking with leadership to convince them it’s worth it to not ship any new code for the next quarter as we rearchitect our entire platform. Oh, and now the people behind the original solution are no longer with the company. Good luck! And this is on the timescale of about five years. That’s maybe like one generation of engineers at the company at most—nothing compared to the decades or more software usually lives (an interesting observation is that timescale, I think, is proportional to the size of an organization). Don’t underestimate momentum, but also don’t underestimate changing circumstances, even on a small time horizon.
                                                                                                                                                                                                                                                                                                                                                          The point is, stop looking at technology in a vacuum. There are many facets to consider. Likewise, decisions are not made in a vacuum. Part of this is just being an empathetic engineer. The corollary to this is you don’t need to adopt every bleeding-edge tech that comes out to be successful, but the bigger point is software is about storytelling. The question you should be asking is how does your organization tell those stories? Are you deliberate or is it left to tribal knowledge and hearsay? Is it something you truly value and prioritize or simply a byproduct?
                                                                                                                                                                                                                                                                                                                                                          Documentation is good, but the trouble with documentation is it’s usually haphazard and stagnant. It’s also usually documentation of how and not why. Documenting intent can go a long way, and understanding the why is a good way to develop empathy. Code survives us. There’s a fantastic talk by Bryan Cantrill on oral tradition in software engineering where he talks about this. People care about intent. Specifically, when you write software, people care what you think. As Bryan puts it, future generations of programmers want to understand your intent so they can abide by it, so we need to tell them what our intent was. We need to broadcast it. Good code comments are an example of this. They give you a narrative of not only what’s going on, but why. When we write software, we write it for future generations, and that’s the most underestimated thing in all of software. Documenting intent also allows you to document your values, and that allows the people who come after you to continue to uphold them.
                                                                                                                                                                                                                                                                                                                                                          Storytelling in software is important. Without it, software archeology is simply the study of puzzles created by time and neglect. When an organization doesn’t record its history, it’s bound to repeat the same mistakes. A company’s memory is comprised of its people, but the fact is people churn. Knowing how you got here often helps you with getting to where you want to be. Storytelling is how we transcend generational gaps and the inevitable changing of the old guard to the new guard in a maturing engineering organization. The same is true when we expand that to the entire industry. We’re too memoryless—shipping code and not looking back, discovering everything old that is new again, and simply not appreciating our lineage.

                                                                                                                                                                                                                                                                                                                                                          Beastie Bits
                                                                                                                                                                                                                                                                                                                                                          • 1st BSD Users Stockholm Meetup
                                                                                                                                                                                                                                                                                                                                                          • Absolute FreeBSD, 3rd Edition draft completed
                                                                                                                                                                                                                                                                                                                                                          • Absolute FreeBSD, 3rd Edition Table of Contents
                                                                                                                                                                                                                                                                                                                                                          • t2k17 Hackathon Report: My first time (Aaron Bieber)
                                                                                                                                                                                                                                                                                                                                                          • The release of pfSense 2.4.0 will be slightly delayed to apply patches for vulnerabilities in 3rd party packages that are part of pfSense
                                                                                                                                                                                                                                                                                                                                                          • Feedback/Questions
                                                                                                                                                                                                                                                                                                                                                            • Ben writes in that zrepl is in ports now
                                                                                                                                                                                                                                                                                                                                                            • Peter asks us about Netflix on BSD
                                                                                                                                                                                                                                                                                                                                                            • meka writes in about dhclient exiting
                                                                                                                                                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                                                                                                                                                              1 hr 50 min
                                                                                                                                                                                                                                                                                                                                                            • 215: Turning FreeBSD up to 100 Gbps

                                                                                                                                                                                                                                                                                                                                                              We look at how Netflix serves 100 Gbps from an Open Connect Appliance, read through the 2nd quarter FreeBSD status report, show you a freebsd-update speedup via nginx reverse proxy, and customize your OpenBSD default shell.

                                                                                                                                                                                                                                                                                                                                                              This episode was brought to you by

                                                                                                                                                                                                                                                                                                                                                              Headlines
                                                                                                                                                                                                                                                                                                                                                              Serving 100 Gbps from an Open Connect Appliance

                                                                                                                                                                                                                                                                                                                                                              In the summer of 2015, the Netflix Open Connect CDN team decided to take on an ambitious project. The goal was to leverage the new 100GbE network interface technology just coming to market in order to be able to serve at 100 Gbps from a single FreeBSD-based Open Connect Appliance (OCA) using NVM Express (NVMe)-based storage.

                                                                                                                                                                                                                                                                                                                                                              At the time, the bulk of our flash storage-based appliances were close to being CPU limited serving at 40 Gbps using single-socket Xeon E5–2697v2. The first step was to find the CPU bottlenecks in the existing platform while we waited for newer CPUs from Intel, newer motherboards with PCIe Gen3 x16 slots that could run the new Mellanox 100GbE NICs at full speed, and for systems with NVMe drives.

                                                                                                                                                                                                                                                                                                                                                              • Fake NUMA
                                                                                                                                                                                                                                                                                                                                                              • Normally, most of an OCA’s content is served from disk, with only 10–20% of the most popular titles being served from memory (see our previous blog, Content Popularity for Open Connect for details). However, our early pre-NVMe prototypes were limited by disk bandwidth. So we set up a contrived experiment where we served only the very most popular content on a test server. This allowed all content to fit in RAM and therefore avoid the temporary disk bottleneck. Surprisingly, the performance actually dropped from being CPU limited at 40 Gbps to being CPU limited at only 22 Gbps!

                                                                                                                                                                                                                                                                                                                                                                The ultimate solution we came up with is what we call “Fake NUMA”. This approach takes advantage of the fact that there is one set of page queues per NUMA domain. All we had to do was to lie to the system and tell it that we have one Fake NUMA domain for every 2 CPUs. After we did this, our lock contention nearly disappeared and we were able to serve at 52 Gbps (limited by the PCIe Gen3 x8 slot) with substantial CPU idle time.
                                                                                                                                                                                                                                                                                                                                                                After we had newer prototype machines, with an Intel Xeon E5 2697v3 CPU, PCIe Gen3 x16 slots for 100GbE NIC, and more disk storage (4 NVMe or 44 SATA SSD drives), we hit another bottleneck, also related to a lock on a global list. We were stuck at around 60 Gbps on this new hardware, and we were constrained by pbufs.
                                                                                                                                                                                                                                                                                                                                                                Our first problem was that the list was too small. We were spending a lot of time waiting for pbufs. This was easily fixed by increasing the number of pbufs allocated at boot time by increasing the kern.nswbuf tunable. However, this update revealed the next problem, which was lock contention on the global pbuf mutex. To solve this, we changed the vnode pager (which handles paging to files, rather than the swap partition, and hence handles all sendfile() I/O) to use the normal kernel zone allocator. This change removed the lock contention, and boosted our performance into the 70 Gbps range.
                                                                                                                                                                                                                                                                                                                                                                As noted above, we make heavy use of the VM page queues, especially the inactive queue. Eventually, the system runs short of memory and these queues need to be scanned by the page daemon to free up memory. At full load, this was happening roughly twice per minute. When this happened, all NGINX processes would go to sleep in vm_wait() and the system would stop serving traffic while the pageout daemon worked to scan pages, often for several seconds. This problem is actually made progressively worse as one adds NUMA domains, because there is one pageout daemon per NUMA domain, but the page deficit that it is trying to clear is calculated globally. So if the vm pageout daemon decides to clean, say 1GB of memory and there are 16 domains, each of the 16 pageout daemons will individually attempt to clean 1GB of memory.
                                                                                                                                                                                                                                                                                                                                                                To solve this problem, we decided to proactively scan the VM page queues. In the sendfile path, when allocating a page for I/O, we run the pageout code several times per second on each VM domain. The pageout code is run in its lightest-weight mode in the context of one unlucky NGINX process. Other NGINX processes continue to run and serve traffic while this is happening, so we can avoid bursts of pager activity that blocks traffic serving. Proactive scanning allowed us to serve at roughly 80 Gbps on the prototype hardware.
                                                                                                                                                                                                                                                                                                                                                                Hans Petter Selasky, Mellanox’s 100GbE driver developer, came up with an innovative solution to our problem. Most modern NICs will supply an Receive Side Scaling (RSS) hash result to the host. RSS is a standard developed by Microsoft wherein TCP/IP traffic is hashed by source and destination IP address and/or TCP source and destination ports. The RSS hash result will almost always uniquely identify a TCP connection. Hans’ idea was that rather than just passing the packets to the LRO engine as they arrive from the network, we should hold the packets in a large batch, and then sort the batch of packets by RSS hash result (and original time of arrival, to keep them in order). After the packets are sorted, packets from the same connection are adjacent even when they arrive widely separated in time. Therefore, when the packets are passed to the FreeBSD LRO routine, it can aggregate them.
                                                                                                                                                                                                                                                                                                                                                                With this new LRO code, we were able to achieve an LRO aggregation rate of over 2 packets per aggregation, and were able to serve at well over 90 Gbps for the first time on our prototype hardware for mostly unencrypted traffic. So the job was done. Or was it? The next goal was to achieve 100 Gbps while serving only TLS-encrypted streams. By this point, we were using hardware which closely resembles today’s 100GbE flash storage-based OCAs: four NVMe PCIe Gen3 x4 drives, 100GbE ethernet, Xeon E5v4 2697A CPU. With the improvements described in the Protecting Netflix Viewing Privacy at Scale blog entry, we were able to serve TLS-only traffic at roughly 58 Gbps.
                                                                                                                                                                                                                                                                                                                                                                In the lock contention problems we’d observed above, the cause of any increased CPU use was relatively apparent from normal system level tools like flame graphs, DTrace, or lockstat. The 58 Gbps limit was comparatively strange. As before, the CPU use would increase linearly as we approached the 58 Gbps limit, but then as we neared the limit, the CPU use would increase almost exponentially. Flame graphs just showed everything taking longer, with no apparent hotspots. We finally had a hunch that we were limited by our system’s memory bandwidth. We used the Intel® Performance Counter Monitor Tools to measure the memory bandwidth we were consuming at peak load. We then wrote a simple memory thrashing benchmark that used one thread per core to copy between large memory chunks that did not fit into cache. According to the PCM tools, this benchmark consumed the same amount of memory bandwidth as our OCA’s TLS-serving workload. So it was clear that we were memory limited. At this point, we became focused on reducing memory bandwidth usage. To assist with this, we began using the Intel VTune profiling tools to identify memory loads and stores, and to identify cache misses.
                                                                                                                                                                                                                                                                                                                                                                Because we are using sendfile() to serve data, encryption is done from the virtual memory page cache into connection-specific encryption buffers. This preserves the normal FreeBSD page cache in order to allow serving of hot data from memory to many connections. One of the first things that stood out to us was that the ISA-L encryption library was using half again as much memory bandwidth for memory reads as it was for memory writes. From looking at VTune profiling information, we saw that ISA-L was somehow reading both the source and destination buffers, rather than just writing to the destination buffer. We realized that this was because the AVX instructions used by ISA-L for encryption on our CPUs worked on 256-bit (32-byte) quantities, whereas the cache line size was 512-bits (64 bytes)?—?thus triggering the system to do read-modify-writes when data was written. The problem is that the the CPU will normally access the memory system in 64 byte cache line-sized chunks, reading an entire 64 bytes to access even just a single byte. After a quick email exchange with the ISA-L team, they provided us with a new version of the library that used non-temporal instructions when storing encryption results. Non-temporals bypass the cache, and allow the CPU direct access to memory. This meant that the CPU was no longer reading from the destination buffers, and so this increased our bandwidth from 58 Gbps to 65 Gbps.
                                                                                                                                                                                                                                                                                                                                                                At 100 Gbps, we’re moving about 12.5 GB/s of 4K pages through our system unencrypted. Adding encryption doubles that to 25 GB/s worth of 4K pages. That’s about 6.25 Million mbufs per second. When you add in the extra 2 mbufs used by the crypto code for TLS metadata at the beginning and end of each TLS record, that works out to another 1.6M mbufs/sec, for a total of about 8M mbufs/second. With roughly 2 cache line accesses per mbuf, that’s 128 bytes * 8M, which is 1 GB/s (8 Gbps) of data that is accessed at multiple layers of the stack (alloc, free, crypto, TCP, socket buffers, drivers, etc).
                                                                                                                                                                                                                                                                                                                                                                At this point, we’re able to serve 100% TLS traffic comfortably at 90 Gbps using the default FreeBSD TCP stack. However, the goalposts keep moving. We’ve found that when we use more advanced TCP algorithms, such as RACK and BBR, we are still a bit short of our goal. We have several ideas that we are currently pursuing, which range from optimizing the new TCP code to increasing the efficiency of LRO to trying to do encryption closer to the transfer of the data (either from the disk, or to the NIC) so as to take better advantage of Intel’s DDIO and save memory bandwidth.

                                                                                                                                                                                                                                                                                                                                                                FreeBSD April to June 2017 Status Report

                                                                                                                                                                                                                                                                                                                                                                FreeBSD Team Reports

                                                                                                                                                                                                                                                                                                                                                                • FreeBSD Release Engineering Team

                                                                                                                                                                                                                                                                                                                                                              • Ports Collection

                                                                                                                                                                                                                                                                                                                                                              • The FreeBSD Core Team

                                                                                                                                                                                                                                                                                                                                                              • The FreeBSD Foundation

                                                                                                                                                                                                                                                                                                                                                              • The Postmaster Team
                                                                                                                                                                                                                                                                                                                                                              • Projects
                                                                                                                                                                                                                                                                                                                                                                • 64-bit Inode Numbers
                                                                                                                                                                                                                                                                                                                                                                • Capability-Based Network Communication for Capsicum/CloudABI
                                                                                                                                                                                                                                                                                                                                                                • Ceph on FreeBSD
                                                                                                                                                                                                                                                                                                                                                                • DTS Updates
                                                                                                                                                                                                                                                                                                                                                                • Kernel
                                                                                                                                                                                                                                                                                                                                                                  • Coda revival
                                                                                                                                                                                                                                                                                                                                                                  • FreeBSD Driver for the Annapurna Labs ENA
                                                                                                                                                                                                                                                                                                                                                                  • Intel 10G Driver Update
                                                                                                                                                                                                                                                                                                                                                                  • pNFS Server Plan B
                                                                                                                                                                                                                                                                                                                                                                  • Architectures
                                                                                                                                                                                                                                                                                                                                                                    • FreeBSD on Marvell Armada38x
                                                                                                                                                                                                                                                                                                                                                                    • FreeBSD/arm64
                                                                                                                                                                                                                                                                                                                                                                    • Userland Programs
                                                                                                                                                                                                                                                                                                                                                                      • DTC
                                                                                                                                                                                                                                                                                                                                                                      • Using LLVM's LLD Linker as FreeBSD's System Linker
                                                                                                                                                                                                                                                                                                                                                                      • Ports
                                                                                                                                                                                                                                                                                                                                                                        • A New USES Macro for Porting Cargo-Based Rust Applications
                                                                                                                                                                                                                                                                                                                                                                        • GCC (GNU Compiler Collection)
                                                                                                                                                                                                                                                                                                                                                                        • GNOME on FreeBSD
                                                                                                                                                                                                                                                                                                                                                                        • KDE on FreeBSD
                                                                                                                                                                                                                                                                                                                                                                        • New Port: FRRouting
                                                                                                                                                                                                                                                                                                                                                                        • PHP Ports: Help Improving QA
                                                                                                                                                                                                                                                                                                                                                                        • Rust
                                                                                                                                                                                                                                                                                                                                                                        • sndio Support in the FreeBSD Ports Collection
                                                                                                                                                                                                                                                                                                                                                                        • TensorFlow
                                                                                                                                                                                                                                                                                                                                                                        • Updating Port Metadata for non-x86 Architectures
                                                                                                                                                                                                                                                                                                                                                                        • Xfce on FreeBSD
                                                                                                                                                                                                                                                                                                                                                                        • Documentation
                                                                                                                                                                                                                                                                                                                                                                          • Absolute FreeBSD, 3rd Edition
                                                                                                                                                                                                                                                                                                                                                                          • Doc Version Strings Improved by Their Absence
                                                                                                                                                                                                                                                                                                                                                                          • New Xen Handbook Section
                                                                                                                                                                                                                                                                                                                                                                          • Miscellaneous
                                                                                                                                                                                                                                                                                                                                                                            • BSD Meetups at Rennes (France)
                                                                                                                                                                                                                                                                                                                                                                            Third-Party Projects
                                                                                                                                                                                                                                                                                                                                                                            • HardenedBSD
                                                                                                                                                                                                                                                                                                                                                                            DPDK, VPP, and the future of pfSense @ the DPDK Summit
                                                                                                                                                                                                                                                                                                                                                                            • The DPDK (Data Plane Development Kit) conference included a short update from the pfSense project
                                                                                                                                                                                                                                                                                                                                                                            • The video starts with a quick introduction to pfSense and the company behind it
                                                                                                                                                                                                                                                                                                                                                                            • It covers the issues they ran into trying to scale to 10gbps and beyond, and some of the solutions they tried: libuinet, netmap, packet-journey
                                                                                                                                                                                                                                                                                                                                                                            • Then they discovered VPP (Vector Packet Processing)
                                                                                                                                                                                                                                                                                                                                                                            • The video then covers the architecture of the new pfSense
                                                                                                                                                                                                                                                                                                                                                                            • pfSense has launched of EC2, on Azure soon, and will launch support for the new Atom C3000 and Xeon hardware with built-in QAT (Quick-Assist crypto offload) in November
                                                                                                                                                                                                                                                                                                                                                                            • The future: 100gbps, MPLS, VXLANs, and ARM64 hardware support
                                                                                                                                                                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                                                                                                                                                                              News Roundup
                                                                                                                                                                                                                                                                                                                                                                              Local nginx reverse proxy cache for freebsd-update
                                                                                                                                                                                                                                                                                                                                                                              • Vladimir Krstulja has created this interesting tutorial on the FreeBSD wiki about a freebsd-update reverse proxy cache
                                                                                                                                                                                                                                                                                                                                                                              • Either because you're a good netizen and don't want to repeatedly hammer the FreeBSD mirrors to upgrade all your systems, or you want to benefit from the speed of having a local "mirror" (cache, more precisely), running a freebsd update reverse proxy cache with, say, nginx is dead simple.

                                                                                                                                                                                                                                                                                                                                                                                1. Install nginx somewhere
                                                                                                                                                                                                                                                                                                                                                                                2. Configure nginx for a subdomain, say, freebsd-update.example.com
                                                                                                                                                                                                                                                                                                                                                                                3. On all your hosts, in all your jails, configure /etc/freebsd-update.conf for new ServerName
                                                                                                                                                                                                                                                                                                                                                                                4. And... that's it. Running freebsd-update will use the ServerName domain which is your reverse nginx proxy. Note the comment about using a "nearby" server is not quite true. FreeBSD update mirrors are frequently slow and running such a reverse proxy cache significantly speeds things up.
                                                                                                                                                                                                                                                                                                                                                                                  Caveats: This is a simple cache. That means it doesn't consider the files as a whole repository, which in turn means updates to your cache are not atomic. It'd be advised to nuke your cache before your update run, as its point is only to retain the files in a local cache for some short period of time required for all your machines to be updated.
                                                                                                                                                                                                                                                                                                                                                                                  ***
                                                                                                                                                                                                                                                                                                                                                                                  ClonOS is a free, open-source FreeBSD-based platform for virtual environment creation and management

                                                                                                                                                                                                                                                                                                                                                                                  The operating system uses FreeBSD's development branch (12.0-CURRENT) as its base. ClonOS uses ZFS as the default file system and includes web-based administration tools for managing virtual machines and jails. The project's website also mentions the availability of templates for quickly setting up new containers and web-based VNC access to jails. Puppet, we are told, can be used for configuration management.

                                                                                                                                                                                                                                                                                                                                                                                  ClonOS can be downloaded as a disk image file (IMG) or as an optical media image (ISO). I downloaded the ISO file which is 1.6GB in size. Booting from ClonOS's media displays a text console asking us to select the type of text terminal we are using. There are four options and most people can probably safely take the default, xterm, option.
                                                                                                                                                                                                                                                                                                                                                                                  The operating system, on the surface, appears to be a full installation of FreeBSD 12. The usual collection of FreeBSD packages are available, including manual pages, a compiler and the typical selection of UNIX command line utilities. The operating system uses ZFS as its file system and uses approximately 3.3GB of disk space. ClonOS requires about 50MB of active memory and 143MB of wired memory before any services or jails are created.
                                                                                                                                                                                                                                                                                                                                                                                  Most of the key features of ClonOS, the parts which set it apart from vanilla FreeBSD, can be accessed through a web-based control panel. When we connect to this control panel, over a plain HTTP connection, using our web browser, we are not prompted for an account name or password. The web-based interface has a straight forward layout. Down the left side of the browser window we find categories of options and controls. Over on the right side of the window are the specific options or controls available in the selected category. At the top of the page there is a drop-down menu where we can toggle the displayed language between English and Russian, with English being the default.
                                                                                                                                                                                                                                                                                                                                                                                  There are twelve option screens we can access in the ClonOS interface and I want to quickly give a summary of each one:

                                                                                                                                                                                                                                                                                                                                                                                  • Overview - this page shows a top-level status summary. The page lists the number of jails and nodes in the system. We are also shown the number of available CPU cores and available RAM on the system.
                                                                                                                                                                                                                                                                                                                                                                                  • Jail containers - this page allows us to create and delete jails. We can also change some basic jail settings on this page, adjusting the network configuration and hostname. Plus we can click a button to open a VNC window that allows us to access the jail's command line interface.
                                                                                                                                                                                                                                                                                                                                                                                  • Template for jails - provides a list of available jail templates. Each template is listed with its name and a brief description. For example, we have a Wordpress template and a bittorrent template. We can click a listed template to create a new jail with a vanilla installation of the selected software included. We cannot download or create new templates from this page.
                                                                                                                                                                                                                                                                                                                                                                                  • Bhyve VMs - this page is very much like the Jails containers page, but concerns the creation of new virtual machines and managing them.
                                                                                                                                                                                                                                                                                                                                                                                  • Virtual Private Network - allows for the management of subnets
                                                                                                                                                                                                                                                                                                                                                                                  • Authkeys - upload security keys for something, but it is not clear for what these keys will be used.
                                                                                                                                                                                                                                                                                                                                                                                  • Storage media - upload ISO files that will be used when creating virtual machines and installing an operating system in the new virtual environment.
                                                                                                                                                                                                                                                                                                                                                                                  • FreeBSD Bases - I think this page downloads and builds source code for alternative versions of FreeBSD, but I am unsure and could not find any associated documentation for this page.
                                                                                                                                                                                                                                                                                                                                                                                  • FreeBSD Sources - download source code for various versions of FreeBSD.
                                                                                                                                                                                                                                                                                                                                                                                  • TaskLog - browse logs of events, particularly actions concerning jails.
                                                                                                                                                                                                                                                                                                                                                                                  • SQLite admin - this page says it will open an interface for managing a SQLite database. Clicking link on the page gives a file not found error.
                                                                                                                                                                                                                                                                                                                                                                                  • Settings - this page simply displays a message saying the settings page has not been implemented yet.
                                                                                                                                                                                                                                                                                                                                                                                  • While playing with ClonOS, I wanted to perform a couple of simple tasks. I wanted to use the Wordpress template to set up a blog inside a jail. I wanted a generic, empty jail in which I could play and run commands without harming the rest of the operating system. I also wanted to try installing an operating system other than FreeBSD inside a Bhyve virtual environment. I thought this would give me a pretty good idea of how quick and easy ClonOS would make common tasks.

                                                                                                                                                                                                                                                                                                                                                                                    • Conclusions
                                                                                                                                                                                                                                                                                                                                                                                    • ClonOS appears to be in its early stages of development, more of a feature preview or proof-of-concept than a polished product. A few of the settings pages have not been finished yet, the web-based controls for jails are unable to create jails that connect to the network and I was unable to upload even small ISO files to create virtual machines.

                                                                                                                                                                                                                                                                                                                                                                                      The project's website mentions working with Puppet to handle system configuration, but I did not encounter any Puppet options. There also does not appear to be any documentation on using Puppet on the ClonOS platform.
                                                                                                                                                                                                                                                                                                                                                                                      One of the biggest concerns I had was the lack of security on ClonOS. The web-based control panel and terminal both automatically login as the root user. Passwords we create for our accounts are ignored and we cannot logout of the local terminal. This means anyone with physical access to the server automatically gains root access and, in addition, anyone on our local network gets access to the web-based admin panel. As it stands, it would not be safe to install ClonOS on a shared network.
                                                                                                                                                                                                                                                                                                                                                                                      Some of the ideas present are good ones. I like the idea of jail templates and have used them on other systems. The graphical Bhyve tools could be useful too, if the limitations of the ISO manager are sorted out. But right now, ClonOS still has a way to go before it is likely to be safe or practical to use.

                                                                                                                                                                                                                                                                                                                                                                                      Customize ksh display for OpenBSD

                                                                                                                                                                                                                                                                                                                                                                                      The default shell for OpenBSD is ksh, and it looks a little monotonous.

                                                                                                                                                                                                                                                                                                                                                                                      To make its user-experience more friendly, I need to do some customizations:
                                                                                                                                                                                                                                                                                                                                                                                      (1) Modify the “Prompt String” to display the user name and current directory:
                                                                                                                                                                                                                                                                                                                                                                                      PS1='$USER:$PWD# '
                                                                                                                                                                                                                                                                                                                                                                                      (2) Install colorls package:
                                                                                                                                                                                                                                                                                                                                                                                      pkg_add colorls
                                                                                                                                                                                                                                                                                                                                                                                      Use it to replace the shipped ls command:
                                                                                                                                                                                                                                                                                                                                                                                      alias ls='colorls -G'
                                                                                                                                                                                                                                                                                                                                                                                      (3) Change LSCOLORS environmental variable to make your favorite color. For example, I don’t want the directory is displayed in default blue, change it to magenta:
                                                                                                                                                                                                                                                                                                                                                                                      LSCOLORS=fxexcxdxbxegedabagacad
                                                                                                                                                                                                                                                                                                                                                                                      For detailed explanation of LSCOLORS, please refer manual of colorls.
                                                                                                                                                                                                                                                                                                                                                                                      This is my final modification of .profile:
                                                                                                                                                                                                                                                                                                                                                                                      PS1='$USER:$PWD# '
                                                                                                                                                                                                                                                                                                                                                                                      export PS1
                                                                                                                                                                                                                                                                                                                                                                                      LSCOLORS=fxexcxdxbxegedabagacad
                                                                                                                                                                                                                                                                                                                                                                                      export LSCOLORS
                                                                                                                                                                                                                                                                                                                                                                                      alias ls='colorls -G'

                                                                                                                                                                                                                                                                                                                                                                                      DragonFly 5 release candidate
                                                                                                                                                                                                                                                                                                                                                                                      • Commit
                                                                                                                                                                                                                                                                                                                                                                                      • I tagged DragonFly 5.0 (commit message list in that link) over the weekend, and there’s a 5.0 release candidate for download.

                                                                                                                                                                                                                                                                                                                                                                                        It’s RC2 because the recent Radeon changes had to be taken out.

                                                                                                                                                                                                                                                                                                                                                                                        Beastie Bits
                                                                                                                                                                                                                                                                                                                                                                                        • Faster forwarding
                                                                                                                                                                                                                                                                                                                                                                                        • DRM-Next-Kmod hits the ports tree
                                                                                                                                                                                                                                                                                                                                                                                        • OpenBSD Community Goes Platinum
                                                                                                                                                                                                                                                                                                                                                                                        • Setting up iSCSI on TrueOS and FreeBSD12
                                                                                                                                                                                                                                                                                                                                                                                        • ***
                                                                                                                                                                                                                                                                                                                                                                                          Feedback/Questions
                                                                                                                                                                                                                                                                                                                                                                                          • Christopher - Virtualizing FreeNAS
                                                                                                                                                                                                                                                                                                                                                                                          • Van - Tar Question
                                                                                                                                                                                                                                                                                                                                                                                          • Joe - Book Reviews
                                                                                                                                                                                                                                                                                                                                                                                          • ***
                                                                                                                                                                                                                                                                                                                                                                                            1 hr 34 min
                                                                                                                                                                                                                                                                                                                                                                                          • 214: The history of man, kind

                                                                                                                                                                                                                                                                                                                                                                                            The costs of open sourcing a project are explored, we discover why PS4 downloads are so slow, delve into the history of UNIX man pages, and more.

                                                                                                                                                                                                                                                                                                                                                                                            This episode was brought to you by

                                                                                                                                                                                                                                                                                                                                                                                            Headlines
                                                                                                                                                                                                                                                                                                                                                                                            The Cost Of Open Sourcing Your Project

                                                                                                                                                                                                                                                                                                                                                                                            Accusing a company of “dumping” their project as open source is probably misplaced – it’s an expensive business no-one would do frivolously.

                                                                                                                                                                                                                                                                                                                                                                                            If you see an active move to change software licensing or governance, it’s likely someone is paying for it and thus could justify the expense to an executive.

                                                                                                                                                                                                                                                                                                                                                                                            • A Little History
                                                                                                                                                                                                                                                                                                                                                                                            • Some case study cameos may help. From 2004 onwards, Sun Microsystems had a policy of all its software moving to open source. The company migrated almost all products to open source licenses, and had varying degrees of success engaging communities around the various projects, largely related to the outlooks of the product management and Sun developers for the project.

                                                                                                                                                                                                                                                                                                                                                                                              Sun occasionally received requests to make older, retired products open source. For example, Sun acquired a company called Lighthouse Design which created a respected suite of office productivity software for Steve Jobs’ NeXT platform. Strategy changes meant that software headed for the vault (while Jonathan Schwartz, a founder of Lighthouse, headed for the executive suite). Members of the public asked if Sun would open source some of this software, but these requests were declined because there was no business unit willing to fund the move.
                                                                                                                                                                                                                                                                                                                                                                                              When Sun was later bought by Oracle, a number of those projects that had been made open source were abandoned. “Abandoning” software doesn’t mean leaving it for others; it means simply walking away from wherever you left it. In the case of Sun’s popular identity middleware products, that meant Oracle let the staff go and tried to migrate customers to other products, while remaining silent in public on the future of the project. But the code was already open source, so the user community was able to pick up the pieces and carry on, with help from Forgerock.
                                                                                                                                                                                                                                                                                                                                                                                              It costs a lot of money to open source a mature piece of commercial software, even if all you are doing is “throwing a tarball over the wall”. That’s why companies abandoning software they no longer care about so rarely make it open source, and those abandoning open source projects rarely move them to new homes that benefit others.

                                                                                                                                                                                                                                                                                                                                                                                              • If all you have thought about is the eventual outcome, you may be surprised how expensive it is to get there. Costs include: For throwing a tarball over the wall:
                                                                                                                                                                                                                                                                                                                                                                                              • Legal clearance.
                                                                                                                                                                                                                                                                                                                                                                                              • Having the right to use the software is not the same as giving everyone in the world an unrestricted right to use it and create derivatives. Checking every line of code to make sure you have the rights necessary to release under an OSI-approved license is a big task requiring high-value employees on the “liberation team”. That includes both developers and lawyers; neither come cheap.

                                                                                                                                                                                                                                                                                                                                                                                                • Repackaging.
                                                                                                                                                                                                                                                                                                                                                                                                • To pass it to others, a self-contained package containing all necessary source code, build scripts and non-public source and tool dependencies has to be created since it is quite unlikely to exist internally. Again, the liberation team will need your best developers.

                                                                                                                                                                                                                                                                                                                                                                                                  • Preserving provenance.
                                                                                                                                                                                                                                                                                                                                                                                                  • Just because you have confidence that you have the rights to the code, that doesn’t mean anyone else will. The version control system probably contains much of the information that gives confidence about who wrote which code, so the repackaging needs to also include a way to migrate the commit information.

                                                                                                                                                                                                                                                                                                                                                                                                    • Code cleaning.
                                                                                                                                                                                                                                                                                                                                                                                                    • The file headers will hopefully include origin information but the liberation team had better check. They also need to check the comments for libel and profanities, not to mention trade secrets (especially those from third parties) and other IP issues.

                                                                                                                                                                                                                                                                                                                                                                                                      • For a sustainable project, all the above plus:
                                                                                                                                                                                                                                                                                                                                                                                                      • Compliance with host governance.
                                                                                                                                                                                                                                                                                                                                                                                                      • It is a fantastic idea to move your project to a host like Apache, Conservancy, Public Software and so on. But doing so requires preparatory work. As a minimum you will need to negotiate with the new host organisation, and they may well need you to satisfy their process requirements. Paperwork obviously, but also the code may need conforming copyright statements and more. That’s more work for your liberation team.

                                                                                                                                                                                                                                                                                                                                                                                                        • Migration of rights.
                                                                                                                                                                                                                                                                                                                                                                                                        • Your code has an existing community who will need to migrate to your new host. That includes your staff – they are community too! They will need commit rights, governance rights, social media rights and more. Your liberation team will need your community manager, obviously, but may also need HR input.

                                                                                                                                                                                                                                                                                                                                                                                                          • Endowment.
                                                                                                                                                                                                                                                                                                                                                                                                          • Keeping your project alive will take money. It’s all been coming from you up to this point, but if you simply walk away before the financial burden has been accepted by the new community and hosts there may be a problem. You should consider making an endowment to your new host to pay for their migration costs plus the cost of hosting the community for at least a year.

                                                                                                                                                                                                                                                                                                                                                                                                            • Marketing.
                                                                                                                                                                                                                                                                                                                                                                                                            • Explaining the move you are making, the reasons why you are making it and the benefits for you and the community is important. If you don’t do it, there are plenty of trolls around who will do it for you. Creating a news blog post and an FAQ — the minimum effort necessary — really does take someone experienced and you’ll want to add such a person to your liberation team.

                                                                                                                                                                                                                                                                                                                                                                                                              • Motivations
                                                                                                                                                                                                                                                                                                                                                                                                              • There has to be some commercial reason that makes the time, effort and thus expense worth incurring. Some examples of motivations include:
                                                                                                                                                                                                                                                                                                                                                                                                              • Market Strategy.
                                                                                                                                                                                                                                                                                                                                                                                                              • An increasing number of companies are choosing to create substantial, openly-governed open source communities around software that contributes to their business. An open multi-stakeholder co-developer community is an excellent vehicle for innovation at the lowest cost to all involved. As long as your market strategy doesn’t require creating artificial scarcity.

                                                                                                                                                                                                                                                                                                                                                                                                                • Contract with a third party.
                                                                                                                                                                                                                                                                                                                                                                                                                • While the owner of the code may no longer be interested, there may be one or more parties to which they owe a contractual responsibility. Rather than breaching that contract, or buying it out, a move to open source may be better. Some sources suggest a contractual obligation to IBM was the reason Oracle abandoned OpenOffice.org by moving it over to the Apache Software Foundation for example.

                                                                                                                                                                                                                                                                                                                                                                                                                  • Larger dependent ecosystem.
                                                                                                                                                                                                                                                                                                                                                                                                                  • You may have no further use for the code itself, but you may well have other parts of your business which depend on it. If they are willing to collectively fund development you might consider an “inner source” strategy which will save you many of the costs above. But the best way to proceed may well be to open the code so your teams and those in other companies can fund the code.

                                                                                                                                                                                                                                                                                                                                                                                                                    • Internal politics.
                                                                                                                                                                                                                                                                                                                                                                                                                    • From the outside, corporations look monolithic, but from the inside it becomes clear they are a microcosm of the market in which they exist. As a result, they have political machinations that may be addressed by open source. One of Oracle’s motivations for moving NetBeans to Apache seems to have been political. Despite multiple internal groups needing it to exist, the code was not generating enough direct revenue to satisfy successive executive owners, who allegedly tried to abandon it on more than one occasion. Donating it to Apache meant that couldn’t happen again.

                                                                                                                                                                                                                                                                                                                                                                                                                      None of this is to say a move to open source guarantees the success of a project. A “Field of Dreams” strategy only works in the movies, after all. But while it may be tempting to look at a failed corporate liberation and describe it as “abandonware”, chances are it was intended as nothing of the kind.

                                                                                                                                                                                                                                                                                                                                                                                                                      Why PS4 downloads are so slow
                                                                                                                                                                                                                                                                                                                                                                                                                      • From the blog that brought us “The origins of XXX as FIXME” and “The mystery of the hanging S3 downloads”, this week it is: “Why are PS4 downloads so slow?”
                                                                                                                                                                                                                                                                                                                                                                                                                      • Game downloads on PS4 have a reputation of being very slow, with many people reporting downloads being an order of magnitude faster on Steam or Xbox. This had long been on my list of things to look into, but at a pretty low priority. After all, the PS4 operating system is based on a reasonably modern FreeBSD (9.0), so there should not be any crippling issues in the TCP stack.

                                                                                                                                                                                                                                                                                                                                                                                                                        The implication is that the problem is something boring, like an inadequately dimensioned CDN. But then I heard that people were successfully using local HTTP proxies as a workaround. It should be pretty rare for that to actually help with download speeds, which made this sound like a much more interesting problem.
                                                                                                                                                                                                                                                                                                                                                                                                                        Before running any experiments, it's good to have a mental model of how the thing we're testing works, and where the problems might be. If nothing else, it will guide the initial experiment design.
                                                                                                                                                                                                                                                                                                                                                                                                                        The speed of a steady-state TCP connection is basically defined by three numbers. The amount of data the client is will to receive on a single round-trip (TCP receive window), the amount of data the server is willing to send on a single round-trip (TCP congestion window), and the round trip latency between the client and the server (RTT). To a first approximation, the connection speed will be:
                                                                                                                                                                                                                                                                                                                                                                                                                        speed = min(rwin, cwin) / RTT
                                                                                                                                                                                                                                                                                                                                                                                                                        With this model, how could a proxy speed up the connection?

                                                                                                                                                                                                                                                                                                                                                                                                                        • The speed through the proxy should be the minimum of the speed between the client and proxy, and the proxy and server. It should only possibly be slower
                                                                                                                                                                                                                                                                                                                                                                                                                        • With a local proxy the client-proxy RTT will be very low; that connection is almost guaranteed to be the faster one. The improvement will have to be from the server-proxy connection being somehow better than the direct client-server one. The RTT will not change, so there are just two options: either the client has a much smaller receive window than the proxy, or the client is somehow causing the server's congestion window to decrease. (E.g. the client is randomly dropping received packets, while the proxy isn't).

                                                                                                                                                                                                                                                                                                                                                                                                                          • After setting up a test rig, where the PS4’s connection was bridged through a linux box so packets could be captured, and artificial latency could be added, some interested results came up:
                                                                                                                                                                                                                                                                                                                                                                                                                          • The differences in receive windows at different times are striking. And more important, the changes in the receive windows correspond very well to specific things I did on the PS4

                                                                                                                                                                                                                                                                                                                                                                                                                            When the download was started, the game Styx: Shards of Darkness was running in the background (just idling in the title screen). The download was limited by a receive window of under 7kB. This is an incredibly low value; it's basically going to cause the downloads to take 100 times longer than they should. And this was not a coincidence, whenever that game was running, the receive window would be that low.
                                                                                                                                                                                                                                                                                                                                                                                                                            Having an app running (e.g. Netflix, Spotify) limited the receive window to 128kB, for about a 5x reduction in potential download speed.
                                                                                                                                                                                                                                                                                                                                                                                                                            Moving apps, games, or the download window to the foreground or background didn't have any effect on the receive window.
                                                                                                                                                                                                                                                                                                                                                                                                                            Playing an online match in a networked game (Dreadnought) caused the receive window to be artificially limited to 7kB.
                                                                                                                                                                                                                                                                                                                                                                                                                            I ran a speedtest at a time when downloads were limited to 7kB receive window. It got a decent receive window of over 400kB; the conclusion is that the artificial receive window limit appears to only apply to PSN downloads.
                                                                                                                                                                                                                                                                                                                                                                                                                            When a game was started (causing the previously running game to be stopped automatically), the receive window could increase to 650kB for a very brief period of time. Basically it appears that the receive window gets unclamped when the old game stops, and then clamped again a few seconds later when the new game actually starts up.
                                                                                                                                                                                                                                                                                                                                                                                                                            I did a few more test runs, and all of them seemed to support the above findings. The only additional information from that testing is that the rest mode behavior was dependent on the PS4 settings. Originally I had it set up to suspend apps when in rest mode. If that setting was disabled, the apps would be closed when entering in rest mode, and the downloads would proceed at full speed.
                                                                                                                                                                                                                                                                                                                                                                                                                            The PS4 doesn't make it very obvious exactly what programs are running. For games, the interaction model is that opening a new game closes the previously running one. This is not how other apps work; they remain in the background indefinitely until you explicitly close them.

                                                                                                                                                                                                                                                                                                                                                                                                                            • So, FreeBSD and its network stack are not to blame
                                                                                                                                                                                                                                                                                                                                                                                                                            • Sony used a poor method to try to keep downloads from interfering with your gameplay
                                                                                                                                                                                                                                                                                                                                                                                                                            • The impact of changing the receive window is highly dependant upon RTT, so it doesn’t work as evenly as actual traffic shaping or queueing would.
                                                                                                                                                                                                                                                                                                                                                                                                                            • An interesting deep dive, it is well worth reading the full article and checking out the graphs
                                                                                                                                                                                                                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                                                                                                                                                                                                                              OpenSSH 7.6 Released
                                                                                                                                                                                                                                                                                                                                                                                                                              • From the release notes:
                                                                                                                                                                                                                                                                                                                                                                                                                              • This release includes a number of changes that may affect existing

                                                                                                                                                                                                                                                                                                                                                                                                                                configurations:
                                                                                                                                                                                                                                                                                                                                                                                                                                ssh(1): delete SSH protocol version 1 support, associated
                                                                                                                                                                                                                                                                                                                                                                                                                                configuration options and documentation.
                                                                                                                                                                                                                                                                                                                                                                                                                                ssh(1)/sshd(8): remove support for the hmac-ripemd160 MAC.
                                                                                                                                                                                                                                                                                                                                                                                                                                ssh(1)/sshd(8): remove support for the arcfour, blowfish and CAST
                                                                                                                                                                                                                                                                                                                                                                                                                                Refuse RSA keys <1024 bits in length and improve reporting for keys that do not meet
                                                                                                                                                                                                                                                                                                                                                                                                                                this requirement.
                                                                                                                                                                                                                                                                                                                                                                                                                                ssh(1): do not offer CBC ciphers by default.

                                                                                                                                                                                                                                                                                                                                                                                                                                • Changes since OpenSSH 7.5
                                                                                                                                                                                                                                                                                                                                                                                                                                • This is primarily a bugfix release. It also contains substantial internal refactoring.
                                                                                                                                                                                                                                                                                                                                                                                                                                • Security: sftp-server(8): in read-only mode, sftp-server was incorrectly permitting creation of zero-length files. Reported by Michal Zalewski.

                                                                                                                                                                                                                                                                                                                                                                                                                                  • New features:
                                                                                                                                                                                                                                                                                                                                                                                                                                  • ssh(1): add RemoteCommand option to specify a command in the ssh config file instead of giving it on the client's command line. This allows the configuration file to specify the command that will be executed on the remote host.

                                                                                                                                                                                                                                                                                                                                                                                                                                    sshd(8): add ExposeAuthInfo option that enables writing details of the authentication methods used (including public keys where applicable) to a file that is exposed via a $SSH_USER_AUTH environment variable in the subsequent session.
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh(1): add support for reverse dynamic forwarding. In this mode, ssh will act as a SOCKS4/5 proxy and forward connections to destinations requested by the remote SOCKS client. This mode is requested using extended syntax for the -R and RemoteForward options and, because it is implemented solely at the client, does not require the server be updated to be supported.
                                                                                                                                                                                                                                                                                                                                                                                                                                    sshd(8): allow LogLevel directive in sshd_config Match blocks;
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh-keygen(1): allow inclusion of arbitrary string or flag certificate extensions and critical options.
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh-keygen(1): allow ssh-keygen to use a key held in ssh-agent as a CA when signing certificates.
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh(1)/sshd(8): allow IPQoS=none in ssh/sshd to not set an explicit ToS/DSCP value and just use the operating system default.
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh-add(1): added -q option to make ssh-add quiet on success.
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh(1): expand the StrictHostKeyChecking option with two new settings. The first "accept-new" will automatically accept hitherto-unseen keys but will refuse connections for changed or invalid hostkeys. This is a safer subset of the current behaviour of StrictHostKeyChecking=no. The second setting "off", is a synonym for the current behaviour of StrictHostKeyChecking=no: accept new host keys, and continue connection for hosts with incorrect hostkeys. A future release will change the meaning of StrictHostKeyChecking=no to the behaviour of "accept-new".
                                                                                                                                                                                                                                                                                                                                                                                                                                    ssh(1): add SyslogFacility option to ssh(1) matching the equivalent option in sshd(8).

                                                                                                                                                                                                                                                                                                                                                                                                                                    • Check out the bugfixes and portability sections, too.
                                                                                                                                                                                                                                                                                                                                                                                                                                    • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                      News Roundup
                                                                                                                                                                                                                                                                                                                                                                                                                                      FreeBSD comes to FiFo 0.9.3 with vmadm
                                                                                                                                                                                                                                                                                                                                                                                                                                      • What is Project FiFo? It’s an Open Source SmartOS Cloud Management and orchestration software. FiFo can be installed on SmartOS zones, running on standard compute nodes. There is no need for dedicated hardware or server roles.
                                                                                                                                                                                                                                                                                                                                                                                                                                      • FiFo 0.9.3 has been in the works for a while, and it comes with quite a few new features. With our last release, we started experimenting with FreeBSD support. Since then much work has gone into improving this. We also did something rather exciting with the mystery box! However, more on that in a later post.

                                                                                                                                                                                                                                                                                                                                                                                                                                        The stable release of 0.9.3 will land within a few days with only packaging and documentation tasks left to do. Part of this means that we’ll have packages for all major components that work natively on BSD. There is no more need for a SmartOS box to run the components!
                                                                                                                                                                                                                                                                                                                                                                                                                                        When we introduced FreeBSD support last version we marked it as an experimental feature. We needed to try out and experiment what works and what does not. Understand the way FreeBSD does things, what tools exist, and how those align with our workflow. Bottomline we were not even sure BSD support was a thing in the future.
                                                                                                                                                                                                                                                                                                                                                                                                                                        We are happy to announce that with 0.9.3 we are now sure BSD support is a thing, and it is here to remain. That said it was good that we experimented in the last release, we did some significant changes to what we have now. When first looking at FreeBSD we went ahead and used existing tooling, namely iocage, to manage jails. It turns out the tooling around jails is not on par with what exists on illumos and especially SmartOS. The goodness of vmadm as a CLI for managing zones is just unparalleled. So we do what every (in)sane person would do!
                                                                                                                                                                                                                                                                                                                                                                                                                                        So with 0.9.3, we did what every (in)sane person would do! We implemented a version of vmadm that would work with FreeBSD and jails and keep the same CLI. Our clone works completely stand alone; vmadm is a compiled binary, written in rust which is blazing fast! The design takes up lessons learned from both zoneadm and vmadm in illumos/SmartOS for how things work instead of trying to reinvent the wheel. Moreover, while we love giving the FreeBSD community a tool we learned to love on SmartOS this also makes things a lot easier for us. FiFo now can use the same logic on SmartOS and FreeBSD as the differences are abstracted away inside of vmadm. That said there are a few notable differences.
                                                                                                                                                                                                                                                                                                                                                                                                                                        First of all, vmadm uses datasets the same way it does on SmartOS. However, there is no separate imgadm tool. Instead, we encapsulate the commands under vmadm images. To make this work we also provide a dataset server with base images for FreeBSD that used the same API as SmartOS dataset servers. Second, we needed to work around some limitations in VNET to make jails capable of being fully utilized in multi-tenancy environments.
                                                                                                                                                                                                                                                                                                                                                                                                                                        Nested vnet jails on freebsd While on illumos a virtual nic can be bound to an IP that can not be changed from inside the zone, VNET does not support this. Preventing tenants from messing with IP settings is crucial from a security standpoint!
                                                                                                                                                                                                                                                                                                                                                                                                                                        To work around that each jail created by vmadm are two jails: a minimal outer jail with nothing but a VNET interface, no IP or anything and an internal one that runs the user code. This outer jail then creates an inner jail with an inherited NIC that gets a fixed IP, combining both the security of a VNET jail as well as the security of a fixed IP interface.
                                                                                                                                                                                                                                                                                                                                                                                                                                        The nested jail layout resembles the way that SmartOS handles KVM machines, running KVM inside a zone. So in addition to working around VNET limitations, this already paves the way for bhyve nested in jails that might come in a future release. We hope to leverage the same two-step with just a different executable started in the outer jail instead of the jail command itself.

                                                                                                                                                                                                                                                                                                                                                                                                                                        History of UNIX Manpages

                                                                                                                                                                                                                                                                                                                                                                                                                                        Where do UNIX manpages come from? Who introduced the section-based layout of NAME, SYNOPSIS, and so on? And for manpage source writers and readers: where were those economical two- and three-letter instructions developed? The many accounts available on the Internet lack citations and are at times inconsistent.

                                                                                                                                                                                                                                                                                                                                                                                                                                        In this article, I reconstruct the history of the UNIX manpage based on source code, manuals, and first-hand accounts.
                                                                                                                                                                                                                                                                                                                                                                                                                                        Special thanks to Paul Pierce for his CTSS source archive; Bernard Nivelet for the Multics Internet Server; the UNIX Heritage Society for their research UNIX source reconstruction; Gunnar Ritter for the Heirloom Project sources; Alcatel-Lucent Bell Labs for the Plan 9 sources; BitSavers for their historical archive; and last but not least, Rudd Canaday, James Clarke, Brian Kernighan, Douglas McIlroy, Nils-Peter Nelson, Jerome Saltzer, Henry Spencer, Ken Thompson, and Tom Van Vleck for their valuable contributions.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Please see the Copyright section if you plan on reproducing parts of this work.

                                                                                                                                                                                                                                                                                                                                                                                                                                        • People:
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Abell, Vic
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Canaday, Rudd
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Capps, Dennis
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Clarke, James
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Dzonsons, Kristaps
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Kernighan, Brian
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Madnick, Stuart
                                                                                                                                                                                                                                                                                                                                                                                                                                          • McIlroy, Douglas
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Morris, Robert
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Ossanna, Joseph F.
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Ritchie, Dennis
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Ritter, Gunnar
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Saltzer, Jerome H.
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Spencer, Henry
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Thompson, Ken
                                                                                                                                                                                                                                                                                                                                                                                                                                          • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                            BSDCam 2017 Trip Report: Mathieu Arnold

                                                                                                                                                                                                                                                                                                                                                                                                                                            It seems that every time I try to go to England using the Eurostar, it gets delayed between 30 minutes and 2 hours. This year, it got my 45 minute layover down to 10 minutes. Luckily, King’s Cross is literally across the street from Saint Pancras, and I managed to get into my second train just in time.

                                                                                                                                                                                                                                                                                                                                                                                                                                            I arrived in Cambridge on Tuesday right on time for tea. A quick walk from the station got me to St Catharine’s College. This year, we were in a different building for the rooms, so I listened to the convoluted explanation the porter gave me to get to my room, I managed to get there without getting lost more than once. That evening was almost organized as we got together for dinner at the usual pub, the Maypole.

                                                                                                                                                                                                                                                                                                                                                                                                                                            • Wednesday:
                                                                                                                                                                                                                                                                                                                                                                                                                                            • The weather is lovely, and it is a good thing as there is a 25-30 minute walk from the College to the Computer Laboratory where the devsummit happens. The first morning is for deciding what we are going to talk about for the rest of the week, so we all go in turn introducing ourselves and voicing about what we would like to talk about. There are a few subjects that are of interest to me, so I listen to the toolchain discussions while writing new bits for the Porter’s Handbook.

                                                                                                                                                                                                                                                                                                                                                                                                                                              • Thursday:
                                                                                                                                                                                                                                                                                                                                                                                                                                              • I spent most of the day writing documentation, and talked a bit with a couple of DocEng members about joining the team as I would like to give some love to the build framework that has not been touched in a long time. At the end of the afternoon is a packaging session, we talked about the status of package in base, which is not really going anywhere right now. On the ports side, three aspects that are making good progress include, package flavors, sub packages, and migrating some base libraries to private libraries, which is a nightmare because of openssl, and kerberos, and pam. That evening, we had the formal diner at St John’s College, I love those old buildings that reminds me of Hogwarts. (I am sure there is a quidditch pitch somewhere nearby.)

                                                                                                                                                                                                                                                                                                                                                                                                                                                • Friday:
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Last day. I continued to write documentation, while listening to a provisioning session. It would be great to have bhyve support in existing orchestration tools like vagrant, openstack, or maybe ganeti. We end the day, and the devsummit with short talks, some very interesting, some going way over my head.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The weekend is here. I spent most of Saturday strolling in some of the numerous Cambridge parks, gardens, greens, fens… and I worked on a knitting pattern in the evening. On Sunday, I ate my last full gargantuan english breakfast of the year, and then back in a train to King’s Cross, and a Eurostar (this one on time) back to Paris.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  I would like to thank the FreeBSD Foundation for making this trip possible for me.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  GSoC 2017 Reports: Add SUBPACKAGES support to pkgsrc, part 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Introduction
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • SUBPACKAGES (on some package systems they are known as multi-packages, but this term for pkgsrc is already used by packages that can be built against several versions (e.g. Python, PHP, Ruby packages)) consist in generating multiple binary packages from a single pkgsrc package. For example, from a pkgsrc package - local/frobnitzem - we will see how to generate three separate binary packages: frobnitzem-foo, frobnitzem-bar and frobnitzem-baz.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • This can be useful to separate several components of binary packages (and avoid to run the extract and configure phase two times!), for debugpkgs (so that all *.debug files containing debug symbols are contained in a separate -debugpkg package that can be installed only when it is needed), etc..
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • An high-level look at how SUBPACKAGES support is implemented
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Most of the changes needed are in mk/pkgformat/pkg/ hierarchy (previously known as mk/flavour and then renamed and generalized to other package formats during Anton Panev's Google Summer of Code 2011).
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • The code in mk/pkgformat/${PKG_FORMAT}/ handle the interaction of pkgsrc with the particular ${PKG_FORMAT}, e.g. for pkg populate meta-data files used by pkg_create(1), install/delete packages via pkg_add(1), and pkg_delete(1), etc.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Conclusion
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • In this first part of this blog post series we have seen what are SUBPACKAGES, when and why they can be useful.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • We have then seen a practical example of them taking a very trivial package and learned how to "subpackage-ify" it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Then we have described - from an high-level perspective - the changes needed to the pkgsrc infrastructure for the SUBPACKAGES features that we have used. If you are more interested in them please give a look to the pkgsrc debugpkg branch that contains all work done described in this blog post.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • In the next part we will see how to handle DEPENDS and buildlink3 inclusion for subpackages.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • **
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Beastie Bits
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • First partial boot of FreeBSD on Power8
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • The new TNF Board of Directors are installed and patched for 2017.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Open Source Summit 2017 October 23-26, 2017, Prague, Czech Republic Giovanni Bechis will give a talk about seccomp(2) vs pledge(2)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • My first patch to OpenBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feedback/Questions
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Brian - OPNSense Facebook Group
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Mark Felder - ZFS Health via SNMP
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Matt - Cantrill Presentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                        1 hr 31 min
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • 213: The French CONnection

                                                                                                                                                                                                                                                                                                                                                                                                                                                        We recap EuroBSDcon in Paris, tell the story behind a pf PR, and show you how to do screencasting with OpenBSD.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        This episode was brought to you by

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Headlines
                                                                                                                                                                                                                                                                                                                                                                                                                                                        Recap of EuroBSDcon 2017 in Paris, France
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • EuroBSDcon was held in Paris, France this year, which drew record numbers this year.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • With over 300 attendees, it was the largest BSD event I have ever attended, and I was encouraged by the higher than expected number of first time attendees.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The FreeBSD Foundation held a board meeting on Wednesday afternoon with the members who were in Paris. Topics included future conferences (including a conference kit we can mail to people who want to represent FreeBSD) and planning for next year.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The FreeBSD Devsummit started on Thursday at the beautiful Mozilla Office in Paris. After registering and picking up our conference bag, everyone gathered for a morning coffee with lots of handshaking and greeting. We then gathered in the next room which had a podium with microphone, screens as well as tables and chairs. After developers sat down, Benedict opened the devsummit with a small quiz about France for developers to win a Mogics Power Bagel. 45 developers participated and DES won the item in the end. After introductions and collecting topics of interest from everyone, we started with the Work in Progress (WIP) session.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The WIP session had different people present a topic they are working on in 7 minute timeslots. Topics ranged from FreeBSD Forwarding Performance, fast booting options, and a GELI patch under review to attach multiple providers. See their slides on the FreeBSD wiki.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • After lunch, the FreeBSD Foundation gave a general update on staff and funding, as well as a more focused presentation about our partnership with Intel. People were interested to hear what was done so far and asked a few questions to the Intel representative Glenn Weinberg.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • After lunch, developers worked quietly on their own projects. The mic remained open and occasionally, people would step forward and gave a short talk without slides or motivated a discussion of common interest. The day concluded with a dinner at a nice restaurant in Paris, which allowed to continue the discussions of the day.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The second day of the devsummit began with a talk about the CAM-based SDIO stack by Ilya Bakulin. His work would allow access to wifi cards/modules on embedded boards like the Raspberry Pi Zero W and similar devices as many of these are using SDIO for data transfers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Next up was a discussion and Q&A session with the FreeBSD core team members who were there (missing only Benno Rice, Kris Moore, John Baldwin, and Baptiste Daroussin, the latter being busy with conference preparations). The new FCP (FreeBSD community proposals) were introduced for those who were not at BSDCan this year and the hows and whys about it. Allan and I were asked to describe our experiences as new members of core and we encouraged people to run for core when the next election happens. After a short break, Scott Long gave an overview of the work that’s been started on NUMA (Non-Uniform Memory Architecture), what the goals of the project are and who is working on it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Before lunch, Christian Schwarz presented his work on zrepl, a new ZFS replication solution he developed using Go. This sparked interest in developers, a port was started and people suggested to Christian that he should submit his talk to AsiaBSDcon and BSDCan next year. Benedict had to leave before lunch was done to teach his Ansible tutorial (which was well attended) at the conference venue.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • There were organized dinners, for those two nights, quite a feat of organization to fit over 100 people into a restaurant and serve them quickly.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • On Saturday, there was a social event, a river cruise down the Seine. This took the form of a ‘standing’ dinner, with a wide selection of appetizer type dishes, designed to get people to walk around and converse with many different people, rather than sit at a table with the same 6-8 people. I talked to a much larger group of people than I had managed to at the other dinners.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • I like having both dinner formats.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • We would also like to thank all of the BSDNow viewers who attended the conference and made the point of introducing themselves to us. It was nice to meet you all.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The recordings of the live video stream from the conference are available immediately, so you can watch the raw versions of the talks now:
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Auditorium
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Keynote 1: Software Development in the Age of Heroes by Thomas Pornin
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Tuning FreeBSD for routing and firewalling by Olivier Cochard-Labbé
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • My BSD sucks less than yours, Act I by Antoine Jacoutot and Baptiste Daroussin
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • My BSD sucks less than yours, Act II by Antoine Jacoutot and Baptiste Daroussin
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Reproducible builds on NetBSD by Christos Zoulas
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Your scheduler is not the problem by Martin Pieuchot
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Keynote 2: A French story on cybercrime by Éric Freyssinet
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Case studies of sandboxing base system with Capsicum by Mariusz Zaborski
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • OpenBSD’s small steps towards DTrace (a tale about DDB and CTF) by Jasper Lievisse Adriaanse
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • The Realities of DTrace on FreeBSD by George Neville-Neil
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • OpenSMTPD, current state of affairs by Gilles Chehade
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Hoisting: lessons learned integrating pledge into 500 programs by Theo de Raadt
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Keynote 3: System Performance Analysis Methodologies by Brendan Gregg
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Closing Session
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Karnak
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • “Is it done yet ?” The never ending story of pkg tools by Marc Espie
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • A Tale of six motherboards, three BSDs and coreboot by Piotr Kubaj and Katarzyna Kubaj
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • State of the DragonFly’s graphics stack by François Tigeot
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • From NanoBSD to ZFS and Jails – FreeBSD as a Hosting Platform, Revisited by Patrick M. Hausen
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bacula – nobody ever regretted making a backup by Dan Langille
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Never Lose a Syslog Message by Alexander Bluhm
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Running CloudABI applications on a FreeBSD-based Kubernetes cluster by Ed Schouten
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The OpenBSD web stack by Michael W. Lucas
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The LLDB Debugger on NetBSD by Kamil Rytarowski
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • What’s in store for NetBSD 8.0? by Alistair Crooks
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Louxor
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • A Modern Replacement for BSD spell(1) by Abhinav Upadhyay
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Portable Hotplugging: NetBSD’s uvm_hotplug(9) API development by Cherry G. Mathew
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Hardening pkgsrc by Pierre Pronchery
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Discovering OpenBSD on AWS by Laurent Bernaille
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • OpenBSD Testing Infrastructure Behind bluhm.genua.de by Jan Klemkow
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • The school of hard knocks – PT1 by Sevan Janiyan
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • 7 years of maintaining firefox, and still looking ahead by Landry Breuil
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Branch VPN solution based on OpenBSD, OSPF, RDomains and Ansible by Remi Locherer
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Running BSD on AWS by Julien Simon and Nicolas David
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Getting started with OpenBSD device driver development by Stefan Sperling
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • A huge thanks to the organizers, program committee, and sponsors of EuroBSDCon. Next year, EuroBSDcon will be in Bucharest, Romania.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                The story of PR 219251
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • The actual story I wanted Kristof to tell, the pf bug he fixed at the Essen Hackathon earlier this summer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • As I threatened to do in my previous post, I'm going to talk about PR 219251 for a bit. The bug report dates from only a few months ago, but the first report (that I can remeber) actually came from Shawn Webb on Twitter, of all places

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Despite there being a stacktrace it took quite a while (nearly 6 months in fact) before I figured this one out.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  It took Reshad Patuck managing to distill the problem down to a small-ish test script to make real progress on this. His testcase meant that I could get core dumps and experiment. It also provided valuable clues because it could be tweaked to see what elements were required to trigger the panic.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This test script starts a (vnet) jail, adds an epair interface to it, sets up pf in the jail, and then reloads the pf rules on the host. Interestingly the panic does not seem to occur if that last step is not included.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Obviously not the desired behaviour, but it seems strange. The instances of pf in the jails are supposed to be separate.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • We try to fetch a counter value here, but instead we dereference a bad pointer. There's two here, so already we need more information. Inspection of the core dump reveals that the state pointer is valid, and contains sane information. The rule pointer (rule.ptr) points to a sensible location, but the data is mostly 0xdeadc0de. This is the memory allocator being helpful (in debug mode) and writing garbage over freed memory, to make use-after-free bugs like this one easier to find.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    In other words: the rule has been free()d while there was still a state pointing to it. Somehow we have a state (describing a connection pf knows about) which points to a rule which no longer exists. The core dump also shows that the problem always occurs with states and rules in the default vnet (i.e. the host pf instance), not one of the pf instances in one of the vnet jails. That matches with the observation that the test script does not trigger the panic unless we also reload the rules on the host.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Great, we know what's wrong, but now we need to work out how we can get into this state. At this point we're going to have to learn something about how rules and states get cleaned up in pf. Don't worry if you had no idea, because before this bug I didn't either.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The states keep a pointer to the rule they match, so when rules are changed (or removed) we can't just delete them. States get cleaned up when connections are closed or they time out. This means we have to keep old rules around until the states that use them expire.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    When rules are removed pf_unlink_rule() adds then to the V_pf_unlinked_rules list (more on that funny V_ prefix later). From time to time the pf purge thread will run over all states and mark the rules that are used by a state. Once that's done for all states we know that all rules that are not marked as in-use can be removed (because none of the states use it). That can be a lot of work if we've got a lot of states, so pf_purge_thread() breaks that up into smaller chuncks, iterating only part of the state table on every run.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    We iterate over all of our virtual pf instances (VNET_FOREACH()), check if it's active (for FreeBSD-EN-17.08, where we've seen this code before) and then check the expired states with pf_purge_expired_states(). We start at state 'idx' and only process a certain number (determined by the PFTM_INTERVAL setting) states. The pf_purge_expired_states() function returns a new idx value to tell us how far we got.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    So, remember when I mentioned the odd V_ prefix? Those are per-vnet variables. They work a bit like thread-local variables. Each vnet (virtual network stack) keeps its state separate from the others, and the V_ variables use a pointer that's changed whenever we change the currently active vnet (say with CURVNET_SET() or CURVNET_RESTORE()). That's tracked in the 'curvnet' variable. In other words: there are as many V_pf_vnet_active variables as there are vnets: number of vnet jails plus one (for the host system).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Why is that relevant here? Note that idx is not a per-vnet variable, but we handle multiple pf instances here. We run through all of them in fact. That means that we end up checking the first X states in the first vnet, then check the second X states in the second vnet, the third X states in the third and so on and so on.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    That of course means that we think we've run through all of the states in a vnet while we really only checked some of them. So when pf_purge_unlinked_rules() runs it can end up free()ing rules that actually are still in use because pf_purge_thread() skipped over the state(s) that actually used the rule. The problem only happened if we reloaded rules in the host, because the active ruleset is never free()d, even if there are no states pointing to the rule.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    That explains the panic, and the fix is actually quite straightforward: idx needs to be a per-vnet variable, V_pf_purge_idx, and then the problem is gone. As is often the case, the solution to a fairly hard problem turns out to be really simple.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • As you might expect, finding the problem takes a lot more work that fixing it
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Thanks to Kristof for writing up this detailed post explaining how the problem was found, and what caused it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      vBSDcon 2017: BSD at Work

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The third biennial vBSDcon hosted by Verisign took place September 7th through 9th with the FreeBSD Developer Summit taking place the first day. vBSDcon and iXsystems’ MeetBSD event have been alternating between the East and West coasts of the U.S.A. and these two events play vital roles in reaching Washington, DC-area and Bay Area/Silicon Valley audiences. Where MeetBSD serves many BSD Vendors, vBSDcon attracts a unique government and security industry demographic that isn’t found anywhere else. Conference time and travel budgets are always limited and bringing these events to their attendees is a much-appreciated service provided by their hosts.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The vBSDcon FreeBSD DevSummit had a strong focus on OpenZFS, the build system and networking with the FreeBSD 12 wish list of features in mind. How to best incorporate the steady flow of new OpenZFS features into FreeBSD such as dataset-level encryption was of particular interest. This feature from a GNU/Linux-based storage vendor is tribute to the growth of the OpenZFS community which is vital in light of the recent “Death of Solaris and ZFS” at Oracle. There has never been more demand for OpenZFS on FreeBSD and the Oracle news further confirms our collective responsibility to meet that demand.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The official conference opened with my talk on “Isolated BSD Build Environments” in which I explained how the bhyve hypervisor can be used to effortlessly tour FreeBSD 5.0-onward and build specific source releases on demand to trace regressions to their offending commit. I was followed by a FreeNAS user who made the good point that FreeNAS is an exemplary “entry vector” into Unix and Enterprise Storage fundamentals, given that many of the vectors our generation had are gone. Where many of us discovered Unix and the Internet via console terminals at school or work, smart phones are only delivering the Internet without the Unix. With some irony, both iOS and Android are Unix-based yet offer few opportunities for their users to learn and leverage their Unix environments.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The next two talks were The History and Future of Core Dumps in FreeBSD by Sam Gwydir and Using pkgsrc for multi-platform deployments in heterogeneous environments by G. Clifford Williams. I strongly recommend that anyone wanting to speak at AsiaBSDCon read Sam’s accompanying paper on core dumps because I consider it the perfect AsiaBSDCon topic and his execution is excellent. Core dumps are one of those things you rarely think about until they are a DROP EVERYTHING! priority. G. Clifford’s talk was about what I consider a near-perfect BSD project: pkgsrc, the portable BSD package manager. I put it up there with OpenSSH and mandoc as projects that have provided significant value to other Open Source operating systems. G. Clifford’s real-world experiences are perfectly inline with vBSDcon’s goal to be more production-oriented than other BSDCons.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Of the other talks, any and all Dtrace talks are always appreciated and George Neville-Neil’s did not disappoint. He based it on his experiences with the Teach BSD project which is bringing FreeBSD-based computer science education to schools around the world. The security-related talks by John-Mark Gurney, Dean Freeman and Michael Shirk also represented vBSDcon’s consideration of the local community and made a convincing point that the BSDs should make concerted efforts to qualify for Common Criteria, FIPS, and other Government security requirements. While some security experts will scoff at these, they are critical to the adoption of BSD-based products by government agencies.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      BSD Now hosts Allan Jude and Benedict Reuschling hosted an OpenZFS BoF and Ansible talk respectively and I hosted a bhyve hypervisor BoF. The Hallway Track and food at vBSDcon were excellent and both culminated with an after-dinner dramatic reading of Michael W. Lucas’ latest book that raised money for the FreeBSD Foundation. A great time was had by all and it was wonderful to see everyone!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      News Roundup
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      FreeBSD 10.4-RC2 Available
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • FreeBSD 10.4 will be released soon, this is the last chance to find bugs before the official release is cut.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Noteworthy Changes Since 10.4-RC1:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Given that the amd64 disc1 image was overflowing, more of the base components installed into the disc1 (live) file systems had to be disabled. Most notably, this removed the compiler toolchain from the disc1 images. All disabled tools are still available with the dvd1 images, though.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The aesni(4) driver now no longer shares a single FPU context across multiple sessions in multiple threads, addressing problems seen when employing aesni(4) for ipsec(4).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Support for netmap(4) by the ixgbe(4) driver has been brought into line with the netmap(4) API present in stable/10. Also, ixgbe(4) now correctly handles VFs in its netmap(4) support again instead of treating these as PFs.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • During the creation of amd64 and i386 VM images, etcupdate(8) and mergemaster(8) databases now are bootstrapped, akin to what happens along the extraction of base.txz as part of a new installation via bsdinstall(8). This change allows for both of these tools to work out-of-box on the VM images and avoids errors seen when upgrading these images via freebsd-update(8).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • If you are still on the stable/10 branch, you should test upgrading to 10.4, and make sure there are no problems with your workload
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Additional testing specifically of the features that have changed since 10.4-BETA1 would also be most helpful
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • This will be the last release from the stable/10 branch
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          OpenBSD changes of note 628

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          EuroBSDCon in two weeks. Be sure to attend early and often.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Many and various documentation improvements for libcrypto. New man pages, rewrites, expanded bugs sections, and more.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Only allow upward migration in vmd.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • There’s a README for the syspatch build system if you want to run your own.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Move the kernel relinking code from /etc/rc into a seperate script usable by syspatch. Kernel patches can now be reduced to just the necessary files.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Make the callers of sogetopt() responsible for allocating memory. Now allocation and free occur in the same place.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Use waitpid() instead of wait() in most programs to avoid accidentally collecting the wrong child.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Have cu call isatty() before making assumptions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Switch mandoc rendering of mathematical symbols and greek letters from trying to imitate the characters’ graphical shapes, which resulted in unintelligible renderings in many cases, to transliterations conveying the characters’ meanings.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Update libexpat to 2.2.4. Fix copying partial UTF-8 characters.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Sigh, here we go again.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Work around bug in F5’s handling of the supported elliptic curves extension. RFC 4492 only defines elliptic_curves for ClientHello. However, F5 is sending it in ServerHello. We need to skip over it since our TLS extension parsing code is now more strict.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • After a first install, run syspatch -c to check for patches.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • If SMAP is present, clear PSL_AC on kernel entry and interrupt so that only the code in copy{in,out}* that need it run with it set. Panic if it’s set on entry to trap() or syscall(). Prompted by Maxime Villard’s NetBSD work. Errata.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • New drivers for arm: rktemp, mvpinctrl, mvmpic, mvneta, mvmdio, mvpxa, rkiic, rkpmic.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • No need to exec rm from within mandoc. We know there’s exactly one file and directory to remove. Similarly with running cmp.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Revert to Mesa 13.0.6 to hopefully address rendering issues a handful of people have reported with xpdf/fvwm on ivy bridge with modesetting driver.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Rewrite ALPN extension using CBB/CBS and the new extension framework. Rewrite SRTP extension using CBB/CBS and the new extension framework.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Revisit 2q queue sizes. Limit the hot queue to 1/20th the cache size up to a max of 4096 pages. Limit the warm and cold queues to half the cache. This allows us to more effectively notice re-interest in buffers instead of losing it in a large hot queue.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Add glass console support for arm64. Probably not yet for your machine, though.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Replace heaps of hand-written syscall stubs in ld.so with a simpler framework.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • 65535 is a valid port to listen on.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • When xinit starts an X server that listens only on UNIX socket, prefer DISPLAY=unix:0 rather than DISPLAY=:0. This will prevent applications from ever falling back to TCP if the UNIX socket connection fails (such as when the X server crashes). Reverted.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Add -z and -Z options to apmd to auto suspend or hibernate when low on battery.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Remove the original (pre-IETF) chacha20-poly1305 cipher suites.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Add urng(4) which supports various USB RNG devices. Instead of adding one driver per device, start bundling them into a single driver.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Remove old deactivated pledge path code. A replacement mechanism is being brewed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix a bug from the extension parsing rewrite. Always parse ALPN even if no callback has been installed to prevent leaving unprocessed data which leads to a decode error.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Clarify what is meant by syslog priorities being ordered, since the numbers and priorities are backwards.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Remove a stray setlocale() from ksh, eliminating a lot of extra statically linked code.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Unremove some NPN symbols from libssl because ports software thinks they should be there for reasons.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix saved stack location after resume. Somehow clang changed it. Resume works again on i386.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Improve error messages in vmd and vmctl to be more informative.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Stop building the miniroot installer for OMAP3 Beagleboards. It hasn’t worked in over a year and nobody noticed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Have the callers of sosetopt() free the mbuf for symmetry.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • On octeon, let the kernel use the hardware FPU even if emulation is compiled in. It’s faster.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix support for 486DX CPUs by not calling cpuid. I used to own a 486. Now I don’t.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Merge some drm fixes from linux.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Defer probing of floppy drives, eliminating delays during boot.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Better handling of probes and beacons and timeouts and scans in wifi stack to avoid disconnects.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Move mutex, condvar, and thread-specific data routes, pthread_once, and pthread_exit from libpthread to libc, along with low-level bits to support them. Let’s thread aware (but not actually threaded) code work with just libc.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • New POSIX xlocale implementation. Complete as long as you only use ASCII and UTF-8, as you should.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Round and round it goes; when 6.2 stops, nobody knows. A peak at the future?
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Screencasting with OpenBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • USB Audio
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Any USB microphone should appear as a new audio device. Here is the dmesg for my mic by ART:


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  uaudio0 at uhub0 port 2 configuration 1 interface 0 "M-One USB" rev 1.10/0.01 addr 2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  uaudio0: audio rev 1.00, 8 mixer controls
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  audio1 at uaudio0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  audioctl can read off all of the specific characterisitcs of this device


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $ audioctl -f /dev/audio1 | grep record
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  mode=play,record
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.rate=48000
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.channels=1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.precision=16
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.bps=2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.msb=1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.encoding=slinear_le
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.pause=0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.active=0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.block_size=1960
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.bytes=0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  record.errors=0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Now test the recording from the second audio device using aucat(1)


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  aucat -f rsnd/1 -o file.wav

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  If the device also has a headset audio can be played through the same device.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  aucat -f rsnd/1 -i file.wav

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Screen Capture using Xvfb
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • The rate at which a framebuffer for your video card is a feature of the hardware and software your using, and it's often very slow. x11vnc will print an estimate of the banwidth for the system your running.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    x11vnc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    09/05/2012 22:23:45 fb read rate: 7 MB/sec

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This is about 4fps. We can do much better by using a virtual framebuffer. Here I'm setting up a new screen, setting the background color, starting cwm and an instance of xterm


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Xvfb :1 -screen 0 720x540x16 &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    DISPLAY=:1 xsetroot -solid steelblue &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    DISPLAY=:1 cwm &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    DISPLAY=:1 xterm +sb -fa Hermit -fs 14 &

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Much better! Now we're up around 20fps.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    x11vnc -display :1 &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    11/05/2012 18:04:07 fb read rate: 168 MB/sec

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Make a connection to this virtual screen using raw encoding to eliminate time wasted on compression.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    vncviewer localhost -encodings raw

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    A test recording with sound then looks like this


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ffmpeg -f sndio -i snd/1 -y -f x11grab -r 12 -s 800x600 -i :1.0 -vcodec ffv1 ~/out.avi

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Note: always stop the recording and playback using q, not Ctrl-C so that audio inputs are shut down properly.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Screen Capture using Xephyr
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Xephyr is perhaps the easiest way to run X with a shadow framebuffer. This solution also avoids reading from the video card's RAM, so it's reasonably fast.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Xephyr -ac -br -noreset -screen 800x600 :1 &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      DISPLAY=:1 xsetroot -solid steelblue &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      DISPLAY=:1 cwm &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      DISPLAY=:1 xrdb -load ~/.Xdefaults &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      DISPLAY=:1 xterm +sb -fa "Hermit" -fs 14 &

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Capture works in exactally the same way. This command tries to maintain 12fps.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ffmpeg -f sndio -i snd/1 -y -f x11grab -r 12 -s 800x600 -i :1.0 -vcodec ffv1 -acodec copy ~/out.avi
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      To capture keyboard and mouse input press Ctrl then Shift. This is very handy for using navigating a window manager in the nested X session.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Arranging Windows
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • I have sometimes found it helpful to launch applications and arrange them in a specific way. This will open up a web browser listing the current directory and position windows using xdotool


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DISPLAY=:1 midori "file:///pwd" &
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        sleep 2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DISPLAY=:1 xdotool search --name "xterm" windowmove 0 0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DISPLAY=:1 xdotool search --class "midori" windowmove 400 0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DISPLAY=:1 xdotool search --class "midori" windowsize 400 576

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This will position the window precisely so that it appears to be in a tmux window on the right.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Audio/Video Sync
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • If you find that the audio is way out of sync with the video, you can ajust the start using the -ss before the audio input to specify the number of seconds to delay. My final recording command line, that delays the audio by 0.5 seconds, writing 12fps


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ffmpeg -ss 0.5 -f sndio -i snd/1 -y -f x11grab -r 12 -s 800x600 -i :1.0 -vcodec ffv1 -acodec copy ~/out.avi

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Sharing a Terminal with tmux
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • If you're trying to record a terminal session, tmux is able to share a session. In this way a recording of an X framebuffer can be taken without even using the screen. Start by creating the session.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tmux -2 -S /tmp/tmux0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Then on the remote side connect on the same socket


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tmux -2 -S /tmp/tmux0 attach

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Taking Screenshots
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Grabbing a screenshots on Xvfb server is easily accomplished with ImageMagick's import command


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              DISPLAY=:1 import -window root screenshot.png

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Audio Processing and Video Transcoding
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • The first step is to ensure that the clip begins and ends where you'd like it to. The following will make a copy of the recording starting at time 00:00 and ending at 09:45


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ffmpeg -i interactive-sql.avi \
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -vcodec copy -acodec copy
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -ss 00:00:00 -t 00:09:45
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interactive-sql-trimmed.avi
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                mv interactive-sql-trimmed.avi interactive-sql.avi

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Setting the gain correctly is very important with an analog mixer, but if you're using a USB mic there may not be a gain option; simply record using it's built-in settings and then adjust the levels afterwards using a utility such as normalize. First extact the audio as a raw PCM file and then run normalize


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ffmpeg -i interactive-sql.avi -c:a copy -vn audio.wav
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                normalize audio.wav

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Next merge the audio back in again


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ffmpeg -i interactive-sql.avi -i audio.wav \
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -map 0:0 -map 1:0 -c copy interactive-sql-normalized.avi

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The final step is to compress the screencast for distribution. Encoding to VP8/Vorbis is easy:


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ffmpeg -i interactive-sql-normalized.avi -c:v libvpx -b:v 1M
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -c:a libvorbis -q:a 6 interactive-sql.webm

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                H.264/AAC is tricky. For most video players the color space needs to be set to yuv420p. The -movflags puts the index data at the beginning of the file to enable streaming/partial content requests over HTTP:


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ffmpeg -y -i interactive-sql-normalized.avi -c:v libx264 \
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -preset slow -crf 14 -pix_fmt yuv420p -movflags +faststart \
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -c:a aac -q:a 6 interactive-sql.mp4

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                TrueOS @ Ohio Linuxfest ’17!
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Dru Lavigne and Ken Moore are both giving presentations on Saturday the 30th. Sit in and hear about new developments for the Lumina and FreeNAS projects.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Ken is offering Lumina Rising: Challenging Desktop Orthodoxy at 10:15 am in Franklin A. Hear his thoughts about the ideas propelling desktop environment development and how Lumina, especially Lumina 2, is seeking to offer a new model of desktop architecture. Elements discussed include session security, application dependencies, message handling, and operating system integration.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Dru is talking about What’s New in FreeNAS 11 at 2:00 pm in Franklin D. She’ll be providing an overview of some of the new features added in FreeNAS 11.0, including:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Alert Services
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Starting specific services at boot time
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • AD Monitoring to ensure the AD service restarts if disconnected
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • A preview of the new user interface
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • support for S3-compatible storage and the bhyve hypervisor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • She’s also giving a sneak peek of FreeNAS 11.1, which has some neat features:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A complete rewrite of the Jails/Plugins system as FreeNAS moves from warden to iocage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Writing new plugins with just a few lines of code
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A brand new asynchronous middleware API
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Who’s going? Attending this year are:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Dru Lavigne (dlavigne): Dru leads the technical documentation team at iX, and contributes heavily to open source documentation projects like FreeBSD, FreeNAS, and TrueOS.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Ken Moore (beanpole134): Ken is the lead developer of Lumina and a core contributor to TrueOS. He also works on a number of other Qt5 projects for iXsystems.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • J.T. Pennington (q5sys): Some of you may be familiar with his work on BSDNow, but J.T. also contributes to the TrueOS, Lumina, and SysAdm projects, helping out with development and general bug squashing.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Beastie Bits
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Lumina Development Preview: Theme Engine
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • It's happening! Official retro Thinkpad lappy spotted in the wild
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • LLVM libFuzzer and SafeStack ported to NetBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Remaining 2017 FreeBSD Events
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feedback/Questions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Andrew - BSD Teaching Material
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Seth - Switching to Tarsnap after Crashplan becomes no more
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Thomas - Native encryption in ZFS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Coding Cowboy - Coding Cowboy - Passwords and clipboards
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1 hr 31 min
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • 212: The Solaris Eclipse

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            We recap vBSDcon, give you the story behind a PF EN, reminisce in Solaris memories, and show you how to configure different DEs on FreeBSD.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This episode was brought to you by

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Headlines
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [vBSDCon]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • vBSDCon was held September 7 - 9th. We recorded this only a few days after getting home from this great event.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Things started on Wednesday night, as attendees of the thursday developer summit arrived and broke into smallish groups for disorganized dinner and drinks.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • We then held an unofficial hacker lounge in a medium sized seating area, working and talking until we all decided that the developer summit started awfully early tomorrow.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The developer summit started with a light breakfast and then then we dove right in
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Ed Maste started us off, and then Glen Barber gave a presentation about lessons learned from the 11.1-RELEASE cycle, and comparing it to previous releases. 11.1 was released on time, and was one of the best releases so far. The slides are linked on the DevSummit wiki page.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The group then jumped into hackmd.io a collaborative note taking application, and listed of various works in progress and upstreaming efforts. Then we listed wants and needs for the 12.0 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • After lunch we broke into pairs of working groups, with additional space for smaller meetings. The first pair were, ZFS and Toolchain, followed by a break and then a discussion of IFLIB and network drivers in general. After another break, the last groups of the day met, pkgbase and secure boot.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Then it was time for the vBSDCon reception dinner. This standing dinner was a great way to meet new people, and for attendees to mingle and socialize.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The official hacking lounge Thursday night was busy, and included some great storytelling, along with a bunch of work getting done.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • It was very encouraging to watch a struggling new developer getting help from a seasoned veteran. Watching the new developers eyes light up as the new information filled in gaps and they now understood so much more than just a few minutes before, and they raced off to continue working, was inspirational, and reminded me why these conferences are so important.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The hacker lounge shut down relatively early by BSD conference standards, but, the conference proper started at 8:45 sharp the next morning, so it made sense.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Friday saw a string of good presentations, I think my favourite was Jonathan Anderson’s talk on Oblivious sandboxing. Jonathan is a very energetic speaker, and was able to keep everyone focused even during relatively complicated explanations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Friday night I went for dinner at ‘Big Bowl’, a stir-fry bar, with a largish group of developers and users of both FreeBSD and OpenBSD. The discussions were interesting and varied, and the food was excellent. Benedict had dinner with JT and some other folks from iXsystems.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Friday night the hacker lounge was so large we took over a bigger room (it had better WiFi too).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Saturday featured more great talks. The talk I was most interested in was from Eric McCorkle, who did the EFI version of my GELIBoot work. I had reviewed some of the work, but it was interesting to hear the story of how it happened, and to see the parallels with my own story.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • My favourite speaker was Paul Vixie, who gave a very interesting talk about the gets() function in libc. gets() was declared unsafe before the FreeBSD project even started. The original import of the CSRG code into FreeBSD includes the compile time, and run-time warnings against using gets(). OpenBSD removed gets() in version 5.6, in 2014. Following Paul’s presentation, various patches were raised, to either cause use of gets() to crash the program, or to remove gets() entirely, causing such programs to fail to link.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • The last talk before the closing was Benedict’s BSD Systems Management with Ansible.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Shortly after, Allan won a MacBook Pro by correctly guessing the number of components in a jar that was standing next to the registration desk (Benedict was way off, but had a good laugh about the unlikely future Apple user).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Saturday night ended with the Conference Social, and excellent dinner with more great conversations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • On Sunday morning, a number of us went to the Smithsonian Air and Space Museum site near the airport, and saw a Concorde, an SR-71, and the space shuttle Discovery, among many other exhibits.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Check out the full photo album by JT, our producer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Thanks to all the sponsors for vBSDcon and all the organizers from Verisign, who made it such a great event.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The story behind FreeBSD-EN-17.08.pf
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • After our previous deep dive on a bug in episode 209, Kristof Provost, the maintainer of pf on FreeBSD (he is going to hate me for saying that) has written the story behind a recent ERRATA notice for FreeBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • First things first, so I have to point out that I think Allan misremembered things. The heroic debugging story is PR 219251, which I'll try to write about later.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                FreeBSD-EN-17:08.pf is an issue that affected some FreeBSD 11.x systems, where FreeBSD would panic at startup. There were no reports for CURRENT.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                There's very little to go on here, but we do know the cause of the panic ("integer divide fault"), and that the current process was "pf purge". The pf purge thread is part of the pf housekeeping infrastructure. It's a housekeeping kernel thread which cleans up things like old states and expired fragments.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The lack of mention of pf functions in the backtrace is a hint unto itself. It suggests that the error is probably directly in pf_purge_thread(). It might also be in one of the static functions it calls, because compilers often just inline those so they don't generate stack frames.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Remember that the problem is an "integer divide fault". How can integer divisions be a problem? Well, you can try to divide by zero. The most obvious suspect for this is this code:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                idx = pf_purge_expired_states(idx, pf_hashmask / (V_pf_default_rule.timeout[PFTM_INTERVAL] * 10));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                However, this variable is both correctly initialised (in pfattach_vnet()) and can only be modified through the DIOCSETTIMEOUT ioctl() call and that one checks for zero.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                At that point I had no idea how this could happen, but because the problem did not affect CURRENT I looked at the commit history and found this commit from Luiz Otavio O Souza:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Do not run the pf purge thread while the VNET variables are not initialized, this can cause a divide by zero (if the VNET initialization takes to long to complete).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Obtained from: pfSense
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Sponsored by: Rubicon Communications, LLC (Netgate)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                That sounds very familiar, and indeed, applying the patch fixed the problem. Luiz explained it well: it's possible to use V_pf_default_rule.timeout before it's initialised, which caused this panic.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                To me, this reaffirms the importance of writing good commit messages: because Luiz mentioned both the pf purge thread and the division by zero I was easily able to find the relevant commit. If I hadn't found it this fix would have taken a lot longer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Next week we’ll look at the more interesting story I was interested in, which I managed to nag Kristof into writing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The sudden death and eternal life of Solaris
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • A blog post from Bryan Cantrill about the death of Solaris
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • As had been rumored for a while, Oracle effectively killed Solaris. When I first saw this, I had assumed that this was merely a deep cut, but in talking to Solaris engineers still at Oracle, it is clearly much more than that. It is a cut so deep as to be fatal: the core Solaris engineering organization lost on the order of 90% of its people, including essentially all management.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Of note, among the engineers I have spoken with, I heard two things repeatedly: “this is the end” and (from those who managed to survive Friday) “I wish I had been laid off.” Gone is any of the optimism (however tepid) that I have heard over the years — and embarrassed apologies for Oracle’s behavior have been replaced with dismay about the clumsiness, ineptitude and callousness with which this final cut was handled. In particular, that employees who had given their careers to the company were told of their termination via a pre-recorded call — “robo-RIF’d” in the words of one employee — is both despicable and cowardly. To their credit, the engineers affected saw themselves as Sun to the end: they stayed to solve hard, interesting problems and out of allegiance to one another — not out of any loyalty to the broader Oracle. Oracle didn’t deserve them and now it doesn’t have them — they have been liberated, if in a depraved act of corporate violence.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Assuming that this is indeed the end of Solaris (and it certainly looks that way), it offers a time for reflection. Certainly, the demise of Solaris is at one level not surprising, but on the other hand, its very suddenness highlights the degree to which proprietary software can suffer by the vicissitudes of corporate capriciousness. Vulnerable to executive whims, shareholder demands, and a fickle public, organizations can simply change direction by fiat. And because — in the words of the late, great Roger Faulkner — “it is easier to destroy than to create,” these changes in direction can have lasting effect when they mean stopping (or even suspending!) work on a project. Indeed, any engineer in any domain with sufficient longevity will have one (or many!) stories of exciting projects being cancelled by foolhardy and myopic management. For software, though, these cancellations can be particularly gutting because (in the proprietary world, anyway) so many of the details of software are carefully hidden from the users of the product — and much of the innovation of a cancelled software project will likely die with the project, living only in the oral tradition of the engineers who knew it. Worse, in the long run — to paraphrase Keynes — proprietary software projects are all dead. However ubiquitous at their height, this lonely fate awaits all proprietary software.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    There is, of course, another way — and befitting its idiosyncratic life and death, Solaris shows us this path too: software can be open source. In stark contrast to proprietary software, open source does not — cannot, even — die. Yes, it can be disused or rusty or fusty, but as long as anyone is interested in it at all, it lives and breathes. Even should the interest wane to nothing, open source software survives still: its life as machine may be suspended, but it becomes as literature, waiting to be discovered by a future generation. That is, while proprietary software can die in an instant, open source software perpetually endures by its nature — and thrives by the strength of its communities. Just as the existence of proprietary software can be surprisingly brittle, open source communities can be crazily robust: they can survive neglect, derision, dissent — even sabotage.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    In this regard, I speak from experience: from when Solaris was open sourced in 2005, the OpenSolaris community survived all of these things. By the time Oracle bought Sun five years later in 2010, the community had decided that it needed true independence — illumos was born. And, it turns out, illumos was born at exactly the right moment: shortly after illumos was announced, Oracle — in what remains to me a singularly loathsome and cowardly act — silently re-proprietarized Solaris on August 13, 2010. We in illumos were indisputably on our own, and while many outsiders gave us no chance of survival, we ourselves had reason for confidence: after all, open source communities are robust because they are often united not only by circumstance, but by values, and in our case, we as a community never lost our belief in ZFS, Zones, DTrace and myriad other technologies like MDB, FMA and Crossbow.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Indeed, since 2010, illumos has thrived; illumos is not only the repository of record for technologies that have become cross-platform like OpenZFS, but we have also advanced our core technologies considerably, while still maintaining highest standards of quality. Learning some of the mistakes of OpenSolaris, we have a model that allows for downstream innovation, experimentation and differentiation. For example, Joyent’s SmartOS has always been focused on our need for a cloud hypervisor (causing us to develop big features like hardware virtualization and Linux binary compatibility), and it is now at the heart of a massive buildout for Samsung (who acquired Joyent a little over a year ago). For us at Joyent, the Solaris/illumos/SmartOS saga has been formative in that we have seen both the ill effects of proprietary software and the amazing resilience of open source software — and it very much informed our decision to open source our entire stack in 2014.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Judging merely by its tombstone, the life of Solaris can be viewed as tragic: born out of wedlock between Sun and AT&T and dying at the hands of a remorseless corporate sociopath a quarter century later. And even that may be overstating its longevity: Solaris may not have been truly born until it was made open source, and — certainly to me, anyway — it died the moment it was again made proprietary. But in that shorter life, Solaris achieved the singular: immortality for its revolutionary technologies. So while we can mourn the loss of the proprietary embodiment of Solaris (and we can certainly lament the coarse way in which its technologists were treated!), we can rejoice in the eternal life of its technologies — in illumos and beyond!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    News Roundup
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    OpenBSD on the Lenovo Thinkpad X1 Carbon (5th Gen)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Joshua Stein writes about his experiences running OpenBSD on the 5th generation Lenovo Thinkpad X1 Carbon:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • ThinkPads have sort of a cult following among OpenBSD developers and users because the hardware is basic and well supported, and the keyboards are great to type on. While no stranger to ThinkPads myself, most of my OpenBSD laptops in recent years have been from various vendors with brand new hardware components that OpenBSD does not yet support. As satisfying as it is to write new kernel drivers or extend existing ones to make that hardware work, it usually leaves me with a laptop that doesn't work very well for a period of months.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      After exhausting efforts trying to debug the I2C touchpad interrupts on the Huawei MateBook X (and other 100-Series Intel chipset laptops), I decided to take a break and use something with better OpenBSD support out of the box: the fifth generation Lenovo ThinkPad X1 Carbon.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Hardware
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Like most ThinkPads, the X1 Carbon is available in a myriad of different internal configurations. I went with the non-vPro Core i7-7500U (it was the same price as the Core i5 that I normally opt for), 16Gb of RAM, a 256Gb NVMe SSD, and a WQHD display.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This generation of X1 Carbon finally brings a thinner screen bezel, allowing the entire footprint of the laptop to be smaller which is welcome on something with a 14" screen. The X1 now measures 12.7" wide, 8.5" deep, and 0.6" thick, and weighs just 2.6 pounds. While not available at initial launch, Lenovo is now offering a WQHD IPS screen option giving a resolution of 2560x1440. Perhaps more importantly, this display also has much better brightness than the FHD version, something ThinkPads have always struggled with.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        On the left side of the laptop are two USB-C ports, a USB-A port, a full-size HDMI port, and a port for the ethernet dongle which, despite some reviews stating otherwise, is not included with the laptop. On the right side is another USB-A port and a headphone jack, along with a fan exhaust grille. On the back is a tray for the micro-SIM card for the optional WWAN device, which also covers the Realtek microSD card reader. The tray requires a paperclip to eject which makes it inconvenient to remove, so I think this microSD card slot is designed to house a card semi-permanently as a backup disk or something.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        On the bottom are the two speakers towards the front and an exhaust grille near the center. The four rubber feet are rather plastic feeling, which allows the laptop to slide around on a desk a bit too much for my liking. I wish they were a bit softer to be stickier.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Charging can be done via either of the two USB-C ports on the left, though I wish more vendors would do as Google did on the Chromebook Pixel and provide a port on both sides. This makes it much more convenient to charge when not at one's desk, rather than having to route a cable around to one specific side. The X1 Carbon includes a 65W USB-C PD with a fixed USB-C cable and removable country-specific power cable, which is not very convenient due to its large footprint. I am using an Apple 61W USB-C charger and an Anker cable which charge the X1 fine (unlike HP laptops which only work with HP USB-C chargers).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Wireless connectivity is provided by a removable Intel 8265 802.11a/b/g/n/ac WiFi and Bluetooth 4.1 card. An Intel I219-V chip provides ethernet connectivity and requires an external dongle for the physical cable connection.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The screen hinge is rather tight, making it difficult to open with one hand. The tradeoff is that the screen does not wobble in the least bit when typing.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The fan is silent at idle, and there is no coil whine even under heavy load. During a make -j4 build, the fan noise is reasonable and medium-pitched, rather than a high-pitched whine like on some laptops. The palm rest and keyboard area remain cool during high CPU utilization.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The full-sized keyboard is backlit and offers two levels of adjustment. The keys have a soft surface and a somewhat clicky feel, providing very quiet typing except for certain keys like Enter, Backspace, and Escape. The keyboard has a reported key travel of 1.5mm and there are dedicated Page Up and Page Down keys above the Left and Right arrow keys. Dedicated Home, End, Insert, and Delete keys are along the top row. The Fn key is placed to the left of Control, which some people hate (although Lenovo does provide a BIOS option to swap it), but it's in the same position on Apple keyboards so I'm used to it. However, since there are dedicated Page Up, Page Down, Home, and End keys, I don't really have a use for the Fn key anyway.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Firmware
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • The X1 Carbon has a very detailed BIOS/firmware menu which can be entered with the F1 key at boot. F12 can be used to temporarily select a different boot device.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          A neat feature of the Lenovo BIOS is that it supports showing a custom boot logo instead of the big red Lenovo logo. From Windows, download the latest BIOS Update Utility for the X1 Carbon (my model was 20HR). Run it and it'll extract everything to C:\drivers\flash(some random string). Drop a logo.gif file in that directory and run winuptp.exe. If a logo file is present, it'll ask whether to use it and then write the new BIOS to its staging area, then reboot to actually flash it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • OpenBSD support
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Secure Boot has to be disabled in the BIOS menu, and the "CSM Support" option must be enabled, even when "UEFI/Legacy Boot" is left on "UEFI Only". Otherwise the screen will just go black after the OpenBSD kernel loads into memory.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Based on this component list, it seems like everything but the fingerprint sensor works fine on OpenBSD.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Configuring 5 different desktop environments on FreeBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • This fairly quick tutorial over at LinuxSecrets.com is a great start if you are new to FreeBSD, especially if you are coming from Linux and miss your favourite desktop environment
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • It just goes to show how easy it is to build the desktop you want on modern FreeBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • The tutorial covers: GNOME, KDE, Xfce, Mate, and Cinnamon
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • The instructions for each boil down to some variation of:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Install the desktop environment and a login manager if it is not included:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • > sudo pkg install gnome3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Enable the login manager, and usually dbus and hald:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • > sudo sysrc dbus_enable="YES" hald_enable="YES" gdm_enable="YES" gnome_enable="YES"?
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • If using a generic login manager, add the DE startup command to your .xinitrc:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • > echo "exec cinnamon" > ~/.xinitrc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • And that is about it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • The tutorial goes into more detail on other configuration you can do to get your desktop just the way you like it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • To install Lumina:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • > sudo pkg install lumina pcbsd-utils-qt5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • This will install Lumina and the pcbsd utilities package which includes pcdm, the login manager. In the near future we hear the login manager and some of the other utilities will be split into separate packages, making it easier to use them on vanilla FreeBSD.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • > sudo sysrc pcdm_enable=”YES” dbus_enable="YES" hald_enable="YES"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Reboot, and you should be greeted with the graphical login screen
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                A return-oriented programming defense from OpenBSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • We talked a bit about RETGUARD last week, presenting Theo’s email announcing the new feature
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Linux Weekly News has a nice breakdown on just how it works
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Stack-smashing attacks have a long history; they featured, for example, as a core part of the Morris worm back in 1988. Restrictions on executing code on the stack have, to a great extent, put an end to such simple attacks, but that does not mean that stack-smashing attacks are no longer a threat. Return-oriented programming (ROP) has become a common technique for compromising systems via a stack-smashing vulnerability. There are various schemes out there for defeating ROP attacks, but a mechanism called "RETGUARD" that is being implemented in OpenBSD is notable for its relative simplicity.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  In a classic stack-smashing attack, the attack code would be written directly to the stack and executed there. Most modern systems do not allow execution of on-stack code, though, so this kind of attack will be ineffective. The stack does affect code execution, though, in that the call chain is stored there; when a function executes a "return" instruction, the address to return to is taken from the stack. An attacker who can overwrite the stack can, thus, force a function to "return" to an arbitrary location.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  That alone can be enough to carry out some types of attacks, but ROP adds another level of sophistication. A search through a body of binary code will turn up a great many short sequences of instructions ending in a return instruction. These sequences are termed "gadgets"; a large program contains enough gadgets to carry out almost any desired task — if they can be strung together into a chain. ROP works by locating these gadgets, then building a series of stack frames so that each gadget "returns" to the next.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  There is, of course, a significant limitation here: a ROP chain made up of exclusively polymorphic gadgets will still work, since those gadgets were not (intentionally) created by the compiler and do not contain the return-address-mangling code. De Raadt acknowledged this limitation, but said: "we believe once standard-RET is solved those concerns become easier to address separately in the future. In any case a substantial reduction of gadgets is powerful".
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Using the compiler to insert the hardening code greatly eases the task of applying RETGUARD to both the OpenBSD kernel and its user-space code. At least, that is true for code written in a high-level language. Any code written in assembly must be changed by hand, though, which is a fair amount of work. De Raadt and company have done that work; he reports that: "We are at the point where userland and base are fully working without regressions, and the remaining impacts are in a few larger ports which directly access the return address (for a variety of reasons)". It can be expected that, once these final issues are dealt with, OpenBSD will ship with this hardening enabled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • The article wonders about applying the same to Linux, but notes it would be difficult because the Linux kernel cannot currently be compiled using LLVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • If any benchmarks have been run to determine the cost of using RETGUARD, they have not been publicly posted. The extra code will make the kernel a little bigger, and the extra overhead on every function is likely to add up in the end. But if this technique can make the kernel that much harder to exploit, it may well justify the extra execution overhead that it brings with it. All that's needed is somebody to actually do the work and try it out.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Videos from BSDCan have started to appear!
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Henning Brauer: tcp synfloods - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Benno Rice: The Trouble with FreeBSD - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Li-Wen Hsu: Continuous Integration of The FreeBSD Project - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Andrew Turner: GENERIC ARM - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Bjoern A. Zeeb: From the outside - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Rodney W. Grimes: FreeBSD as a Service - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Reyk Floeter: The OpenBSD virtual machine daemon - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Brian Kidney: The Realities of DTrace on FreeBSD - BSDCan 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • The rest will continue to trickle out, likely not until after EuroBSDCon
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Beastie Bits
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Oracle has killed sun
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Configure Thunderbird to send patch friendly
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • FreeBSD 10.4-BETA4 Available
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • iXsystems looking to hire kernel and zfs developers (especially Sun/Oracle Refugees)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Speaking of job postings, UnitedBSD.com has few job postings related to BSD
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Call for papers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • USENIX FAST ‘18 - February 12-15, 2018, Due: September 28 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Scale 16x - March 8-11, 2018, Due: October 31, 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • FOSDEM ‘18 - February 3-4, 2018, Due: November 3 2017
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feedback/Questions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Jason asks about cheap router hardware
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Prashant asks about latest kernels with freebsd-update
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Matt wants know about VM Performance & CPU Steal Time
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • John has config questions regarding Dell precision 7720, FreeBSD, NVME, and ZFS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • ***
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1 hr 41 min