Skip to main navigation Skip to search Skip to main content

What You Get is What You C: Controlling Side Effects in Mainstream C Compilers

Laurent Simon, David Chisnall, Ross Anderson

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Security engineers have been fighting with C compilers for years. A careful programmer would test for null pointer dereferencing or division by zero; but the compiler would fail to understand, and optimize the test away. Modern compilers now have dedicated options to mitigate this. But when a programmer tries to control side effects of code, such as to make a cryptographic algorithm execute in constant time, the problem remains. Programmers devise complex tricks to obscure their intentions, but compiler writers find ever smarter ways to optimize code. A compiler upgrade can suddenly and without warning open a timing channel in previously secure code. This arms race is pointless and has to stop. We argue that we must stop fighting the compiler, and instead make it our ally. As a starting point, we analyze the ways in which compiler optimization breaks implicit properties of crypto code; and add guarantees for two of these properties in Clang/LLVM. Our work explores what is actually involved in controlling side effects on modern CPUs with a standard toolchain. Similar techniques can and should be applied to other security properties; achieving intentions by compiler commands or annotations makes them explicit, so we can reason about them. It is already understood that explicitness is essential for cryptographic protocol security and for compiler performance; it is essential for language security too. We therefore argue that this should be only the first step in a sustained engineering effort.
Original languageEnglish
Title of host publication2018 IEEE European Symposium on Security and Privacy (EuroS P)
PublisherInstitute of Electrical and Electronics Engineers
Pages1-15
Number of pages15
ISBN (Electronic)978-1-5386-4228-3, 978-1-5386-4227-6
ISBN (Print)978-1-5386-4229-0
DOIs
Publication statusPublished - 9 Jul 2018
Event3rd IEEE European Symposium on Security and Privacy - London, United Kingdom
Duration: 24 Apr 201826 Apr 2018
Conference number: 3
https://www.ieee-security.org/TC/EuroSP2018/index.php

Conference

Conference3rd IEEE European Symposium on Security and Privacy
Abbreviated titleEuro S and P 2018
Country/TerritoryUnited Kingdom
CityLondon
Period24/04/1826/04/18
Internet address

Keywords / Materials (for Non-textual outputs)

  • compilers
  • LLVM
  • Clang
  • compiler optimizations
  • side channels
  • cryptography
  • side effects
  • C
  • C abstract machine
  • constant-time
  • zeroing
  • erasing
  • stack

Fingerprint

Dive into the research topics of 'What You Get is What You C: Controlling Side Effects in Mainstream C Compilers'. Together they form a unique fingerprint.

Cite this