skip to main content
10.1145/2818302.2818306acmconferencesArticle/Chapter ViewAbstractPublication PagessospConference Proceedingsconference-collections
research-article

Ownership is theft: experiences building an embedded OS in rust

Published:04 October 2015Publication History

ABSTRACT

Rust, a new systems programming language, provides compile-time memory safety checks to help eliminate runtime bugs that manifest from improper memory management. This feature is advantageous for operating system development, and especially for embedded OS development, where recovery and debugging are particularly challenging. However, embedded platforms are highly event-based, and Rust's memory safety mechanisms largely presume threads. In our experience developing an operating system for embedded systems in Rust, we have found that Rust's ownership model prevents otherwise safe resource sharing common in the embedded domain, conflicts with the reality of hardware resources, and hinders using closures for programming asynchronously. We describe these experiences and how they relate to memory safety as well as illustrate our workarounds that preserve the safety guarantees to the largest extent possible. In addition, we draw from our experience to propose a new language extension to Rust that would enable it to provide better memory safety tools for event-driven platforms.

References

  1. Rust issue: "borrowck is unsound in the presence of &'static muts". https://github.com/rust-lang/rust/issues/27616.Google ScholarGoogle Scholar
  2. The Rust programming language. http://www.rust-lang.org.Google ScholarGoogle Scholar
  3. Adya, A., Howell, J., Theimer, M., Bolosky, W. J., and Douceur, J. R. Cooperative task management without manual stack management. In Proceedings of the General Track of the Annual Conference on USENIX Annual Technical Conference (Berkeley, CA, USA, 2002), ATEC '02, USENIX Association, pp. 289--302. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bershad, B. N., Chambers, C., Eggers, S., Maeda, C., McNamee, D., Pardyak, P., Savage, S., and Sirer, E. G. Spin--an extensible microkernel for application-specific operating system services. ACM SIGOPS Operating Systems Review 29, 1 (1995), 74--77. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Bonwick, J., et al. The slab allocator: An object-caching kernel memory allocator. In USENIX summer (1994), vol. 16, Boston, MA, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Cardelli, L., Donahue, J., Jordan, M., Kalsow, B., and Nelson, G. The modula--type system. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (New York, NY, USA, 1989), POPL '89, ACM, pp. 202--212. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Chen, H., Mao, Y., Wang, X., Zhou, D., Zeldovich, N., and Kaashoek, M. F. Linux kernel vulnerabilities: State-of-the-art defenses and open problems. In Proceedings of the Second Asia-Pacific Workshop on Systems (2011), ACM, p. 5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Clarke, D., and Wrigstad, T. External uniqueness is unique enough. ECOOP 2003--Object-Oriented Programming (2003), 59--67.Google ScholarGoogle ScholarCross RefCross Ref
  9. Hunt, G. C., and Larus, J. R. Singularity: Rethinking the software stack. ACM SIGOPS Operating Systems Review 41, 2 (April 2007), 37--49. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Levis, P., Madden, S., Polastre, J., Szewczyk, R., Whitehouse, K., Woo, A., Gay, D., Hill, J., Welsh, M., Brewer, E., and Culler, D. TinyOS: An operating system for sensor networks. In Ambient Intelligence, W. Weber, J. Rabaey, and E. Aarts, Eds. Springer Berlin Heidelberg, 2005, pp. 115--148.Google ScholarGoogle Scholar
  11. Motor Industry Software Reliability Association, et al. MISRA-C: 2012: Guidelines for the Use of the C Language in Critical Systems. MIRA, 2013.Google ScholarGoogle Scholar
  12. Swift, M. M., Martin, S., Levy, H. M., and Eggers, S. J. Nooks: An architecture for reliable device drivers. In Proceedings of the 10th workshop on ACM SIGOPS European workshop (2002), ACM, pp. 102--107. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Terei, D., Marlow, S., Peyton Jones, S., and Mazières, D. Safe haskell. In Proceedings of the 2012 Haskell Symposium (New York, NY, USA, 2012), Haskell '12, ACM, pp. 137--148. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Tov, J. A., and Pucella, R. Practical affine types. In Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (New York, NY, USA, 2011), POPL '11, ACM, pp. 447--458. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Ownership is theft: experiences building an embedded OS in rust

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Conferences
        PLOS '15: Proceedings of the 8th Workshop on Programming Languages and Operating Systems
        October 2015
        50 pages
        ISBN:9781450339421
        DOI:10.1145/2818302
        • Program Chair:
        • Shan Lu

        Copyright © 2015 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 4 October 2015

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        PLOS '15 Paper Acceptance Rate7of16submissions,44%Overall Acceptance Rate17of32submissions,53%

        Upcoming Conference

        SOSP '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader