LWN.net Weekly Edition for August 13, 2015
GNOME and the future of hardware enablement
At GUADEC 2015 in Gothenburg, Sweden, Bastien Nocera related his recent personal experience getting Linux running on a cheap Windows tablet. Along the way, he challenged the GNOME project with a vision for how working with new hardware devices could go, a few GNOME releases down the line. The goal he described is one in which developing software for an arbitrary new hardware device is as simple with a GNOME desktop as it is for Android developers already.
The first half of Nocera's talk was presented as a case study of how he got Linux and GNOME to run on a generic hardware device. At the end, however, he backed up and retold the sequence of events as they had "really happened" (which was somewhat less successful). But the more optimistic version of events, he argued, was entirely within reach—if a few changes can be made to GNOME.
The hardware tale started when Nocera bought an inexpensive "iPad knock-off" tablet built by a Chinese manufacturer and decided to install GNOME in place of Windows 8, which came pre-installed. The biggest hurdle was getting the WiFi driver to work. The tablet used a Realtek chip and he was able to get a "code drop" driver from the company—but that driver was in remarkably poor shape.
It probably worked on Android, he said, but it did not with a mainline kernel. Digging into the source, he found that it was filled with useless code: tests, code targeting numerous pre-production hardware revisions, and so on. Since the WiFi module was connected to the motherboard over USB internally, the driver included all sorts of generic USB code that was unneeded for the tablet. Eventually, he and a few other hackers cut out all of the excess code—reducing the size of the driver by a factor of 20.
They then proceeded to figure out how to patch it to work on a current, standard kernel. That effort took time, but it worked in the end and he posted the driver on GitHub and began looking at what else the tablet required. He next got USB On The Go (USB OTG) running on the device's USB controller, and connected the tablet to his computer with a USB cable. That allowed him to use the Android Debug Bridge (adb) tool to catch system hangs early on in the boot process. He patched the adb daemon (adbd) to run on glibc and systemd (rather than Android's C library and init system) and posted that work on GitHub as well.
From there—he said—he set out to get EFI mixed mode working on the tablet's motherboard, so that he could boot a 64-bit kernel. After that, he replaced the tablet's bootloader with GRUB, set up Secure Boot shim, and ran the Fedora installer to install a complete, 64-bit Linux operating system. The adb tool allows developers to sideload packages onto the tablet, so, with a GNOME-supporting adbd on the device, developers could create xdg-app application bundles using GNOME Builder on their machine and upload them over the USB cable to the tablet and test them immediately. There would be no need to run emulators, simulate touchscreen and gesture events, or employ other such workarounds that are common today.
As Nocera quickly revealed, however, the last half of that story has not actually happened—at least, not yet. He has successfully gotten the WiFi driver running—with valuable help from Larry Finger. And the work on adbd and EFI mixed mode is real—although not all of the patches are ready for upstream.
The vision his story describes is what he hopes to see GNOME capable of in the near-term future, though, and that is what he most wanted to discuss. The pieces are falling into place: xdg-app is capable of producing "install anywhere" packages that, like Android .apk files, a developer could install and test with ease. Builder could make generating xdg-app packages part of its default feature set, and it could be made to integrate with adb.
There are other challenges as well, he said, some of which are not entirely in GNOME's hands. Windows 8 does not support USB OTG, for example, so even if the system-on-chip used in the tablet you buy supports USB OTG, the manufacturer may not have wired it up on the motherboard. One alternative would be USB host-to-host cables; they are cheap, but they will require some work to get running reliably on Linux desktops. Inside the connectors, most of them use cheap USB network adapters, and place a miniature Ethernet hub somewhere in between, so supporting them requires writing the appropriate device drivers.
A potentially bigger challenge is that EFI mixed mode support is not ready yet. In practice, at least, one can usually boot a 64-bit operating system on 32-bit EFI, but frequently things start to break when 64-bit drivers try to access EFI shortly after boot. Nocera also acknowledged that "cheap devices" change rather frequently, so keeping up with whatever is currently manufactured in China can be difficult. But in general, he said, if it can run a slightly older version of Windows, it can run a modern Linux distribution, too.
Nocera ended his session by declaring: "No refunds. I'm very sorry that I lied to you in the first part of the talk. We still need to do a lot of work." But, he added, developing support for the kind of plug-and-play development that he described is important for GNOME's outreach. Mobile devices are here to stay, and Android has a compelling "developer story" wherein anyone can hook up a USB cable and start writing software that they can test and run on a tablet or phone. GNOME could offer the same experience, if it sets out to do so.
[The author would like to thank the GNOME Foundation for travel assistance to attend GUADEC 2015.]
Lessons from the GNOME-Groupon trademark battle
At GUADEC 2015 in Gothenburg, Sweden, Pamela Chestek delivered a keynote presentation that provided insight into one of the biggest stories of the past year for the GNOME project: the trademark battle between the GNOME Foundation and the web service Groupon. While the fight was concluded months ago—in GNOME's favor—she pointed out several lessons learned along the way that she thinks can be instructive for other free-software projects.
Chestek began by introducing herself and briefly describing her history with open-source software. She is a US-based attorney who worked for several years in various other corporate environments before entering the technology field. After some time working at proprietary software vendors she landed at Red Hat, at which point, she said, it took about a year to get truly familiar with the distinct differences inherent in open source.
The Groupon case was a major news event in the free-software arena, but its full history may not be familiar to all. Chestek's involvement began on May 22, 2014, when GNOME Foundation Executive Director Karen Sandler sent her an email noting that Groupon had filed for a trademark on "GNOME" for a recently announced point-of-sale tablet product—and asking if she "had any interest in helping the GNOME Foundation out." Looking into it, Chestek found that Groupon had actually filed 10 trademark applications for variations on the "GNOME" name. The product in question was really an iPad in a custom frame, designed to be a competitor to Square's point-of-sale consoles.
Since "GNOME" is a registered trademark in the technology business, Groupon's applications were clearly infringing, Chestek explained. On May 23, Chestek sent a politely worded email to Groupon's attorneys that said, in part, that she was "willing to assume that somehow your company was unaware of the GNOME Foundation's trademark" ... despite the years of continuous usage, millions of installs, multiple active social-media accounts, Wikipedia and press coverage, and so forth. That got a laugh from the audience but, she added, she has no doubt that Groupon was well aware of the GNOME Foundation's trademark when it filed its own—and probably saw that the Foundation was a nonprofit or that GNOME was a "niche" project and assumed it could get away with ignoring the matter.
Groupon's attorneys replied that they felt there was no chance that the two marks would be confusing to consumers, since its product was intended to be pronounced "Gee-nome." That claim meant nothing, Chestek said; the courts would clearly assume the dictionary pronunciation was the default for both marks—and, besides, many people do pronounce GNOME with an emphasis on the "G" due to its association with GNU. In the meantime, Groupon kept filing additional trademark applications. Chestek exchanged multiple letters and phone calls with Groupon's attorneys but, she pointed out, at no point did Groupon offer to drop its applications or change the name of its product.
By late July, the original ten applications had moved into the US Patent and Trademark Office (USPTO)'s "opposition" phase, which meant that they could be formally challenged in a legal proceeding. Sandler raised the possibility of going public with the conflict, which would let Groupon see that—despite what it might have assumed—GNOME was a large and popular product. Also, that would let the Foundation begin to raise money to mount the trademark oppositions: roughly $80,000 would be needed to challenge the original ten applications (although Groupon had continued to file for even more).
Matters came to a head that November. At 8:00p.m. on October 31, Chestek got a call from Groupon's lawyer (an outside attorney, as always, she added; no one inside the company ever responded), who told her that Groupon had filed for several more GNOME-related trademarks "without notifying us," bringing the total to 28. She got copies of the filings a few days later, and on November 9, told the GNOME board that she "was sorry to say that I think it's time to raise money" for a legal fight. She had previously warned Groupon's lawyer that "we haven't gone public yet, and you're not going to like what happens when we do"—which elicited a scoff. What followed, she said, was a testimony to the power of community, and the GNOME and free-software community deserves the credit.
Board member Sriram Ramkrishnan replied to Chestek's email about fundraising with a memorable "Well then: here we go..." and wrote a blog post [Wayback Machine link] explaining the situation. It went live on November 10, accompanied by a tweet; the board prepared to do follow-up work to try and raise awareness and gather donations. Instead, "people just went crazy"—recirculating the story on Twitter, Google+, news outlets, and discussion forums. They called Groupon to complain, many people blogged, and the Freenode IRC network even broadcast a system-wide message alerting users of the service and pointing them to the fundraiser on the GNOME site. Needless to say, none of the public was taking Groupon's side.
By sheer coincidence, Groupon had an investors' meeting on November 11 that highlighted its "GNOME" product, which is amusing in retrospect. But one of the most negative parts of the story also took place on November 11, when an engineer from the Groupon technical blog posted a story presenting Groupon's side, which claimed that Groupon had been "communicating with the GNOME Foundation for months" trying to find an amicable resolution, and that would be happy to find an alternative name. None of those statements were true at all, Chestek said, and worse yet, the claims damaged GNOME by making it look like the aggressor. The Groupon post got picked up by a number of general news outlets.
But less than 24 hours later, two things had changed. The GNOME Foundation fundraiser had already met its $80,000 goal, and the overwhelming public pressure forced Groupon to back down. The company's blog was updated to reflect this, announcing that it was dropping all 28 trademark applications. In terms of success, Chestek said, the fastest relief that they could have hoped for by challenging the marks in the USPTO opposition process would have been 21 months—and that would only have challenged the registrations; it would not have prevented Groupon from using the marks.
Lessons
Ultimately, the free-software community raised over $102,000 for the effort with donations from more than 5,600 people. "I don't know of any other similar effort orchestrated like that," she said. Who else, she asked, would respond in such a way? People only do that for things they are genuinely passionate about. They feel an attachment to a brand, but no one would come to Apple's defense in the way that they came to GNOME's defense. That was the first lesson from the experience.
Although the trademarks were dropped (the Groupon tablet eventually hit the market without a name at all, she noted—"although you always worry, so I've kept an eye on it"), the tale was not yet finished. Chestek continued to seek action from Groupon to rectify the damage it had caused to GNOME's reputation with the blatantly false blog post. That took a lot of iterations, she said, but the company eventually agreed to put out an update to the offending blog post acknowledging that it had, in fact, been notified about the trademark issue by GNOME and apologizing for the misleading statements.
Getting that apology published was indicative of the second major lesson, she said: commercial companies simply don't know what to do with free-software principles. Groupon had wanted to conclude the deal with a sealed agreement that no one would be allowed to discuss in public, since that is the normal process in big business. Chestek had to explain to them that putting a gag order on thousands of individuals worldwide simply wasn't possible—and that it went contrary to GNOME's principles of transparency.
The final lesson was that GNOME is a powerful brand, even within the free-software movement, she said. "I'm not sure how many other projects could engender that kind of passionate response," she said, but it is few, and the project deserves credit for having built something so many people were motivated to come to the defense of.
Chestek took questions from the audience at the end. One audience member asked if any legal action should be brought about the misleading Groupon blog post. She said no, noting that it was in all likelihood someone inside the company who had imperfect, filtered information about the case, and who felt called to come to the company's defense.
Someone else asked why the GNOME Foundation board remained silent about the details of the case for so long. Chestek said that the board agreed to "not go out on the speaking circuit" about the issue because it had no desire to cause long-term business harm to Groupon, who had eventually settled the issue. The board agreed to post an update on the GNOME web site and point people to it, but to otherwise "try to let the issue fizzle out" on its own. It is a delicate balance to strike, she said.
Most of the questions, though, were about what other software projects can do to protect themselves from similar trademark infringement. By far the most important thing, Chestek said, is to register trademarks used by your project. "Part of my mission is to encourage projects to register as many trademarks as they can in as many jurisdictions as they can," she said. Too many developers fail to do so, thinking they will take care of it later, or underestimating the time that it will require. For that reason, she also encouraged developers to set up a formal relationship with a larger project (like GNOME), which can help with legal issues, or to consider joining an umbrella organization like the Software Freedom Conservancy.
But trademark registration can be complicated and, in some cases, expensive. The US is a particularly good jurisdiction for trademarks, she said. The EU is also vital for most free-software projects, but beyond that it can be hard to say how many jurisdictions one should register in. Furthermore, the sad reality is that trademark disagreements, like most areas of the law, often come down to who has the time and money to put up a fight—if indeed it comes to a fight. Unfortunately, not even the GNOME Foundation's successful challenge to Groupon can really do much (such as providing any legal precedents) to prevent similar attacks in the future. But it does illustrate that, despite what anyone might say, a trademark in a free-software project is just as strong as a trademark in a commercial company.
At the end of the session, longtime GNOME veteran Federico Mena-Quintero presented Chestek with a gift on behalf of the project: a handmade wooden plaque inlaid with the GNOME logo. That presentation was, of course, accompanied by a long round of applause from the attendees also expressing their individual gratitude to Chestek.
[The author would like to thank the GNOME Foundation for travel assistance to attend GUADEC 2015.]
Git + FUSE + Python = GitFS
Typically, filesystems are developed in C, often as part of a kernel like Linux. But the folks at Presslabs took an unconventional approach by developing a filesystem based on Git as a user-space filesystem written in Python. Vlad Temian and Manu Danci, who both work for the company, came to EuroPython 2015 in Bilbao, Spain to talk about that filesystem, which is called GitFS.
Presslabs is a Romanian WordPress hosting site with as many as 2.2 billion monthly page views. One of the problems its customers have encountered, though, is conflicts between site publishers (i.e. site owners) and their developers. Publishers will try to change the code that developers have written, but many don't have the knowledge required, so the site becomes broken. Nobody knows who did what to the code base, which results in a "big pile of chaos", Danci said.
So Presslabs came up with the idea of a self-versioning filesystem that uses Git behind the curtains. But in order to be user-friendly, GitFS turns the Git version tree into something more accessible using the timestamp of each commit. The mount point has two directories: current, which contains the latest snapshot, and history, which contains directories of other snapshots based on the date and time of the commit:
mnt/history/
2015-08-09/
14-32-12-eb18db93bc9/
14-37-39-e256395058f/
16-03-23-25b39c058fe/
2015-08-10/
11-17-48-ef1fdf9fbff/
...
Users can read and write to files in the current directory, but
the history directories are all read-only. The idea is to
"humanize" the contents of the .git directory.
Mounting the filesystems is done with the gitfs command, as Temian and Danci demonstrated live. The command requires the remote repository and a mount point; there are also options that can be specified for timeouts and other parameters. When someone makes a change to the repository (e.g. a developer commits changes), GitFS updates the current directory and adds a new entry into history in the mounted filesystem. Similarly, when someone makes a change in current, a commit is generated after a specified timeout occurs (to try to package up multiple changes into a single commit).
The filesystem is written entirely in Python and has been released under the Apache 2.0 license. There is more that could be done with GitFS, Danci said. He suggested that anyone interested contribute to the project so that "maybe we can grow it further".
As part of the research that eventually led to GitFS, the team came up with some requirements. There were two main hurdles to overcome. The first was how to handle Git objects efficiently, both in terms of speed and memory usage. The other was to be able to implement the filesystem operations in an efficient manner.
Python-based solutions were found for parts of the problem. GitFS uses pygit2 for its Git bindings. Pygit2 is written in C, so it uses Git's C API and doesn't waste time using the shell to access Git commands. GitFS also uses fusepy for access to the Filesystem in Userspace (FUSE) API.
Temian then took over to describe some of the architecture for GitFS. The main concept in the filesystem is that of a "view". There are several types of view, depending on what kind of object is being accessed. For example, an open() call goes to a router that chooses between the view types: CurrentView, HistoryView, CommitView, or IndexView. There are also some higher-level view classes, including PassthroughView (used for current) and ReadOnlyView (which is the parent of the history views).
Eventually there will be conflicts that need to be resolved between different versions of the files. GitFS has a adopted a simple strategy called "always accept mine" that is safest for Presslabs's customers. It effectively takes the local changes and applies them on top of any changes to the remote repository. That strategy is not implemented in pygit2, so it was added as a plugin. Others can write their own strategy to be used with the filesystem.
One of the first problems encountered with GitFS was its performance on real-world repositories. As a test, the WordPress repository with some 17,000 commits was used, but it took 34 minutes to do a directory listing on history. Some profiling led to the addition of three levels of caching. After that, the directory listing completed in around three seconds.
If you unzip 1000 files, you don't want to do 1000 commits for them, Temian said, so a smarter mechanism for upstream synchronization is needed. That led to some additional components in GitFS: FUSE threads, a commit queue, sync worker, and fetch worker. The FUSE threads are not directly under the control of GitFS — FUSE determines how many there are, for example. Those threads add commit jobs to a commit queue when they have completed writing a file.
That commit queue is consumed by the "sync worker" process, which batches up the changes based on the sync timeout that has been specified for the filesystem. When it is making a commit, it locks out any other writes to the filesystem by notifying the FUSE threads, waits for completion of the merge and push, then unlocks the filesystem. There is also the "fetch worker" that periodically (also dependent on a timeout) checks for changes on the remote repository. It is also told to pause during sync operations.
Danci then took back the microphone for some concluding remarks. First off, there is an Ubuntu personal package archive for GitFS that is maintained by Presslabs, as well as community-maintained versions for Fedora and Arch Linux. There is also a version available for Mac OS X.
There are a number of things that attendees should take away from the talk, Danci said. You can build a production filesystem in Python. Presslabs did it and has been using it in production for almost a year now. People suggested doing it in C, but the team preferred Python and it is working well.
Building a FUSE-based filesystem is straightforward, he said, but getting it right can be challenging. The current model was not the first the team came up with. It took a number of refinements to get to where it is today. His final point was that by combining appropriate technology, you can "put powerful tools in the hands of non-technical users". The main purpose of GitFS is to make people's lives easier by putting Git in the hands of regular users.
No LWN Weekly Edition next week
The week of August 17 is just a little bit busy. The schedule includes LinuxCon, the Linux Plumbers Conference, DebConf, the Linux Security Summit, and more. For added fun, two LWN staff members are (lightly) involved in the planning for Plumbers, and we will have staff out of the office for non-conference reasons. All of that will make it rather more difficult than usual to get a weekly edition out the door.So, we're not going to do it. There will be a steady stream of content over the week, and an extra-thick edition the week following, but the August 20 edition will not be published. We apologize for the slowdown, but we're looking forward to meeting many of you at conferences worldwide next week. Thanks to all of you, as always, for supporting LWN.
Security
Proprietary vulnerabilities
A recent—and recently deleted—blog post (still available courtesy of the Wayback Machine) demonstrates some rather eye-opening opinions on how some view their customers' efforts to find and report security holes. In the almost comically inept post, Oracle's Chief Security Officer Mary Ann Davidson admonishes customers not to try to "reverse engineer" Oracle's code to find security bugs. It is an attitude that is perhaps common in the proprietary world, but is diametrically opposed to standard practice in free-software communities.
The crux of Davidson's complaint is about customers that disregard Oracle's licensing terms and run various kinds of analysis tools against the sacred binaries. That leads to reports of vulnerabilities, most of which are likely false positives, she said. Oracle evidently tries to make it difficult for customers to report these kinds of bugs by requiring separate service requests for each issue, along with a proof-of-concept attack to document it.
It is unquestionably true that there are lots of false positives from these kinds of tools, so it is not surprising or unreasonable that Oracle might be unwilling to just take a raw report. But the company evidently goes further than that:
Davidson's tone throughout the post is dismissive and condescending, which
doesn't
help. She
suggests that customers should essentially just trust Oracle to ensure
the security of the software it ships. After all, Oracle and other large
organizations have assurance programs and certifications that provide
"Good Housekeeping seals
" to show that they have "good
code
". Exactly how certifications such as Common Criteria and FIPS-140
ensure that good code is left as an exercise for the reader (and the Oracle
customer).
Evidently there has been an upswing in the number of these kinds of reports recently, which is why Davidson wanted to address the issue. She noted that third parties cannot actually analyze the source code, so it is largely a waste of time for customers to look for these kinds of problems:
She continued with something of a non-lawyer FAQ about Oracle's license agreement and the evils of reverse engineering its code. It makes it clear that Oracle is actively hostile to its customers (or anyone else) finding bugs in its code if they have to resort to reverse engineering (which is rather loosely defined). The final question does acknowledge that others with "bad motives" may be ignoring the license agreement and doing pretty much any kind of analysis they want—probably without sharing the results with the company. To Davidson, though, the existence of these "cheaters" does not make it any more reasonable for those with "good motives" to follow suit.
No matter what the reason or the outcome—even if real bugs are found—reverse engineering is bad, mmmkay?
It would seem that Davidson went a bit too far, since the blog post was
pulled a day or so after it was posted on August 10. Ars Technica reported
that Oracle Executive Vice President and Chief Corporate Architect Edward
Screven made an email statement about the removal: "We removed the
post as it does not reflect our beliefs or our relationship with our
customers.
" As that article notes, the statement is missing some
important information: "Just how Oracle's chief security officer fell
out of alignment with Oracle's core beliefs and managed to spread her
heretic thoughts on customers was not addressed.
"
There are other posts by Davidson on her blog that have not been removed and show similar attitudes, so the post in question hardly comes completely out of left field. This particular piece may have just been over the top—or perhaps it simply had a much higher profile than the others. The company may not have liked how it came off looking based on that post, but it can't really complain too much, since much of what she said is certainly true.
In fact, as free-software users know, proprietary licenses restrict a whole raft of activities that are useful for security—or simply to add unanticipated features. Looking inside the code, running static and dynamic analysis, and finding bugs therein is all part of the "value proposition" for free software. Davidson actually makes the case—presumably unintentionally—for using free software rather than some proprietary tool. There is very little that a bad actor can do to a free-software package that those with good intentions can't also do—legally, and without worrying about a visit from Oracle's (or anyone else's) lawyers.
Some free-software projects even pro-actively invite security researchers to scrutinize their code—or even to reverse engineer it. In addition, while the number of false positives is quite high, there have been plenty of bugs found and fixed in open-source projects using tools like Coverity Scan. It would seem that even companies that want to strongly defend their code copyrights might be interested in any bugs that are found, regardless of the methods used to find them. Some companies do seem to have that attitude, which is generally shared by free-software projects, but some, like Oracle seemingly, are willing to throw the baby out with the bathwater.
Brief items
Security quotes of the week
Thank goodness the producers of the various films named "She" over the years didn't try this stunt. Or how about a [movie] titled "The" for real chuckles?
The impact of such takedown abuse is indeed the Internet equivalent of saturation bombing -- with no consideration given to the innocent parties who will be affected, and in the case of the DMCA, then have to find the time and money to fight back against this abuse -- simply to get their videos back on the Net.
For most of human history, surveillance has been expensive. Over the last couple of decades, it has become incredibly cheap and almost ubiquitous. That a few bits and pieces are becoming expensive again isn't a cause for alarm.
Privacy Badger 1.0
The Electronic Frontier Foundation has announced the 1.0 release of the Privacy Badger browser extension. "As you browse the Web, Privacy Badger looks at any third party domains that are loaded on a given site and determines whether or not they appear to be tracking you (e.g. by setting cookies that could be used for tracking, or fingerprinting your browser). If the same third party domain appears to be tracking you on three or more different websites, Privacy Badger will conclude that the third party domain is a tracker and block future connections to it." The extension is distributed under GPLv3; see this page for more information.
An active Firefox exploit
Mozilla has posted a warning about a Firefox vulnerability that is currently being actively exploited on the net. "The vulnerability comes from the interaction of the mechanism that enforces JavaScript context separation (the 'same origin policy') and Firefox’s PDF Viewer. Mozilla products that don’t contain the PDF Viewer, such as Firefox for Android, are not vulnerable. The vulnerability does not enable the execution of arbitrary code but the exploit was able to inject a JavaScript payload into the local file context. This allowed it to search for and upload potentially sensitive local files." There is a security update for the problem.
New vulnerabilities
activemq: denial of service
| Package(s): | activemq | CVE #(s): | CVE-2014-3576 CVE-2014-3612 CVE-2014-3600 | ||||
| Created: | August 10, 2015 | Updated: | August 12, 2015 | ||||
| Description: | From the Debian advisory:
It was discovered that the Apache ActiveMQ message broker is susceptible to denial of service through an undocumented, remote shutdown command. | ||||||
| Alerts: |
| ||||||
community-mysql: unspecified vulnerabilities
| Package(s): | community-mysql | CVE #(s): | |||||||||
| Created: | August 10, 2015 | Updated: | August 12, 2015 | ||||||||
| Description: | Latest upstream release, 5.6.25, fixes unspecified vulnerabilities. | ||||||||||
| Alerts: |
| ||||||||||
devscripts: two vulnerabilities
| Package(s): | devscripts | CVE #(s): | CVE-2015-5705 CVE-2015-5704 | ||||||||
| Created: | August 12, 2015 | Updated: | August 12, 2015 | ||||||||
| Description: | From the Red Hat bugzilla:
1249635 (CVE-2015-5704): In scripts/licensecheck.pl, there is executed code, that is vulnerable to shell command injection via shell metacharacters in filename. my $mime = `file --brief --mime --dereference $file`; 1249645 (CVE-2015-5705): In scripts/licensecheck.pl, there is code segment vulnerable to argument injection. my $mime = `file --brief --mime --dereference $file`; | ||||||||||
| Alerts: |
| ||||||||||
drupal6-cck: unspecified vulnerability
| Package(s): | drupal6-cck | CVE #(s): | |||||||||
| Created: | August 7, 2015 | Updated: | August 12, 2015 | ||||||||
| Description: | Version drupal7-feeds-2.0-alpha9 fixes unspecified vulnerabilities. | ||||||||||
| Alerts: |
| ||||||||||
elasticsearch: two vulnerabilities
| Package(s): | elasticsearch | CVE #(s): | CVE-2015-5377 CVE-2015-5531 | ||||
| Created: | August 11, 2015 | Updated: | August 12, 2015 | ||||
| Description: | From the Elasticsearch 1.7.0 and 1.6.1 release announcement:
Remote code execution vulnerability Elasticsearch versions prior to 1.6.1 are vulnerable to an engineered attack on its transport protocol (used for communication between nodes and Java clients) that enables remote code execution. This issue is related to the Groovy announcement in CVE-2015-3253. Deployments are vulnerable even when Groovy dynamic scripting is disabled. Users that do not want to upgrade can address the vulnerability by securing the transport protocol port (default 9300) to allow access by only trusted agents. We have been assigned CVE-2015-5377 for this issue. Directory traversal vulnerability Elasticsearch versions from 1.0.0 to 1.6.0 are vulnerable to a directory traversal attack that allows an attacker to retrieve files that are readable by the Elasticsearch JVM process. Users that do not wish to upgrade can use a firewall, reverse proxy, or Shield to prevent Snapshot-Restore API calls from untrusted sources. We have been assigned CVE-2015-5531 for this issue. | ||||||
| Alerts: |
| ||||||
firefox: multiple vulnerabilities
| Package(s): | firefox | CVE #(s): | CVE-2015-4474 CVE-2015-4477 CVE-2015-4482 CVE-2015-4483 CVE-2015-4490 | ||||||||||||||||||||||||||||||||||||||||||||||||
| Created: | August 12, 2015 | Updated: | March 28, 2016 | ||||||||||||||||||||||||||||||||||||||||||||||||
| Description: | From the Arch Linux advisory:
- CVE-2015-4474 (Memory safety bugs fixed in Firefox 40): Tyson Smith, Bobby Holley, Chris Coulson, Byron Campen, and Eric Rahm reported memory safety problems and crashes that affect Firefox 39. - CVE-2015-4477 (MediaStream use-after-free): Security researcher SkyLined reported a use-after-free issue in how audio is handled through the Web Audio API during MediaStream playback through interactions with the Web Audio API. This results in a potentially exploitable crash. - CVE-2015-4482 (Out of bounds write in mar_read.c): Security researcher Holger Fuhrmannek reported that if the Updater opens a MAR format file with a specially crafted name, an out-of-bounds write will occur. This can lead to a potentially exploitable crash but requires that the malicious MAR format file be present on the local system and the Updater to be run to use it. - CVE-2015-4483 (feed: protocol + POST method => mixed scripting): Security researcher Masato Kinugawa reported that opening a target page using a POST to the url prefixed with the feed: protocol disables the mixed content blocker for that page. This could allow for the risk of a man-in-the-middle (MITM) scripting attack on pages that accidentally include insecure content which would otherwise be blocked. - CVE-2015-4490 (Mozilla Content Security Policy allows for asterisk wildcards in violation of CSP specification): Mozilla security engineer Christoph Kerschbaumer reported a discrepancy in Mozilla's implementation of Content Security Policy and the CSP specification. The specification states that blob:, data:, and filesystem: URLs should be excluded in case of a wildcard when matching source expressions but Mozilla's implementation allows these in the case of an asterisk wildcard. This could allow for more permissive CSP usage than expected by a web developer, possibly allowing for cross-site scripting (XSS) attacks. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||
firefox: multiple vulnerabilities
| Package(s): | firefox | CVE #(s): | CVE-2015-4473 CVE-2015-4475 CVE-2015-4478 CVE-2015-4479 CVE-2015-4480 CVE-2015-4484 CVE-2015-4485 CVE-2015-4486 CVE-2015-4487 CVE-2015-4488 CVE-2015-4489 CVE-2015-4491 CVE-2015-4492 CVE-2015-4493 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Created: | August 12, 2015 | Updated: | February 29, 2016 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: | From the Red Hat advisory:
Several flaws were found in the processing of malformed web content. A web page containing malicious content could cause Firefox to crash or, potentially, execute arbitrary code with the privileges of the user running Firefox. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gnutls: denial of service
| Package(s): | gnutls28 | CVE #(s): | CVE-2015-6251 | ||||||||||||||||||||||||||||||||||||
| Created: | August 12, 2015 | Updated: | September 12, 2016 | ||||||||||||||||||||||||||||||||||||
| Description: | From the Debian advisory:
Kurt Roeckx discovered that decoding a specific certificate with very long DistinguishedName (DN) entries leads to double free. A remote attacker can take advantage of this flaw by creating a specially crafted certificate that, when processed by an application compiled against GnuTLS, could cause the application to crash resulting in a denial of service. | ||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||
kernel: multiple vulnerabilities
| Package(s): | kernel | CVE #(s): | CVE-2015-5697 CVE-2015-5706 CVE-2015-5707 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Created: | August 7, 2015 | Updated: | September 29, 2015 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: | From the Debian advisory:
CVE-2015-5697: A flaw was discovered in the md driver in the Linux kernel leading to an information leak. CVE-2015-5706: An user triggerable use-after-free vulnerability in path lookup in the Linux kernel could potentially lead to privilege escalation. CVE-2015-5707: An integer overflow in the SCSI generic driver in the Linux kernel was discovered. A local user with write permission on a SCSI generic device could potentially exploit this flaw for privilege escalation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lighttpd: log injection
| Package(s): | lighttpd | CVE #(s): | CVE-2015-3200 | ||||||||||||
| Created: | August 7, 2015 | Updated: | September 8, 2015 | ||||||||||||
| Description: | From the Red Hat bugzilla:
A flaw was found in Lighttpd: When basic HTTP authentication base64 string does not contain colon character (or contains it after NULL byte - can be inserted inside base64 encoding), then that situation is logged with a string ": is missing in " and the simply decoded base64 string. This means that new lines, NULL byte and everything else can be encoded with base64 and are then inserted to logs as they are after decoding. | ||||||||||||||
| Alerts: |
| ||||||||||||||
mantis: information disclosure
| Package(s): | mantis | CVE #(s): | CVE-2015-5059 | ||||||||
| Created: | August 7, 2015 | Updated: | August 12, 2015 | ||||||||
| Description: | From the Red Hat bugzilla:
In MantisBT, the "Project Documentation" feature can be used to attach files to a project. When this feature is enabled ($g_enable_project_documentation = ON) and the threshold to view these files is left to its default value ($g_view_proj_doc_threshold = ANYBODY), any registered user in the system can download every such attachment, including those which are linked to private projects to which the user does not have access. This can be achieved by calling the download script directly, and specifying the ID of the file to download. | ||||||||||
| Alerts: |
| ||||||||||
mozilla: information leak
| Package(s): | firefox thunderbird seamonkey | CVE #(s): | CVE-2015-4495 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Created: | August 7, 2015 | Updated: | September 2, 2015 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: | From the Arch Linux advisory:
Security researcher Cody Crews reported on a way to violate the same origin policy and inject script into a non-privileged part of the built-in PDF Viewer. This would allow an attacker to read and steal sensitive local files on the victim's computer. Mozilla has received reports that an exploit based on this vulnerability has been found in the wild. A remote attacker can craft a malicious web page stealing arbitrary files from the host running firefox. Mozilla reports that this flaw is already exploited in the wild. At least one exploit is targeting Linux and reads /etc/passwd, then in all the user directories it can access looks for .bash_history, .mysql_history, .pgsql_history, .ssh configuration files and keys, configuration files for remina, Filezilla, and Psi+, text files with “pass” and “access” in the names, and any shell scripts. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opensaml-java: missing host name verification
| Package(s): | opensaml-java | CVE #(s): | CVE-2014-3603 | ||||||||||||||||
| Created: | August 7, 2015 | Updated: | August 12, 2015 | ||||||||||||||||
| Description: | From the Red Hat bugzilla:
It was discovered that HttpResource and FileBackedHttpResource implementations in OpenSAML Java and Shibboleth IdP did not enable hostname verification when using TLS connections. Additionally, OpenSAML Java makes use of Jakarta Commons HttpClient version 3.x, which does not perform verification of the server hostname against the server's X.508 certificate (CVE-2012-5783). This flaw can be exploited by a Man-in-the-middle (MITM) attack, where the attacker can spoof a valid certificate using a specially crafted subject. | ||||||||||||||||||
| Alerts: |
| ||||||||||||||||||
pure-ftpd: denial of service
| Package(s): | pure-ftpd | CVE #(s): | |||||||||||||
| Created: | August 12, 2015 | Updated: | September 9, 2015 | ||||||||||||
| Description: | From the Red Hat bugzilla:
It was reported that the process handling a user session could be crashed by trying to match a file pattern longer than the maximum length for a path. | ||||||||||||||
| Alerts: |
| ||||||||||||||
qemu: denial of service
| Package(s): | qemu | CVE #(s): | CVE-2015-5745 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Created: | August 12, 2015 | Updated: | September 1, 2015 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: | From the Mageia advisory:
Qemu emulator built with the virtio-serial vmchannel support is vulnerable to a buffer overflow issue. It could occur while exchanging virtio control messages between guest & the host. A malicious guest could use this flaw to corrupt few bytes of Qemu memory area, potentially crashing the Qemu process. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rubygems: DNS hijacking
| Package(s): | rubygems | CVE #(s): | CVE-2015-3900 | ||||||||||||||||
| Created: | August 11, 2015 | Updated: | September 9, 2015 | ||||||||||||||||
| Description: | From the CVE entry:
RubyGems 2.0.x before 2.0.16, 2.2.x before 2.2.4, and 2.4.x before 2.4.7 does not validate the hostname when fetching gems or making API request, which allows remote attackers to redirect requests to arbitrary domains via a crafted DNS SRV record, aka a "DNS hijack attack." | ||||||||||||||||||
| Alerts: |
| ||||||||||||||||||
subversion: two vulnerabilities
| Package(s): | subversion | CVE #(s): | CVE-2015-3184 CVE-2015-3187 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Created: | August 11, 2015 | Updated: | August 18, 2015 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: | From the Debian advisory:
CVE-2015-3184: Subversion's mod_authz_svn does not properly restrict anonymous access in some mixed anonymous/authenticated environments when using Apache httpd 2.4. The result is that anonymous access may be possible to files for which only authenticated access should be possible. This issue does not affect the oldstable distribution (wheezy) because it only contains Apache httpd 2.2. CVE-2015-3187: Subversion servers, both httpd and svnserve, will reveal some paths that should be hidden by path-based authz. When a node is copied from an unreadable location to a readable location the unreadable path may be revealed. This vulnerability only reveals the path, it does not reveal the contents of the path. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
swift: arbitrary object deletion
| Package(s): | swift | CVE #(s): | CVE-2015-1856 | ||||||||||||||||||||
| Created: | August 6, 2015 | Updated: | August 25, 2015 | ||||||||||||||||||||
| Description: | From the Ubuntu advisory:
Clay Gerrard discovered Swift allowed users to delete the latest version of object regardless of object permissions when allow_version is configured. An attacker could use this issue to delete objects. (CVE-2015-1856) | ||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||
wordpress: multiple vulnerabilities
| Package(s): | wordpress | CVE #(s): | CVE-2015-2213 CVE-2015-5730 CVE-2015-5731 CVE-2015-5732 CVE-2015-5733 CVE-2015-5734 | ||||||||||||||||||||||||||||
| Created: | August 7, 2015 | Updated: | August 12, 2015 | ||||||||||||||||||||||||||||
| Description: | From the Arch Linux advisory:
- CVE-2015-2213: SQL injection in comments ID. - CVE-2015-5730: Timing attack in widgets. - CVE-2015-5731: Denial of service by locking a post from being edited. - CVE-2015-5732, CVE-2015-5733 CVE-2015-5734: XSS. A remote attacker could lock a post from being edited, or compromise a site running wordpress. | ||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||
xfsprogs: information disclosure
| Package(s): | xfsprogs | CVE #(s): | CVE-2012-2150 | ||||||||||||||||||||||||||||||||
| Created: | August 12, 2015 | Updated: | January 5, 2016 | ||||||||||||||||||||||||||||||||
| Description: | From the Red Hat bugzilla:
Gabriel Vlasiu reported that xfs_metadump, part of the xfsprogs suite of tools for the XFS filesystem, did not properly obfuscate data. xfs_metadump properly obfuscates active metadata, but the rest of the space within that fs block comes through in the clear. This could lead to exposure of stale disk data via the produced metadump image. | ||||||||||||||||||||||||||||||||||
| Alerts: |
| ||||||||||||||||||||||||||||||||||
Page editor: Jake Edge
Kernel development
Brief items
Kernel release status
The current development kernel is 4.2-rc6, released on August 9. Linus said: "So last week I wasn't very happy about the state of the release candidates, but things are looking up. Not only is rc6 finally shrinking noticeably, the issues I was worried about had fixes come in early in the week, and so I don't have anything big pending. Assuming nothing new comes up, I suspect we will end up with the regular release schedule after all (ie in two weeks). Knock wood."
Stable updates: 4.1.5, 3.14.50, and 3.10.86 were released on August 10.
Quotes of the week
Kernel development news
Atomic mode setting design overview, part 2
Today's graphical applications require frame-perfect displays, while also taking advantage of specialized, power-saving hardware in embedded GPUs. To do that, the kernel must be able to update the hardware graphics state atomically — changing multiple independent parameters in a single operation so that users don't see corrupted frames while the change is taking place. The first article of this series looked at why an atomic display update API has become necessary, how it came to be, and what the main driver interfaces look like. Here, we will look into a few more details and build on the material discussed earlier.
Still, a short recap of the main interface can't hurt: an atomic display update is created by duplicating the state structures for display objects like planes or a CRTC and then updating the duplicates, which are collected in struct drm_atomic_state. Once all updates are applied, the new state is provided in its entirety to the driver's ->atomic_check() function for validation. If it passes, then it can be committed using ->atomic_commit(). Just validating updates to figure out in a generic way what's possible is also supported using a check-only mode.
Of atomic updates and nuclear options
A big change in upstream atomic mode setting compared to the Android Display Framework (ADF) is that upstream allows any display state to be changed through the atomic ioctl(). ADF only allows plane states to be changed atomically; output routing and display-mode changes (which are called mode-set changes in this article) need separate calls from user space in ADF. At least on a cursory look, plane updates and mode-set changes are indeed two different things. On one hand, atomic plane updates are meant to be completed by the next frame displayed. Atomic mode-set updates, on the other hand, can cause a display to go to black for a bit, which is anything but perfect. Mode-set updates generally take hundreds of milliseconds. But both update the display state in an atomic, all-or-nothing fashion and they can both use the same "list of property changes" transport for the ioctl(). So, purely by just looking at the structures and data passed between user space and the kernel — and not the requested semantics — it makes a lot of sense to treat them as the same operation.
The tension between these two types of updates resulted in a lot of confusion when discussing atomic plans for upstream. It was only fixed by calling full mode sets "atomic mode sets" and calling the plane updates "nuclear page flips". But when you look closer, the distinction between full mode sets and pure plane updates synchronized to the next frame becomes unclear quickly. Often a display mode change on integrated panels only means that the scaler used to fit the displayed area onto the panel needs to be adjusted. A lot of hardware can do that with a small update for the next frame, without the need for a full mode set and blanking the screen. But then there's hardware where some plane configuration changes require reallocation of FIFO space, and that is only possible when the display pipeline is shut down. Which looks very much like a mode set.
Furthermore, user space would often like to delay changes that require full mode sets to a more suitable time. For example, tablets and smartphones suspend so often that pretty much any mode set can be delayed without incurring too much energy waste by running in a suboptimal configuration until the next suspend. There, plane changes that need a full mode set shouldn't be done without the consent of user space to avoid a less-than-perfect visual experience for users.
After many bits were expended discussing this problem, the solution merged was the DRM_MODE_ATOMIC_ALLOW_MODESET flag. With this, user space can indicate whether a full mode set (with the downsides of potentially blanking seemingly unrelated screens and taking a long time) is acceptable or not. And, of course, this flag is also obeyed for the test-only mode. Most drivers don't need to bother with this, since the atomic helpers take care of checking for it — as long as the driver correctly indicates to the helper code that it needs or doesn't need a full mode set in one of the special cases mentioned above.
Locking magic using wait/wound mutexes
Next up is how concurrent updates are handled. A while ago, DRM gained per-CRTC locks to allow concurrent updates and changes on different display pipelines. That, in turn, required per-plane locks since planes can (if the hardware supports it) change the CRTC they're connected to. In addition, there's one more lock to protect all the output routing and connector state — making those kinds of changes usually requires at least a few hundred milliseconds, thus will result in stalls no matter what. It's also a rare and usually system-wide operation, so finer-grained locking for that would just be wasted.
But one problem with the atomic ioctl() is that user space could pass its list of updates (in the form of object_id, property_id, value triples) in any order it wants. That could easily lead to deadlocks if they are processed in that order, since different objects require different locks. User space could provoke an AB-BA deadlock by creating two updates that list the same two objects but in a different order.
That can be solved by sorting the entire list of triples by objects first, but unfortunately that only delays the problem. The first article explained that atomic state-checking code is only allowed to look at or touch the state of objects that are in the update. This guarantees that concurrent updates won't trample each another. Unfortunately, that also means that drivers must be able to add arbitrary objects and their states to the overall atomic update tracked in the drm_atomic_state structure in their ->atomic_check() callback. That will allow the callback to check cross-object limits and make sure that shared resources are not exhausted. Because hardware is crazy, this can't be done outside of the driver code since every piece of hardware has its own unique shared state. Just grabbing all potentially needed locks up front isn't a great idea either, since that will only make all updates synchronous and hence make all the fine-grained locking pointless.
This means a locking scheme where locks can be taken in an arbitrary order is needed. Luckily, the kernel has that with its wait/wound mutex support, which, incidentally, was also added by GPU driver hackers for some pesky memory-management troubles. Wait/wound mutexes are a topic of their own, really, but the summary is that they allow you to grab locks in arbitrary order, can reliably detect deadlocks, and have a means to back off from a deadlock without throwing fairness out the window or requiring costly spinning. They're also rather complex.
No one wants to inflict advanced locking schemes on driver writers unnecessarily, so the locking is all nicely encapsulated in functions provided by the atomic core. When you need to change which CRTC a plane is assigned to, just call drm_atomic_set_crtc_for_plane() and make sure any errors are forwarded correctly up the call chain. Similarly, if a driver needs to consult other state objects in its state-validation code (e.g. to check limits on shared resources), it can duplicate any state into the atomic update it needs and locks will be acquired correctly behind the scenes. The only important bit is to correctly forward the -EDEADLK error code and always use the provided functions to duplicate and update state structures. With that, magic simply happens. Well, as long as a driver's atomic check code is otherwise correct and doesn't touch hardware state nor anything else that might persist outside of just the state structures.
For users of the DRM-internal atomic interface things are a notch more complex, but not a lot. Wait/wound locking state is tracked in a struct drm_modeset_acquire_ctx, which is initialized using drm_modeset_acquire_init(). To make all the transparent lock-taking work when duplicating state objects into an atomic update, this is also stored in drm_atomic_state->ctx. As with drivers, any locks needed will be implicitly acquired when duplicating state objects; the only thing needed is to actually handle deadlocks signaled with the -EDEADLK error code.
Since the deadlock backoff logic will drop locks, already duplicated state objects might become stale and need to be released first with drm_atomic_state_clear(). Then a call to drm_modeset_backoff() will drop any acquired mode-set locks and block on the contended lock until it's available. After that, the entire sequence needs to be restarted right after the initialization of the acquire context — that must not be reinitialized since it contains the queue ticket that ensures forward progress in the wait/wound locking algorithm. Finally, when everything has succeeded, locks can be dropped with drm_modeset_drop_locks() and the acquire context is finalized with drm_modeset_acquire_fini().
Note that it's really easy to test all that special backoff code: enabling lock debugging and CONFIG_DEBUG_WW_MUTEX_SLOWPATH will cause the wait/wound mutex code to inject spurious deadlock conditions. With that, all the deadlock backoff code can be exhaustively tested just with single-threaded test cases. And of course wait/wound mutexes fully support all the Linux lock debugging and testing tools such as lockdep.
Helper-library design
The other piece that took years to settle is the driver helper-library design. A mid-layer approach, as in ADF, was out of question because hardware has too many special cases to be able to create such a framework that is not too complex. There was already an extensive set of helpers used by most drivers anyway, so preferably drivers shouldn't have to rewrite all their callbacks and support code when converting to atomic updates. Directly reusing the existing callbacks was done for proof-of-concept conversions, but fundamentally there were a few troubles with the existing helpers and their driver callbacks:
- They had no real support for checking cross-object constraints. Properly checking those is a major goal of the atomic changes. Checking for such arbitrary cross-device constraints is exposed to user space with the DRM_MODE_ATOMIC_TEST_ONLY flag, which is described in the first article.
- There was no support for doing atomic updates of planes. For sane hardware that has lockout bits to prevent any updates until they have all been written to registers, this is easy to fix with just pre- and post-commit hooks. But in general, hardware needs more flexibility there. There were also no provisions for separating the checks from the commit phase of plane updates.
- Any output routing changes required updating and enabling the primary plane too. Often that's not what you want, for example displaying a video overlay with black background for the letterbox or pillarbox bars doesn't need any primary plane at all. The hardware can do this, so it should be made possible.
- Finally, the legacy helpers were designed for the very first XRandR implementation. In the almost ten years that have passed since, DRM developers learned an awful lot of lessons about what works, what should be simplified (by providing stricter guarantees in helpers), and where more flexibility was needed to make the helpers more useful.
All in all, a full rewrite of the helper code was in order, while still making conversions fairly easy. The big change, certainly, is that the helper library doesn't just expose one monolithic template function for each hook, but also exposes separate pieces, for example to handle plane-only updates or only output configuration changes. Aside from a few restrictions imposed by the atomic semantics they can also be called in arbitrary order, as it best suits the hardware. This way drivers can mix and match between helper code and their own — or just augment helper code as needed (for checking or changing global state for example).
A good example would be drivers supporting runtime power management (PM). The old legacy helpers updated planes in between disabling outputs and enabling them with the new configuration. For best backward compatibility, that's also what the atomic helpers do, but this is not the best for drivers supporting runtime PM. Such drivers will disable the hardware when the display pipelines are off and, hence, plane updates will get lost if they are done in the middle. It's better to do plane updates as the final step of committing the update to hardware, and the helpers allow this.
Another useful feature of the new helper library is that any derived state to steer control flow is stored in the state structures — it has to be, due to the check/commit split. That allows drivers to overwrite and control the helpers in fine detail. For example, a driver can force a full mode set (and the required state precomputation) when some shared global resources need to be adjusted, even when the helper wouldn't see a need for a full mode set on its own. Since the exported check functions are idempotent, they can be re-run when a later step uncovers the need (again due to shared resources) to include more objects in the atomic update.
That is useful when a plane update uncovers the need for a full mode set. But a full mode set, in turn, might require recomputations for plane states, creating a loop. Making the exported helpers idempotent and callable in any order helps to break such loops. To avoid surprises, the default check function, drm_atomic_helper_check(), only calls the subordinate helpers to check plane updates and mode-set changes once each. But hardware with complicated dependencies between these two types of updates (like the example earlier where a plane update can require a full mode set, maybe even on an unrelated CRTC) can be handled by calling the helpers multiple times, until a steady state has been reached for the precomputed state. Note that this is only to facilitate the state validation, the actual commit of the atomic update to the hardware should still happen in one go, without any iterating.
Also, all the functions to implement legacy callbacks in terms of the atomic driver interfaces are exported and can be called explicitly. Drivers without a need to specially handle legacy entry points can just put the provided helpers directly into the DRM driver operation function tables. This allows drivers to keep some features only supported for legacy interfaces by keeping the code for old platforms around. This is useful for drivers which support ten or more years of hardware iterations where it doesn't make sense to implement proper atomic support for every old special case.
The other big change is simpler semantics for drivers. Thanks to the atomic updates, the new helpers can keep track of state changes much better and guarantee that a disable or enable hook won't be called redundantly — which the old helpers routinely did. They also hide a lot of the potential flexibility of legacy interfaces like the four different display power management signaling (DPMS) levels used for runtime PM on outputs — the atomic helpers only have on and off. This is because modern hardware simply doesn't support intermediate DPMS levels any more. On anything but the oldest of hardware, drivers just clamped the intermediate levels to off. This also allows the atomic helpers to reuse the same enable and disable hooks for runtime PM as for the normal enabling and disabling of outputs, which simplifies drivers. The ->dpms() callbacks are still supported to simplify converting drivers from legacy mode setting to atomic, but they are deprecated. Converted drivers should only have to implement the ->enable() and ->disable() hooks and should be able to delete the DPMS handlers entirely.
Finally, there are transitional helpers to handle the impedance mismatch for planes between legacy helpers and the new atomic ones. They provide helpers like drm_helper_crtc_mode_set_base() that implement the legacy helper callbacks in terms of the new atomic helper callbacks. This allows driver writers to switch over to the new hooks for plane updates in their backend while otherwise still using the same code and overall control-flow. That helps a lot in converting big drivers by allowing the conversion to happen in multiple phases that only deal with a part of the driver. There's also a "how to" that has all of the details for an atomic conversion — what all needs to be done and in which exact order.
Overall, there are a number of drivers already converted and the new helpers seem to be working out well. Some small changes in the interfaces of callbacks were needed, but thus far there have been no big problems with the semantics themselves. A big reason for that is that the new code has been modeled after the i915.ko-specific mode-set infrastructure, which has been developed over the past few years with an aim toward atomic updates.
The big lesson learned from i915.ko led to the major difference in the merged code: how an atomic update is assembled before actually committing it to the hardware. In i915.ko all updates were staged using a set of new_foo members embedded into each mode-setting object structure, mirroring all the existing data structures and pointers. The major downside of that approach is that rolling back an update (either because it violates a constraint or because user space only asked to check constraints using TEST_ONLY) needed to carefully undo all these changes. Staging updates in the objects themselves also makes it much harder to have multiple updates in-flight at the same time. With the merged atomic infrastructure, updates are assembled out of free-standing state objects and no permanent mode-setting object structures are touched before actually committing state to the hardware. That makes rollback and handling concurrent updates much easier.
The unresolved gap in the current helpers is handling non-blocking updates. Thus far, drivers need to manage their own work queues for the asynchronous tail of an atomic update and synchronize appropriately when an update depends upon global state, like they had to already for primary plane page flips with the old legacy ioctl(). There are ideas floating around to implement this in the atomic helpers. But nothing has come up that is both simple enough to be an improvement over the current state while still being useful for a lot of drivers.
Conclusions
After more than three years in the making, upstream has finally a mode-setting interface and support infrastructure for drivers that covers all of the use cases, from energy-sipping systems-on-chip (SoCs) with the need for all the special plane hardware and supporting perfect updates of each frame to big desktops supporting multiple screens. That's a first, since the original kernel mode setting pretty much left embedded systems to fbdev. But given the number of ongoing or already-merged conversions to atomic and entirely new drivers supporting it, it looks like upstream graphics for SoCs is finally happening and is bound to stay. Well, at least for the mode-setting side of GPUs. But even just that would be a big change and a great improvement for all the upstreaming efforts of Android-vendor kernel trees.
Let's all embrace the age of atomic mode setting — that future is here and it is looking good ...
libnvdimm, or the unexpected virtue of unit tests
In the July 9th edition, Jonathan Corbet said: "Over time, the kernel development community has indeed gotten better at merging code that does not require fixing later in the development cycle." That’s good. Now how do we accelerate this trend? One need only look at the recent inclusion of kselftests in the kernel or the ongoing development of the venerable xfstests suite to understand the current state of the art of Linux kernel test capabilities. However, what becomes readily apparent when looking at these test suites is that they are limited to tests that can be solely driven by user-space stimuli, such as generic sysfs attributes, system calls, and on-disk metadata formats.
Granted this is a very large test surface, but it still leaves a coverage hole for a body of code that, to date, has only executed in the presence of specific hardware (be it virtual or physical), makes up the majority of the kernel source, and sees the highest rate of change: device drivers. The libnvdimm subsystem is one of the latest additions to the kernel's driver infrastructure; it layers services over persistent memory to make access to that memory safer and more reliable. To the best of this author’s knowledge, libnvdimm is the first upstream device-driver subsystem to integrate in-kernel interface mocking techniques in support of unit testing. This article walks through how and why this came to pass, as well as the challenge and promise of driver unit testing going forward.
The trouble with TRBs
While libnvdimm is the first upstream inclusion of this technique, the first overall attempt to use mocking for driver development was part of a patch kit for rearchitecting transfer-request-block (TRB) handling in the USB 3.0 host controller (XHCI) driver. It is helpful to understand the problem the patch kit was trying to solve to see why mocking was proposed as a way to validate the implementation.
Like many I/O devices, XHCI controllers have a ring buffer for describing transfers between memory and the device. An XHCI ring buffer entry is called a TRB, and it describes a transfer of a contiguous range of memory. The total set of TRBs in an XHCI ring need not be contiguous in memory as a ring can be divided into segmented groups of TRBs. These individual ring segments (TRB-segments) can be chained together with "link" TRBs. In the case when a single TRB is only able to describe a subset of the full transfer request (i.e., when performing scatter-gather to multiple discontiguous memory ranges), multiple TRBs can be ganged together to form the transfer-descriptor (TD). This architecture is fairly straightforward until one considers the pile of constraints imposed by the I/O request, the host controller, and the attached device:
- A TD may only cross a TRB-segment boundary (by way of a link-TRB) at a
device-defined boundary called the MBP (max burst payload). This means
that if the MBP is 1KB and we hit the end of a TRB segment after queuing a
512-byte TRB, things will fail; the driver should have instead enqueued an
early link-TRB rather than the 512-byte "transfer"-TRB.
- A single TRB may not cross a 64KB boundary in memory.
- Each discontiguous range to be transferred must have its own TRB (implied since the driver is performing scatter-gather DMA in a TD).
If you are still reading this article after that acronym soup then perhaps you are also starting to imagine the array of USB peripherals and contrived I/O scenarios needed to fully exercise all the corner-case conditions presented by the these overlapping constraints. Instead, these conditions can be explicitly tested by mocking all the interfaces and input conditions that surround the TRB queuing implementation. This is the approach taken in the patch titled "xhci: unit test ring enqueue/dequeue routines".
Move fast and break things
The motivation for exercising the XHCI TRB handling code with a unit test was not driven solely by the complexities of the hardware implementation. After all, the kernel has been quite successful in the absence of widespread driver unit testing since its inception. However, that success has come in part from shipping buggy code to users and fixing it quickly when problems arise. Can this arrangement continue to scale into the future?
While the number of new devices and platforms increases and new developers join the kernel development community, the number of active code reviewers remains relatively flat. A maintainer’s most important job is to say "no" and when that "no" can be automated by a robot like checkpatch, the 0day-kbuild infrastructure, or a unit test suite, those limited reviewer resources can scale out to higher-order review tasks. The power of unit tests to allow a project to scale was made clear by this author’s time working at Facebook. The risk incurred by onboarding new developers at a high rate was mitigated in part by extensive unit tests. This discipline shifts the "break things" aspect of "move fast" to the developer’s workstation rather than the production environment.
From read-only to rewrite
The potential of unit testing to move bug detection earlier in the development cycle is common knowledge. What was surprising during the development of libnvdimm were the occasions where the process of thinking through and developing a test resulted in early detection of warts in the architecture. This happened several times in small ways; early drafts of an approach that seemed suitable at first later felt kludgy after writing the test, and these were ultimately thrown away. A larger example was a reorganization of the block-translation-table (BTT) implementation from a driver to a library.
First, here is a quick primer on the responsibilities of the BTT code. Non-volatile memory devices provide persistent storage and can be used anywhere a disk is used. Whereas disks perform I/O operations in units of sectors (512-bytes for example) that are atomic with respect to power loss, memory devices perform I/O in units of individual bytes. With this change comes an important question: what happens if a sector update is interrupted (by a power failure, say) partway through?
Developers (and users) would like to see non-volatile devices be "atomic with respect to power loss," meaning that a write to a sector completes in full, or not at all, and software can depend on not seeing partially updated sectors upon recovery from a crash or power failure event. The BTT is a software mechanism to layer these atomic-sector-update semantics on top of byte-accessible memory. The initial architecture for BTT followed in the footsteps of other kernel drivers that layer various storage semantics on top of another storage device. Device Mapper (DM - volume management) and Multiple Devices (MD - RAID) use a stacked block device arrangement for this purpose.
This stacked arrangement served the implementation well up until the point where code was added to handle occasions when the backing memory for a BTT is discovered to be read-only. The code gymnastics needed to keep the block-device-read-only flags synchronized between the "fronting" BTT block-device and the "backing" non-volatile memory block-device received special attention during the upstream review cycle. It became clear that the implementation would be cleaner with the stacking removed and instead have the BTT built as an intrinsic property of the storage device.
In the typical development model, sans unit tests, the fact that the read-only flag for fronting and backing-device could get out of sync may not have been caught until well after the kernel had shipped to users. The process of developing a test highlighted the hidden requirement, exposed a deficiency in the architecture, and triggered significant reworking of the code, all in advance of the initial merge of the libnvdimm subsystem into the v4.2-rc1 kernel.
Making a mockery
The unit-test infrastructure for libnvdimm lives in the tools/testing/nvdimm directory. It compiles modified versions of the nfit (the "firmware interface table" that enables discovery of persistent memory arrays), libnvdimm core, and nvdimm storage drivers that consume mocked resources for exercising the implementation.
The general method for inserting mock objects into a C project is via the --wrap option to the linker. In the kernel this is really only suitable for exported symbols. See tools/testing/nvdimm/Kbuild for an example of providing fake resources to the ACPI NFIT driver and the resulting child devices. It is worth noting that --wrap should only ever appear in Kbuild configurations for external (out-of-tree) modules — and testing modules should always be considered out-of-tree, even when they are a part of the kernel source. Beyond giving a visual representation (a "taint" flag) in a kernel oops report that external modules were loaded into the failing kernel, it also separates unit test implementations that want to mock the same symbol in different ways.
Lastly, a successful unit test implementation should not render the rest of the kernel inoperable. For example, the libnvdimm test modules provide a __wrap_ioremap() symbol that redirects requests to mock memory resources for test purposes. However, if that routine is handed a real libnvdimm resource, __wrap_ioremap() detects it and passes it through to the actual ioremap() in the base kernel.
I struggled with the kernel build infrastructure to use the linker-provided method for calling "real" symbols from a wrapper. The linker defines a __real_ioremap() by default for this purpose, but that symbol cannot be handed to EXPORT_SYMBOL(). Instead, the Kbuild infrastructure can achieve the same effect as __real_<symbol>() by placing the definition of the wrappers in their own directory. See tools/testing/nvdimm/test/iomap.c for the implementation of the fallback mechanism.
Conclusion
The addition of the unit tests was a contentious point during the review process — a fact that is reflected in the changelog. Although there were numerous, pleasantly surprising occasions of early detection of bugs and architecture defects, this approach carries risk. Mock objects by definition take shortcuts and bend the normal rules of the objects they replace. This fact presents a unique maintenance burden in that different test implementations may choose to mock the same symbol in different ways — ways that would be surprising to a typical kernel developer.
In general, code aspects in a project that surprise a typical developer are a tax on review resources. That said, the "tax" is overshadowed by the benefits. The volume and pace of iteration needed to take libnvdimm, without regressing, from its initial posting at v4.1-rc1 to its final merging state at v4.2-rc1 could not have been achieved without this capability. As the kernel continues to scale and attract new developers, the need for automated code review and testing will continue to grow.
RCU requirements part 3
This is the third and final segment in a series on the requirements for the kernel's read-copy-update (RCU) subsystem and how they came to be. Part 1 covered the fundamental requirements that make RCU what it is, while part 2 got into the requirements driven by software-engineering and parallelism concerns. In this concluding segment, the discussion will become more Linux-specific. In particular, the following topics are covered:
Needless to say, it wouldn't be an RCU article without the answers to the quick quizzes at the end — but this article only has a single quiz in it.
Linux kernel complications
The Linux kernel provides an interesting environment for all kinds of software, including RCU. Some of the relevant points of interest are as follows:
- Configuration.
- Firmware interface.
- Early boot.
- Interrupts and non-maskable interrupts (NMIs).
- Loadable modules.
- Hotplug CPU.
- Scheduler and RCU.
- Tracing and RCU.
- Energy efficiency.
- Performance, scalability, response time, and reliability.
This list is probably incomplete, but it does give a feel for the most notable Linux kernel complications. Each of the following sections covers one of the above topics.
Configuration
RCU's goal is automatic configuration, so that almost nobody needs to worry about RCU's Kconfig options. And, for almost all users, RCU does in fact work well “out of the box.”
However, there are specialized use cases that are handled by kernel boot parameters and Kconfig options. Unfortunately, the Kconfig system will explicitly ask users about new Kconfig options, which requires almost all of them be hidden behind a CONFIG_RCU_EXPERT Kconfig option. Commits doing this hiding are making their way to mainline.
This all should be quite obvious, but the fact remains that Linus Torvalds recently had to remind me of this requirement.
Firmware interface
In many cases, the kernel obtains information about the system from the firmware, and sometimes things are lost in translation. Or the translation is accurate, but the original message is bogus.
For example, some systems' firmware over-reports the number of CPUs, sometimes by a large factor. If RCU naively believed the firmware, as it used to do, it would create too many per-CPU kernel threads. Although the resulting system will still run correctly, the extra threads needlessly consume memory and can cause confusion when they show up in ps listings.
RCU must therefore wait for a given CPU to actually come online before it can allow itself to believe that the CPU actually exists. The resulting “ghost CPUs” (which are never going to come online) cause a number of interesting complications.
Early boot
The Linux kernel's boot sequence is an interesting process, and RCU is used early, even before rcu_init() is invoked. In fact, a number of RCU's primitives can be used as soon as the initial task's task_struct is available and the boot CPU's per-CPU variables are set up. The read-side primitives (rcu_read_lock(), rcu_read_unlock(), rcu_dereference(), and rcu_access_pointer()) will operate normally early on, as will rcu_assign_pointer().
Although call_rcu() may be invoked at any time during boot, callbacks are not guaranteed to be invoked until after the scheduler is fully up and running. This delay in callback invocation is due to the fact that RCU does not invoke callbacks until it is fully initialized, and this full initialization cannot occur until after the scheduler has initialized itself to the point where RCU can spawn and run its kernel threads. In theory, it would be possible to invoke callbacks earlier; however, this is not a panacea because there would be severe restrictions on what operations those callbacks could invoke.
Perhaps surprisingly, synchronize_rcu(), synchronize_rcu_bh() (discussed below), and synchronize_sched() will all operate normally during very early boot, the reason being that there is only one CPU and preemption is disabled. This means that the call synchronize_rcu() (or friends) itself is a quiescent state and thus a grace period, so the early-boot implementation can be a no-op.
Answer
I learned of these boot-time requirements as a result of a series of system hangs.
Interrupts and NMIs
The Linux kernel has interrupts, and RCU read-side critical sections are legal within interrupt handlers and within interrupt-disabled regions of code, as are invocations of call_rcu().
Some Linux kernel architectures can enter an interrupt handler from non-idle process context, and then just never leave it, instead stealthily transitioning back to process context. This trick is sometimes used to invoke system calls from inside the kernel. These “half-interrupts” mean that RCU has to be very careful about how it counts interrupt nesting levels. I learned of this requirement the hard way during a rewrite of RCU's dyntick-idle code.
The Linux kernel has non-maskable interrupts (NMIs), and RCU read-side critical sections are legal within NMI handlers. Thankfully, RCU update-side primitives, including call_rcu(), are prohibited within NMI handlers.
The name notwithstanding, some Linux kernel architectures can have nested NMIs, which RCU must handle correctly. Andy Lutomirski recently surprised me with this requirement; he also kindly surprised me with an algorithm that meets that requirement.
Loadable modules
The Linux kernel has loadable modules, and these modules can also be unloaded. After a given module has been unloaded, any attempt to call one of its functions results in a segmentation fault. The module-unload functions must therefore cancel any delayed calls to loadable-module functions; for example, any outstanding mod_timer() must be dealt with via del_timer_sync() or similar.
Unfortunately, there is no way to cancel an RCU callback; once you invoke call_rcu(), the callback function is going to eventually be invoked, unless the system goes down first. Because it is normally considered socially irresponsible to crash the system in response to a module unload request, we need some other way to deal with in-flight RCU callbacks.
RCU therefore provides rcu_barrier(), which waits until all in-flight RCU callbacks have been invoked. If a module uses call_rcu(), its exit function should therefore prevent any future invocation of call_rcu(), then invoke rcu_barrier(). In theory, the underlying module-unload code could invoke rcu_barrier() unconditionally, but in practice this would incur unacceptable latencies.
Nikita Danilov noted this requirement for an analogous filesystem-unmount situation, and Dipankar Sarma incorporated rcu_barrier() into RCU. The need for rcu_barrier() for module unloading became apparent later.
Hotplug CPU
The Linux kernel supports CPU hotplug, which means that CPUs can come and go. It is of course illegal to use any RCU API member from an offline CPU. This requirement was present from day one in DYNIX/ptx, but on the other hand, the Linux kernel's CPU-hotplug implementation is “interesting.”
The Linux kernel CPU-hotplug implementation has notifiers that are used to allow the various kernel subsystems (including RCU) to respond appropriately to a given CPU-hotplug operation. Most RCU operations may be invoked from CPU-hotplug notifiers, including even normal synchronous grace-period operations such as synchronize_rcu(). However, expedited grace-period operations such as synchronize_rcu_expedited() are not supported, due to the fact that current implementations block CPU-hotplug operations, which could result in deadlock.
In addition, all-callback-wait operations such as rcu_barrier() are also not supported, due to the fact that there are phases of CPU-hotplug operations where the outgoing CPU's callbacks will not be invoked until after the CPU-hotplug operation ends, which could also result in deadlock.
Scheduler and RCU
RCU depends on the scheduler, and the scheduler uses RCU to protect some of its data structures. This means the scheduler is forbidden from acquiring the run-queue locks and the priority-inheritance locks in the middle of an outermost RCU read-side critical section unless it also releases them before exiting that same RCU read-side critical section. This same prohibition also applies to any lock that is acquired while holding any lock to which this prohibition applies. Violating this rule results in deadlock.
For RCU's part, the preemptible-RCU rcu_read_unlock() implementation must be written carefully to avoid similar deadlocks. In particular, rcu_read_unlock() must tolerate an interrupt where the interrupt handler invokes both rcu_read_lock() and rcu_read_unlock(). This possibility requires rcu_read_unlock() to use negative nesting levels to avoid destructive recursion via interrupt handler's use of RCU.
This pair of mutual scheduler-RCU requirements came as a complete surprise.
As noted above, RCU makes use of kernel threads, and it is necessary to avoid excessive CPU-time accumulation by these threads. This requirement was no surprise, but RCU's violation of it when running context-switch-heavy workloads when built with CONFIG_NO_HZ_FULL=y did come as a surprise [PDF]. RCU has made good progress toward meeting this requirement, even for context-switch-heavy CONFIG_NO_HZ_FULL=y workloads, but there is room for further improvement.
Tracing and RCU
It is possible to use tracing on RCU code, but tracing itself uses RCU. For this reason, rcu_dereference_raw_notrace() is provided for use by tracing, which avoids the destructive recursion that could otherwise ensue. This API is also used by virtualization in some architectures, where RCU readers execute in environments in which tracing cannot be used. The tracing folks both located the requirement and provided the needed fix, so this surprise requirement was relatively painless.
Energy efficiency
Interrupting idle CPUs is considered socially unacceptable, especially by people with battery-powered embedded systems. RCU therefore conserves energy by detecting which CPUs are idle, including tracking CPUs that have been interrupted from idle. This is a large part of the energy-efficiency requirement, so I learned of this via an irate phone call.
Because RCU avoids interrupting idle CPUs, it is illegal to execute an RCU read-side critical section on an idle CPU. (Kernels built with CONFIG_PROVE_RCU=y will splat if you try it.) The RCU_NONIDLE() macro and _rcuidle event tracing is provided to work around this restriction. In addition, rcu_is_watching() may be used to test whether or not it is currently legal to run RCU read-side critical sections on this CPU. I learned of the need for diagnostics on the one hand and RCU_NONIDLE() on the other while inspecting idle-loop code. Steven Rostedt supplied _rcuidle event tracing, which is used quite heavily in the idle loop.
It is similarly socially unacceptable to interrupt an nohz_full CPU running in user space. RCU must therefore track nohz_full user-space execution. And in CONFIG_NO_HZ_FULL_SYSIDLE=y kernels, RCU must separately track idle CPUs on the one hand and CPUs that are either idle or executing in user space on the other. In both cases, RCU must be able to sample state at two points in time, and be able to determine whether or not some other CPU spent any time idle and/or executing in user space.
These energy-efficiency requirements have proven quite difficult to understand and to meet; for example, there have been more than five clean-sheet rewrites of RCU's energy-efficiency code, the last of which was finally able to demonstrate real energy savings running on real hardware [PDF]. As noted earlier, I learned of many of these requirements via angry phone calls; flaming me on the Linux-kernel mailing list was apparently not sufficient to fully vent their ire at RCU's energy-efficiency bugs.
Performance, scalability, response time, and reliability
Expanding on the earlier discussion (in part 2), RCU is used heavily by hot code paths in performance-critical portions of the Linux kernel's networking, security, virtualization, and scheduling subsystems. RCU must therefore use efficient implementations, especially in its read-side primitives. To that end, it would be good if preemptible RCU's implementation of rcu_read_lock() could be inlined, however, doing this requires resolving #include issues with the task_struct structure.
The Linux kernel supports hardware configurations with up to 4096 CPUs, which means that RCU must be extremely scalable. Algorithms that involve frequent acquisitions of global locks or frequent atomic operations on global variables simply cannot be tolerated within the RCU implementation. RCU therefore makes heavy use of a combining tree based on the rcu_node structure. RCU is required to tolerate all CPUs continuously invoking any combination of RCU's runtime primitives with minimal per-operation overhead. In fact, in many cases, increasing load must decrease the per-operation overhead; witness the batching optimizations for synchronize_rcu(), call_rcu(), synchronize_rcu_expedited(), and rcu_barrier(). As a general rule, RCU must cheerfully accept whatever the rest of the Linux kernel decides to throw at it.
The Linux kernel is used for realtime workloads, especially in conjunction with the -rt patchset. The realtime-latency response requirements are such that the traditional approach of disabling preemption across RCU read-side critical sections is inappropriate. Kernels built with CONFIG_PREEMPT=y therefore use an RCU implementation that allows RCU read-side critical sections to be preempted. This requirement made its presence known after users made it clear that an earlier realtime patch did not meet their needs, in conjunction with some RCU issues encountered by a very early version of the -rt patchset.
In addition, RCU must make do with a sub-100-microsecond realtime latency budget. In fact, on smaller systems with the -rt patchset, the Linux kernel provides sub-20-microsecond realtime latencies for the whole kernel, including RCU. RCU's scalability and latency must therefore be sufficient for these sorts of configurations. To my surprise, the sub-100-microsecond realtime latency budget applies to even the largest systems [PDF], up to and including systems with 4096 CPUs. This realtime requirement motivated the grace-period kernel thread, which also simplified handling of a number of race conditions.
Finally, RCU's status as a synchronization primitive means that any RCU failure can result in arbitrary memory corruption that can be extremely difficult to debug. This means that RCU must be extremely reliable, which in practice also means that RCU must have an aggressive stress-test suite. This stress-test suite is called rcutorture.
Although the need for rcutorture was no surprise, the current immense popularity of the Linux kernel is posing interesting—and perhaps unprecedented—validation challenges. To see this, keep in mind that there are well over one billion instances of the Linux kernel running today, given Android smartphones, Linux-powered televisions, and servers. This number can be expected to increase sharply with the advent of the celebrated Internet of Things.
Suppose that RCU contains a race condition that manifests on average once per million years of runtime. This bug will be occurring about three times per day across the installed base. RCU could simply hide behind hardware error rates, given that no one should really expect their smartphone to last for a million years. However, anyone taking too much comfort from this thought should consider the fact that in most jurisdictions, a successful multi-year test of a given mechanism, which might include a Linux kernel, suffices for a number of types of safety-critical certifications. In fact, rumor has it that the Linux kernel is already being used in production for safety-critical applications. I don't know about you, but I would feel quite bad if a bug in RCU killed someone. Which might explain my recent focus on validation and verification.
Other RCU flavors
One of the more surprising things about RCU is that there are now no fewer than five flavors, or API families. In addition, the primary flavor that has been the sole focus up to this point has two different implementations, non-preemptible and preemptible. The other four flavors are listed below, with requirements for each described in a separate section.
Bottom-half flavor
The softirq-disable (AKA "bottom-half", hence the "_bh" abbreviations) flavor of RCU, or RCU-bh, was developed by Dipankar Sarma to provide a flavor of RCU that could withstand the network-based denial-of-service attacks researched by Robert Olsson. These attacks placed so much networking load on the system that some of the CPUs never exited softirq execution, which in turn prevented those CPUs from ever executing a context switch, which, in the RCU implementation of that time, prevented grace periods from ever ending. The result was an out-of-memory condition and a system hang.
The solution was the creation of RCU-bh, which does local_bh_disable() across its read-side critical sections, and which uses the transition from one type of softirq processing to another as a quiescent state in addition to context switch, idle, user mode, and offline. This means that RCU-bh grace periods can complete even when some of the CPUs execute in softirq indefinitely, thus allowing algorithms based on RCU-bh to withstand network-based denial-of-service attacks.
Because rcu_read_lock_bh() and rcu_read_unlock_bh() disable and re-enable softirq handlers, any attempt to start a softirq handler during the RCU-bh read-side critical section will be deferred. In this case, rcu_read_unlock_bh() will invoke softirq processing, which can take considerable time. One can, of course, argue that this softirq overhead should be associated with the code following the RCU-bh read-side critical section rather than rcu_read_unlock_bh(), but the fact is that most profiling tools cannot be expected to make this sort of fine distinction. For example, suppose that a three-millisecond-long RCU-bh read-side critical section executes during a time of heavy networking load. There will very likely be an attempt to invoke at least one softirq handler during that three milliseconds, but any such invocation will be delayed until the time of the rcu_read_unlock_bh(). This can of course make it appear at first glance as if rcu_read_unlock_bh() was executing very slowly.
The RCU-bh API includes rcu_read_lock_bh(), rcu_read_unlock_bh(), rcu_dereference_bh(), rcu_dereference_bh_check(), synchronize_rcu_bh(), synchronize_rcu_bh_expedited(), call_rcu_bh(), rcu_barrier_bh(), and rcu_read_lock_bh_held().
Sched flavor
Before preemptible RCU, waiting for an RCU grace period had the side effect of also waiting for all pre-existing interrupt and NMI handlers. However, there are legitimate preemptible-RCU implementations that do not have this property, given that any point in the code outside of an RCU read-side critical section can be a quiescent state. Therefore, RCU-sched was created, which follows “classic” RCU in that an RCU-sched grace period waits for for pre-existing interrupt and NMI handlers. In kernels built with CONFIG_PREEMPT=n, the RCU and RCU-sched APIs have identical implementations, while kernels built with CONFIG_PREEMPT=y provide a separate implementation for each.
Note well that in CONFIG_PREEMPT=y kernels, rcu_read_lock_sched() and rcu_read_unlock_sched() disable and re-enable preemption, respectively. This means that if there was a preemption attempt during the RCU-sched read-side critical section, rcu_read_unlock_sched() will enter the scheduler, with all the latency and overhead entailed. Just as with rcu_read_unlock_bh(), this can make it look as if rcu_read_unlock_sched() was executing very slowly. However, the highest-priority task won't be preempted, so that task will enjoy low-overhead rcu_read_unlock_sched() invocations.
The RCU-sched API includes rcu_read_lock_sched(), rcu_read_unlock_sched(), rcu_read_lock_sched_notrace(), rcu_read_unlock_sched_notrace(), rcu_dereference_sched(), rcu_dereference_sched_check(), synchronize_sched(), synchronize_rcu_sched_expedited(), call_rcu_sched(), rcu_barrier_sched(), and rcu_read_lock_sched_held(). However, anything that disables preemption also marks an RCU-sched read-side critical section, including preempt_disable() and preempt_enable(), local_irq_save() and local_irq_restore(), and so on.
Sleepable RCU
For well over a decade, someone saying “I need to block within an RCU read-side critical section” was a reliable indication that this someone did not understand RCU. After all, if you are always blocking in an RCU read-side critical section, you can probably afford to use a higher-overhead synchronization mechanism. However, that changed with the advent of the Linux kernel's notifiers, whose RCU read-side critical sections almost never sleep, but sometimes need to. This resulted in the introduction of sleepable RCU, or SRCU.
SRCU allows different domains to be defined, with each such domain defined by an instance of an srcu_struct structure. A pointer to this structure must be passed into each SRCU function, for example, synchronize_srcu(&ss), where ss is the srcu_struct structure. The key benefit of these domains is that a slow SRCU reader in one domain does not delay an SRCU grace period in some other domain. That said, one consequence of these domains is that read-side code must pass a “cookie” from srcu_read_lock() to srcu_read_unlock(), for example, as follows:
1 int idx; 2 3 idx = srcu_read_lock(&ss); 4 do_something(); 5 srcu_read_unlock(&ss, idx);
As noted above, it is legal to block within SRCU read-side critical sections, however, with great power comes great responsibility. If you block forever in one of a given domain's SRCU read-side critical sections, then that domain's grace periods will also be blocked forever. Of course, one good way to block forever is to deadlock, which can happen if any operation in a given domain's SRCU read-side critical section can block waiting, either directly or indirectly, for that domain's grace period to elapse. For example, this results in a self-deadlock:
1 int idx; 2 3 idx = srcu_read_lock(&ss); 4 do_something(); 5 synchronize_srcu(&ss); 6 srcu_read_unlock(&ss, idx);
However, if line 5 acquired a mutex that was held across a synchronize_srcu() for domain ss, deadlock would still be possible. Furthermore, if line 5 acquired a mutex that was held across a synchronize_srcu() for some other domain ss1, and if an ss1-domain SRCU read-side critical section acquired another mutex that was held across an ss-domain synchronize_srcu(), deadlock would again be possible. Such a deadlock cycle could extend across an arbitrarily large number of different SRCU domains. Again, with great power comes great responsibility.
Unlike the other RCU flavors, SRCU read-side critical sections can run on idle and even offline CPUs. This ability requires that srcu_read_lock() and srcu_read_unlock() contain memory barriers, which means that SRCU readers will run a bit slower than would RCU readers. It also motivates the smp_mb__after_srcu_read_unlock() API, which, in combination with srcu_read_unlock(), guarantees a full memory barrier.
The SRCU API includes srcu_read_lock(), srcu_read_unlock(), srcu_dereference(), srcu_dereference_check(), synchronize_srcu(), synchronize_srcu_expedited(), call_srcu(), srcu_barrier(), and srcu_read_lock_held(). It also includes DEFINE_SRCU(), DEFINE_STATIC_SRCU(), and init_srcu_struct() APIs for defining and initializing srcu_struct structures.
Tasks RCU
Some forms of tracing use “trampolines” to handle the binary rewriting required to install different types of probes. It would be good to be able to free old trampolines, which sounds like a job for some form of RCU. However, because it is necessary to be able to install a trace anywhere in the code, it is not possible to have read-side markers such as rcu_read_lock() and rcu_read_unlock(). In addition, it does not work to have these markers in the trampoline itself, because there would need to be instructions following rcu_read_unlock(). Although synchronize_rcu() would guarantee that execution reached the rcu_read_unlock(), it would not be able to guarantee that execution had completely left the trampoline.
The solution, in the form of Tasks RCU, is to have implicit read-side critical sections that are delimited by voluntary context switches, that is, calls to schedule(), cond_resched_rcu_qs(), and synchronize_rcu_tasks(). In addition, transitions to and from user-space execution also delimit tasks-RCU read-side critical sections.
The tasks-RCU API is quite compact, consisting only of call_rcu_tasks(), synchronize_rcu_tasks(), and rcu_barrier_tasks().
Possible future changes
One of the tricks that RCU uses to attain update-side scalability is to increase grace-period latency with increasing numbers of CPUs. If this becomes a serious problem, it will be necessary to rework the grace-period state machine so as to avoid the need for the additional latency.
Expedited grace periods scan the CPUs, so their latency and overhead increases with increasing numbers of CPUs. If this becomes a serious problem on large systems, it will be necessary to do some redesign to avoid this scalability problem.
RCU disables CPU hotplug in a few places, perhaps most notably in the expedited grace-period and rcu_barrier() operations. If there is a strong reason to use expedited grace periods in CPU-hotplug notifiers, it will be necessary to avoid disabling CPU hotplug. This would introduce some complexity, so there had better be a very good reason.
The tradeoff between grace-period latency on the one hand and interruptions of other CPUs on the other hand may need to be re-examined. The desire is of course for zero grace-period latency as well as zero inter-processor interrupts undertaken during an expedited grace period operation. While this ideal is unlikely to be achievable, it is quite possible that further improvements can be made.
The multiprocessor implementations of RCU use a combining tree that groups CPUs so as to reduce lock contention and increase cache locality. However, this combining tree does not spread its memory across NUMA nodes nor does it align the CPU groups with hardware features such as sockets or cores. Such spreading and alignment is currently believed to be unnecessary because the hot-path read-side primitives do not access the combining tree, nor does call_rcu() in the common case. If you believe that your architecture needs such spreading and alignment, then your architecture should also benefit from the rcutree.rcu_fanout_leaf boot parameter, which can be set to the number of CPUs in a socket, NUMA node, or whatever. If the number of CPUs is too large, use a fraction of the number of CPUs. If the number of CPUs is a large prime number, well, that certainly is an “interesting” architectural choice. More flexible arrangements might be considered, but only if rcutree.rcu_fanout_leaf has proven inadequate, and only if the inadequacy has been demonstrated by a carefully run and realistic system-level workload.
Please note that arrangements that require RCU to remap CPU numbers will require extremely good demonstration of need and full exploration of alternatives.
There is an embarrassingly large number of flavors of RCU, and this number has been increasing over time. Perhaps it will be possible to combine some at some future date.
RCU's various kernel threads are reasonably recent additions. It is quite likely that adjustments will be required to more gracefully handle extreme loads. It might also be necessary to be able to relate CPU utilization by RCU's kernel threads and softirq handlers to the code that instigated this CPU utilization. For example, RCU callback overhead might be charged back to the originating call_rcu() instance, though probably not in production kernels.
Summary
This document has presented more than two decade's worth of RCU requirements. Given that the requirements keep changing, this will not be the last word on this subject, but at least it serves to get an important subset of the requirements set forth.
Acknowledgments
I am grateful to Steven Rostedt, Lai Jiangshan, Ingo Molnar, Oleg Nesterov, Borislav Petkov, Peter Zijlstra, and Andy Lutomirski for their help in rendering this article human readable, and to Michelle Rankin for her support of this effort.
Answer to the quick quiz
Quick Quiz 14: So what happens with synchronize_rcu() during scheduler initialization for CONFIG_PREEMPT=n kernels?
Answer: In CONFIG_PREEMPT=n kernels, synchronize_rcu() maps directly to synchronize_sched(). Therefore, synchronize_rcu() works normally throughout boot in CONFIG_PREEMPT=n kernels. However, the code must work in CONFIG_PREEMPT=y kernels, so it is still necessary to avoid invoking synchronize_rcu() during scheduler initialization.
Patches and updates
Kernel trees
Architecture-specific
Core kernel code
Device drivers
Device driver infrastructure
Documentation
Filesystems and block I/O
Memory management
Networking
Security-related
Virtualization and containers
Miscellaneous
Page editor: Jonathan Corbet
Distributions
What's coming in Fedora 23
The Fedora 23 schedule calls for an alpha release on August 11, followed, eventually, by the final release on October 27. It is traditional for Fedora schedules to slip, but that hasn't happened yet — Fedora 23 alpha came out right on schedule. As usual, a lot has been happening in the Fedora community; here we'll look at some of the highlights from this development cycle.
Security-related changes
There are a few security-oriented changes in this release; the first of them is a one-line change, but it has a wide impact. The RPM build rules have been tweaked to cause all packages to be built as position-independent code. That allows address-space layout randomization to be performed when the resulting binaries are executed, making those programs more resistant to canned exploit attempts. Position-independent builds have been recommended for some time, but many packagers did not follow that recommendation; the new build flags are a way of strengthening that recommendation.
There were some concerns about runtime performance penalties associated
with this change, but that does not appear to be a real issue. The benefit
remains to be seen; the feature page optimistically suggests that
"
Another simple change disables the use of the SSL3 protocol and RC4
cipher in the GnuTLS and OpenSSL libraries. Hopefully there are few
systems out there using these obsolete and insecure features; those that
are will not work properly under Fedora 23 and should be updated.
Finally, and most controversially, the distribution will have a new standardized
password policy. The password-strength issue came up earlier
this year, when the Anaconda installer started requiring "strong"
passwords to be set during the installation phase. The Fedora developers
backed off in response to the ensuing outcry and started on the task of figuring out what the
password policy should be. Now we are seeing the results of that work.
Technically, the new scheme does not require strong passwords; instead, it
puts in place a mechanism for describing requirements on passwords so that
every application that deals with them applies the same policy. The actual
policy decisions are left to the various working groups. There is a default policy,
though; it requires at least eight characters and a passing score from libpwquality. That is
the same requirement as the one that caused a fuss back in January.
The Workstation group is in charge of the desktop version of the
distribution, so its policies are likely to be especially visible to a
broad range of Fedora users. This group has, as announced by Michael Catanzaro, begun to
establish a policy that will differ somewhat from the default. In
particular, while the quality requirements will not go away altogether, it
looks like they will be weakened a bit. The guiding philosophy is:
So the length requirement may be shortened, and the libpwquality check may
be disabled entirely. There is talk of somehow requiring stronger
passwords before the SSH service can be turned on, but it is not clear what
the requirements would be or how they would be enforced.
As Michael notes: "
What the other Fedora flavors will do regarding passwords is not yet
entirely clear.
One change that is likely to be visible to many Fedora users is the shift to
Python 3 as the default version of the Python language. That
means that, if a shipped Fedora release only has one version of Python, it
will be Python 3; Python 2 will be an add-on if needed. The plan
calls for the Workstation release, among others, to have Python 3 as
the only Python interpreter. For that to happen, all
Python-using applications shipped with the distribution should use
Python 3; requiring
Python 2 is seen as a bug (albeit one that cannot yet be fixed for
many important applications). Python 2 will remain available, of
course, and, if /usr/bin/python exists, it will point to
Python 2. Support for the older version of the language will not be
going away anytime soon, but the focus is slowly shifting to Python 3.
The Python shift was one of the driving forces behind the DNF package manager;
it works with Python 3, while Yum does not. In Fedora 23, DNF
will gain the ability to perform full system upgrades, absorbing the
"Fedup" tool in the process. DNF has had a few teething problems, so the
prospect of using it for system upgrades may be unnerving for some, but, in
your editor's experience, the tool seems to be solid and is getting
better.
Project Atomic is an effort to
create an operating system for containerized applications. Fedora has
supported this effort via the "Fedora Atomic Host" variant of the
distribution for the last year, but there is a problem: the six-month
Fedora release cycle is far too slow for the fast-moving Atomic project.
So, perhaps even before the Fedora 23 release is out, the Fedora
project will start making
Atomic releases every two weeks. At some point, the Atomic releases
might become the primary product from the Cloud working group, but Atomic is
apparently too fast-moving and focused for that now. This release probably
will become the base upon which the Atomic project does its development
work.
There will also be a
new version of Fedora built as a layered image for Docker deployments.
Fans of the Cinnamon desktop
environment will be glad to see that, with Fedora 23, there will be a
separate spin that sets up Cinnamon from the outset. The Unicode 8
standard will be supported, bringing the latest in emoji (and more) to
Fedora users. Work continues on getting Wayland ready for use, but it will
not be replacing X11 in this release.
Almost everything else in the distribution will be updated,
as is usual with Fedora.
To summarize: the Fedora developers have been busy in this development
cycle. Fedora 23 appears to be another in a long series of releases
adding interesting new functionality and, for better or for worse, pushing
users toward more secure practices. For the next couple of months, the
project will be looking for users to test this release and report bugs so
that they can be fixed. Should the project surprise us all and not slip
its schedule, Fedora 23 final will be ready at the end of October.
Fedora users might notice less successful attacks on their
systems
", but, unless the current security situation is far worse than
the Fedora community has let on, that's the one thing users are highly
likely not to notice.
Keep in mind that we've
established that pwquality is not very good at rating password
strength
" — not exactly a ringing endorsement.
Other changes of note
Brief items
Distribution quote of the week
CentOS Linux 6.7 released
CentOS Linux 6.7 has been released for x86 and x86_64. "There are many fundamental changes in this release, compared with the past CentOS Linux 6 releases, and we highly recommend everyone study the upstream Release Notes as well as the upstream Technical Notes about the changes and how they might impact your installation. (See the 'Further Reading' section of the CentOS release notes)."
FreedomBox 0.5 Released
FreedomBox is a "community project to develop, design and promote personal servers running free software for private, personal, communications". Version 0.5 has been released. See the release notes for details.
Kali Linux 2.0 released
Kali Linux is a Debian-based distribution oriented toward penetration testing and related tasks; the 2.0 release is now available. "There’s a new 4.0 kernel, now based on Debian Jessie, improved hardware and wireless driver coverage, support for a variety of Desktop Environments (gnome, kde, xfce, mate, e17, lxde, i3wm), updated desktop environment and tools – and the list goes on. But these bulletpoint items are essentially a side effect of the real changes that have taken place in our development backend. Ready to hear the real news? Take a deep breath, it’s a long list." At the top of that list is that Kali is now a rolling distribution.
Ubuntu 14.04.3 LTS released
The third update to the 14.04 Long Term Support release is available for Desktop, Server, Cloud, and Core products, as well as other flavors of Ubuntu with long-term support. "We have expanded our hardware enablement offering since 12.04, and with 14.04.3, this point release contains an updated kernel and X stack for new installations to support new hardware across all our supported architectures, not just x86."
Distribution News
CentOS
New CentOS releases
CentOS has released the live CD/DVD of CentOS 6.7. "The CentOS-6.7 LiveDVD and LiveCD are meant to be a Linux environment suited to be run directly from either Optical media or USB storage devices. It does not need any persistent storage on a machine, which also makes it a suitable recovery environment."
CentOS 7-1507 has also been released.
"The rolling builds are a point in time snapshot of a given CentOS
version including all updates on mirror.centos.org. This includes all
all security, bugfix, enhancement and general updates for CentOS Linux,
in this case they include updates up to and including July 28th, 2015.
"
Debian GNU/Linux
Bits from the Debian Installer release manager
Cyril Brulebois has a few bits about the Debian "Stretch" installer. "Many components are used to build the installer, but some of them are not specific to it (e.g. cairo, libx11, xorg-server); they just happen to build one or more udeb packages (packages to be used within the installer). Since the release process of the installer usually takes some days to get everything ready, it is both possible and likely to have a few such packages migrating to testing while details are being polished. Such updates sometimes cause behavorial changes or even regressions. While those are being documented/fixed, some more packages can be sneaking into testing, causing more surprises, and longer cycles. That's why I'm going to use “block-udeb” hints to prevent the migration of all udeb-producing packages during the final preparation of the installer releases."
Newsletters and articles of interest
Distribution newsletters
- DistroWatch Weekly, Issue 622 (August 10)
- 5 things in Fedora this week (August 7)
- Tails report (July)
- Ubuntu Weekly Newsletter, Issue 429 (August 9)
Page editor: Rebecca Sobol
Development
Working with xdg-app application bundles
One of the oft-recurring topics at GUADEC 2015 was the xdg-app application-packaging system currently being developed. Xdg-app's lead developer Alexander Larsson gave a presentation on its current status on the first day, and it featured prominently in Christian Hergert's keynote about reaching new developers as well as in Bastien Nocera's talk about hardware enablement. Perhaps the most practical discussion of the subject, however, came in Stephan Bergmann's talk about his recent attempts to bundle LibreOffice into an xdg-app package.
Bundles
By way of background, xdg-app is a scheme for bundling individual applications into isolated, standalone packages that can be safely installed on any Linux distribution. The packaged application is isolated from the running system by way of namespaces, control groups, and other standard Linux technologies; the plan is for xdg-app to provide a fully sandboxed environment as well—to secure the host system against misbehavior by the application and to secure applications against one another, although this aspect of the plan is still in development.
Key to xdg-app's success will be xdg "runtimes" that are, in a sense, special-purpose application bundles that provide a base level of services and libraries intended for other app bundles to utilize. The plan is for future GNOME releases to be published as runtimes and, since they will be isolated from one another, it will possible for the GNOME 3.20 and (say) GNOME 3.24 runtimes to coexist on a single system. Applications that need one or another specific runtime never even need be aware whether their target runtime is the latest version—nor what the underlying distribution is.
Larsson gave a recap of the latest developments in xdg-app. At the moment, one of the bigger concerns is defining and implementing the suite of system services that a bundled app can use to do meaningful tasks while inside of its sandbox. "Setting up a sandbox is easy," he said; "actually doing something in a sandbox is harder." The xdg-app approach is for the app to "request that a hole be poked in the sandbox" by the system. The host system will define a set of services (network access, file access, printer access, IPC access, and so forth). When a bundled app needs to, say, open a file, the host system will prompt the user to approve or cancel the access (in the file case, for example, by showing a file-chooser dialog).
The team refers to the various services that mediate these requests as "portals." Wayland and PulseAudio are the portals for graphics and audio, a filtered D-Bus service will be the IPC portal, and so on. Several of the portals have yet to be fleshed out and require some more development—such as the printing and geolocation portals. Some of them have not quite been defined yet—it seems clear that users will want a "sharing" portal akin to the ones on iOS and Android (to send files to mobile devices or post material to social media), but its exact make-up is still an open question.
An audience member asked how app bundles request the permissions they want. Larsson replied that they do not—"it's not like Android," he said, where permissions are requested at install time. The portals are designed to trap all requests in a firewall-like (i.e., "deny by default") manner and let the user make the decisions interactively. Larsson invited those interested in further exploring the idea to follow the xdg-app mailing list and to visit the SandboxedApps section of the GNOME wiki.
Office in a box
On August 9, Bergmann, a LibreOffice developer working at Red Hat, presented his results from attempting to bundle LibreOffice with xdg-app. LibreOffice is a complex beast: the project is several million lines of code, has hundreds of submodules and dependencies, and is complex enough that it can break almost any toolchain. "Most of my time with LibreOffice is spent breaking compiler plugins" by triggering corner cases with LibreOffice builds, he commented. Linux is a special challenge because distributions compile and package LibreOffice separately with different configurations—and yet users still want a button they can press on the LibreOffice web site to download the latest release.
The project's current approach is to provide a crippled, somewhat restricted Linux download in both Debian and RPM format. That version uses an old version of GTK+, an old virtual filesystem library, and is missing several optimizations.
Thus, the benefits of xdg-app for LibreOffice are enormous, he said. If the project could provide a cross-distribution xdg-app bundle, that would save LibreOffice developers considerable hassle. In addition, he said, opening strange office files is one of the most common malware vectors, so using xdg-app's sandboxing feature would offer LibreOffice users valuable protection.
There were a handful of up-front challenges to building LibreOffice into an xdg-app bundle, Bergmann said. For starters, the xdg-app SDK is based on Yocto, which is "somewhat obscure" and can be difficult for people not used to embedded development. But Yocto also lacks some necessary packages, like Mesa's GLU or Perl's Archive::Zip module, which is employed during the LibreOffice build process. He also discovered that the Yocto layer's xml-config was hard-coded to always return an exit status of 1, which meant all calls to it failed. Bergmann fixed most of these problems, in some cases by modifying the Yocto side and in others by modifying LibreOffice.
He then set out to find which combination of the over 300 configuration switches in LibreOffice were necessary to build for xdg-app. Some things had to be disabled, such as printing, which is not yet supported in xdg-app. He also removed Java (which is used by the database modules and several extensions), and had to configure the build for GStreamer 1.0 (as opposed to GStreamer 0.10, which is another LibreOffice compile-time option). All told, he said, he had to remove about 30 libraries.
The build he came up with is X11-only and includes only the English localization. The project has not decided whether bundling every localization into one package is a good idea or not; his English-only package weighed in at 350MB already, whereas the every-language-included versions built for Windows are "monster sized" by comparison.
The process took time, but Bergmann eventually did successfully build a LibreOffice xdg-app bundle, which he then demonstrated. The look and feel is identical to a standard LibreOffice window, as one would expect—until one tries to open a file. At that point, all the app bundle sees is an empty home directory, since the file-access portal is not implemented.
On that point, he noted that the permissions model seems clear: if the user opens a file through the file chooser, that should be interpreted by the host system as implicitly granting the bundled app permission to read and write the file. But it turns out that LibreOffice has a more complicated of a model of its own. For example, LibreOffice creates lock files to prevent multiple users from editing the same file simultaneously; this breaks when xdg-app has sandboxed the program: LibreOffice tries and fails to create a lock file, then opens the requested file in read-only mode.
There are some other open questions already, he added, such as how to handle opening files by URL—which LibreOffice supports, but which uses a different code path than local-file access. The program also takes pains not to have more than one instance running at a time for any given user; the first LibreOffice process opens a socket, and any subsequent instances launched communicate with it. How to implement this in xdg-app requires some exploration. So do printing and offline help content, he added—but, all things considered, the experiment was a successful one. Simpler packaging is good, he concluded.
Obviously LibreOffice is only capable of providing one data point, but it is a large and complex point (if that does not stretch the metaphor too far), and is certainly a critical application for a great many users. Xdg-app has the potential to change Linux packaging for several classes of project and software packager: distributions, independent vendors, large project families, and so on. The mostly successful LibreOffice experiments certainly seems to bode well for xdg-app's prospects for third-party application vendors.
[The author would like to thank the GNOME Foundation for travel assistance to attend GUADEC 2015.]
Brief items
Quotes of the week
Firefox 39.0.3 is out
Firefox 39.0.3 has been released. This update contains exactly one change: a fix for the recently reported PDF vulnerability that is being actively exploited on the net.Firefox 40 is available
Mozilla has released Firefox 40. There are several new features listed in the release notes such as; improved scrolling, graphics, and video playback performance with off main thread compositing, added protection against unwanted software downloads, a new style for add-on manager based on the in-content preferences style, and an improved graphic blocklist mechanism.Ubuntu One file-syncronization code released
Ubuntu has announced the release of the file-synchronization code behind its "Ubuntu One" service. The release is about as "over-the-wall" as it gets, though: "Will you take patches? In general, no. We won’t have anybody assigned to reviewing and accepting code. We’d encourage interested maintainers to fork the code and build out a community around it."
OpenSSH 7.0
The OpenSSH 7.0 release is out. It fixes a number of problems and adds a few new configuration features, but the main focus of 7.0 is taking things out: "This focus of this release is primarily to deprecate weak, legacy and/or unsafe cryptography." More old crypto is slated for removal in 7.1; see the announcement for the list.
Thor: another free video codec
Cisco, it seems, is unhappy with the patent mess around video codecs, so it has launched a project called "Thor" to make one that can be freely distributed. "The effort is being staffed by some of the world’s most foremost codec experts, including the legendary Gisle Bjøntegaard and Arild Fuldseth, both of whom have been heavy contributors to prior video codecs. We also hired patent lawyers and consultants familiar with this technology area. We created a new codec development process which would allow us to work through the long list of patents in this space, and continually evolve our codec to work around or avoid those patents."
Docker 1.8 released
The 1.8 release of the Docker container system is out, with a number of new features. "Docker Content Trust is a new feature in Docker Engine 1.8 that makes it possible to verify the publisher of Docker images. When a publisher pushes an image to a remote registry, Docker signs the image with a private key. When you later pull this image, Docker uses the publisher’s public key to verify that the image you are about to run is exactly what the publisher created, has not been tampered with, and is up to date."
ncurses 6.0 released
Version 6.0 of the ncurses library has been released. The banner feature of the new release is a new ABI; all existing ncurses-5.x-using programs should be source-compatible. The new ABI includes support for more than 16 colors and more than four mouse buttons—thus enabling mouse-wheel support.
Newsletters and articles
Development newsletters from the past week
- GNU Toolchain Update (August 5)
- LLVM Weekly (August 10)
- Perl Weekly (August 10)
- PostgreSQL Weekly News (August 9)
- Python Weekly (August 6)
- This Week In Rust (August 10)
- Ruby Weekly (August 6)
- Tor Weekly News (August 8)
- Wikimedia Tech News (August 10)
Federated Cloud Sharing in ownCloud 8.1 (ownCloud blog)
The ownCloud blog has a post about federated file sharing between ownCloud instances in ownCloud 8.1, but it also looks at the wider view of federation between various kinds of cloud servers. ownCloud founder Frank Karlitschek has a series of posts (It is Time to Federate Our Clouds, The Next Generation File Sync and Share Technology, and The Federated Architecture of Next Generation File Sync and Share) on federation technology and has also proposed a cross-cloud-platform federation API: "In addition, today Frank proposed a draft of a Federated Cloud Sharing API to the Open Cloud Mesh working group with the goal of jump-starting a discussion about what is needed to enable federation between different file sharing implementations. Sharing among ownClouds is great, but the true power of a federated file cloud is available when you can share among different implementations seamlessly, because you all speak the same common language. This is the goal of the Open Cloud Mesh working group (of which ownCloud is a member as well), and outside of that, drafts have been shared with a number of well known standards organizations around web technologies and fellow open source file share and sync projects to get the work started."
Grasch: A Frank Look at Simon: Where To Go From Here
On his blog, Peter Grasch considers the future for the Simon speech-recognition system for KDE. He is passing the torch and will no longer be actively participating in the project, but he spent some time passing on his knowledge and some thoughts on where things might go from here. In addition, he built a working prototype of a speech-based command and control system for the Plasma desktop called Lera. "If anything, Lera is a starting point. The next steps would be to move Simon’s “eventsimulation” library into a separate framework, to be shared between Lera and Simon. Lera could then use this to type out the recognition results (see Simon’s Dictation plugin). Then, I would suggest porting a simplified notion of “Scenarios” to Lera, which should only really contain a set of commands, and maybe context information (vocabulary and “grammar” can be synthesized automatically from the command triggers). The implementation of training (acoustic model adaption) would then complete a very sensible, very usable version 1.0."
Page editor: Nathan Willis
Announcements
Brief items
EuroPython 2015: Videos are online
Videos are available from last month's EuroPython conference. "A total of 173 talk videos were processed, so there’s a lot of interesting content to watch. The talk videos are also embedded into the talk pages referenced in our session list for easy navigation."
KDE Sprints 2015 fundraising
KDE has started raising funds for the 2015 Randa Meeting. "The week-long Randa Meetings have been intense and productive, generating exceptional results. Expectations are high again this year. Most importantly, the Randa Meetings have produced significant breakthroughs that benefit all KDE software users and developers." The theme of the 2015 Randa Meeting is "Bring Touch to KDE".
Calls for Presentations
CFP Deadlines: August 13, 2015 to October 12, 2015
The following listing of CFP deadlines is taken from the LWN.net CFP Calendar.
| Deadline | Event Dates | Event | Location |
|---|---|---|---|
| August 14 | November 7 November 9 |
PyCon Canada 2015 | Toronto, Canada |
| August 16 | November 7 November 8 |
PyCON HK 2015 | Hong Kong, Hong Kong |
| August 17 | November 19 November 21 |
FOSSETCON 2015 | Orlando, Florida, USA |
| August 19 | September 16 September 18 |
X.org Developer Conference 2015 | Toronto, Canada |
| August 24 | October 19 October 23 |
Tcl/Tk Conference | Manassas, VA, USA |
| August 31 | November 21 November 22 |
PyCon Spain 2015 | Valencia, Spain |
| August 31 | October 19 October 22 |
Perl Dancer Conference 2015 | Vienna, Austria |
| August 31 | November 5 November 7 |
systemd.conf 2015 | Berlin, Germany |
| August 31 | October 9 | Innovation in the Cloud Conference | San Antonio, TX, USA |
| August 31 | November 10 November 11 |
Open Compliance Summit | Yokohama, Japan |
| September 1 | October 1 October 2 |
PyConZA 2015 | Johannesburg, South Africa |
| September 6 | October 10 | Programistok | Białystok, Poland |
| September 12 | October 10 | Poznańska Impreza Wolnego Oprogramowania | Poznań, Poland |
| September 15 | November 9 November 11 |
PyData NYC 2015 | New York, NY, USA |
| September 15 | November 14 November 15 |
NixOS Conference 2015 | Berlin, Germany |
| September 20 | October 26 October 28 |
Samsung Open Source Conference | Seoul, South Korea |
| September 21 | March 8 March 10 |
Fluent 2016 | San Francisco, CA, USA |
| September 25 | December 5 December 6 |
openSUSE.Asia Summit | Taipei, Taiwan |
| September 27 | November 9 November 11 |
KubeCon | San Francisco, CA, USA |
| September 28 | November 14 November 15 |
PyCon Czech 2015 | Brno, Czech Republic |
| September 30 | November 28 | Technical Dutch Open Source Event | Eindhoven, The Netherlands |
| September 30 | November 7 November 8 |
OpenFest 2015 | Sofia, Bulgaria |
| September 30 | December 27 December 30 |
32. Chaos Communication Congress | Hamburg, Germany |
| October 1 | April 4 April 6 |
Web Audio Conference | Atlanta, GA, USA |
| October 2 | October 29 | FOSS4G Belgium 2015 | Brussels, Belgium |
| October 2 | December 8 December 9 |
Node.js Interactive | Portland, OR, USA |
If the CFP deadline for your event does not appear here, please tell us about it.
Upcoming Events
Events: August 13, 2015 to October 12, 2015
The following event listing is taken from the LWN.net Calendar.
| Date(s) | Event | Location |
|---|---|---|
| August 8 August 14 |
DebCamp15 | Heidelberg, Germany |
| August 12 August 15 |
Flock | Rochester, New York, USA |
| August 13 August 17 |
Chaos Communication Camp 2015 | Mildenberg (Berlin), Germany |
| August 15 August 22 |
DebConf15 | Heidelberg, Germany |
| August 15 August 16 |
I2PCon | Toronto, Canada |
| August 15 August 16 |
Conference for Open Source Coders, Users, and Promoters | Taipei, Taiwan |
| August 16 August 23 |
LinuxBierWanderung | Wiltz, Luxembourg |
| August 17 August 19 |
LinuxCon North America | Seattle, WA, USA |
| August 19 August 21 |
Linux Plumbers Conference | Seattle, WA, USA |
| August 19 August 21 |
KVM Forum 2015 | Seattle, WA, USA |
| August 20 August 21 |
Linux Security Summit 2015 | Seattle, WA, USA |
| August 20 | Tracing Summit | Seattle, WA, USA |
| August 20 August 21 |
MesosCon | Seattle, WA, USA |
| August 21 | Unikernel Users Summit at Texas Linux Fest | San Marcos, TX, USA |
| August 21 | Golang UK Conference | London, UK |
| August 21 August 22 |
Texas Linux Fest | San Marcos, TX, USA |
| August 22 August 23 |
Free and Open Source Software Conference | Sankt Augustin, Germany |
| August 22 | FOSSCON 2015 | Philadelphia, PA, USA |
| August 28 September 3 |
ownCloud Contributor Conference | Berlin, Germany |
| August 29 | EmacsConf 2015 | San Francisco, CA, USA |
| September 2 September 6 |
End Summer Camp | Forte Bazzera (VE), Italy |
| September 10 September 12 |
FUDcon Cordoba | Córdoba, Argentina |
| September 10 September 13 |
International Conference on Open Source Software Computing 2015 | Amman, Jordan |
| September 11 September 13 |
vBSDCon 2015 | Reston, VA, USA |
| September 15 September 16 |
verinice.XP | Berlin, Germany |
| September 16 September 18 |
X.org Developer Conference 2015 | Toronto, Canada |
| September 16 September 18 |
PostgresOpen 2015 | Dallas, TX, USA |
| September 19 September 20 |
WineConf 2015 | Vienna, Austria |
| September 21 September 23 |
Octave Conference 2015 | Darmstadt, Germany |
| September 21 September 25 |
Linaro Connect San Francisco 2015 | San Francisco, CA, USA |
| September 22 September 23 |
Lustre Administrator and Developer Workshop 2015 | Paris, France |
| September 22 September 24 |
NGINX Conference | San Francisco, CA, USA |
| September 23 September 25 |
Surge 2015 | National Harbor, MD, USA |
| September 23 September 25 |
LibreOffice Conference | Aarhus, Denmark |
| September 24 | PostgreSQL Session 7 | Paris, France |
| September 25 September 27 |
PyTexas 2015 | College Station, TX, USA |
| September 28 September 30 |
Nagios World Conference 2015 | Saint Paul, MN, USA |
| September 28 September 30 |
OpenMP Conference | Aachen, Germany |
| September 29 September 30 |
Open Source Backup Conference 2015 | Cologne, Germany |
| September 30 October 2 |
Kernel Recipes 2015 | Paris, France |
| October 1 October 2 |
PyConZA 2015 | Johannesburg, South Africa |
| October 2 October 3 |
Ohio LinuxFest 2015 | Columbus, OH, USA |
| October 2 October 4 |
PyCon India 2015 | Bangalore, India |
| October 5 October 7 |
LinuxCon Europe | Dublin, Ireland |
| October 5 October 7 |
Qt World Summit 2015 | Berlin, Germany |
| October 5 October 7 |
Embedded Linux Conference Europe | Dublin, Ireland |
| October 8 | OpenWrt Summit | Dublin, Ireland |
| October 8 October 9 |
CloudStack Collaboration Conference Europe | Dublin, Ireland |
| October 8 October 9 |
GStreamer Conference 2015 | Dublin, Ireland |
| October 9 | Innovation in the Cloud Conference | San Antonio, TX, USA |
| October 10 | Poznańska Impreza Wolnego Oprogramowania | Poznań, Poland |
| October 10 | Programistok | Białystok, Poland |
| October 10 October 11 |
OpenRISC Conference 2015 | Geneva, Switzerland |
If your event does not appear here, please tell us about it.
Page editor: Rebecca Sobol
