From 0a89fbeebb0885883596bf3c12ff836a3f044f88 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 28 Nov 2024 19:45:11 -0800 Subject: [PATCH 01/11] add WIP nlnet grant proposal --- src/SUMMARY.md | 2 ++ src/grants/index.md | 1 + src/grants/nlnet-first.md | 62 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/grants/index.md create mode 100644 src/grants/nlnet-first.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index b3d79d5..8f2ce4d 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -1,6 +1,8 @@ * [Libre-Chip](README.md) * [Proposal for Libre-Chip's First CPU Architecture](first_arch/index.md) * [Register Renaming](first_arch/register_renaming.md) + * [Grants](grants/index.md) + * [First NLNet Grant Proposal](grants/nlnet-first.md) * [Conduct](Conduct.md) * [License](LICENSE.md) * [GPL 3.0](gpl-3.0.md) diff --git a/src/grants/index.md b/src/grants/index.md new file mode 100644 index 0000000..6533138 --- /dev/null +++ b/src/grants/index.md @@ -0,0 +1 @@ +# Grants diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md new file mode 100644 index 0000000..4c7fd51 --- /dev/null +++ b/src/grants/nlnet-first.md @@ -0,0 +1,62 @@ +# First NLNet Grant Proposal -- First CPU Architecture And Formal Proof of No Spectre bugs + +Project Name: Libre-Chip's First CPU Architecture And Formal Proof of No Spectre bugs + +Website/Wiki: + +# Abstract + +Modern CPUs suffer from a [constant stream of new speculative-execution security flaws](https://en.wikipedia.org/wiki/Transient_execution_CPU_vulnerability#Timeline) ([Spectre](https://meltdownattack.com/)-style bugs), additionally software has to constantly add more convoluted and slow mitigations to properly inforce security boundaries, such as a WebAssembly VM needing to add code to prevent leaking data from outside the VM to whatever programs are running inside the VM, or a web browser needing to stop JavaScript code from seeing memory that it should not have access to. + +To address this major category of CPU flaws, Jacob Lifshay invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks -- this should work for nearly any kind of CPU design. + +We are working towards building a high-performance superscalar CPU with speculative execution and working on proving that it doesn't suffer from any speculative-execution data leaks, thereby demonstrating that this major category of CPU flaws can be fixed once and for all without crippling CPU performance. + +## Relevant Previous Involvement + +* Jacob Lifshay -- TODO + +* Others... TODO + +# Requested support + +Requested Amount €50000 + +## Cost Explanation + +Nearly all of the cost is for labor, with some amount set aside for general project management (e.g. tracking funding, server maintenance, etc.), and for hardware costs such as buying bigger FPGAs so the CPU design will fit. + +TODO, come up with estimated budgets. + +## Compare with existing/historical efforts + +# UPEC, as described in "An Exhaustive Approach to Detecting Transient Execution Side Channels in RTL Designs of Processors" + + + +According to , UPEC is limited in that it only works on a specific conservative mechanism (preventing speculative load instructions from executing untill all prior branches are resolved). Jacob Lifshay's idea, by contrast, should work even if the CPU runs speculative loads before resolving branches, with much less stringient conditions on those loads. + +# "RTL Verification for Secure Speculation Using Contract Shadow Logic" + + + +TODO + +## Technical challenges we expect to solve during the project + +We expect to solve 2 technical challenges: + +* To create a working OoO Superscalar CPU with Speculative Execution. +* To make substantial progress on creating a formal proof that the CPU doesn't have any Spectre-style vulnerabilities. This is complex enough and has enough potential problems we may run into that we may not finish by the end of this grant, and may need additional grants afterward to finish, hence why the goal is making substantial progress instead of having the proof 100% complete and working. + +To address this general category of CPU flaws, I (Jacob Lifshay) invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks: + +1. Assume that to leak data, you must be able to observe some change in the digital signals going from/to the CPU core that depends on the results (defined to include any side-effects that change any state, such as cache state changes or branch predictor changes) of some transient instructions (instructions that were speculatively executed and then canceled). +2. Take the concrete cycle-accurate CPU design, and construct a theoretical equivalent that has the additional feature of looking into the future to determine which instructions will be canceled and preemptively forces their results to be zeros (or any other value that doesn't depend on transient instructions' data; since we're doing math here, we don't have to limit ourselves to physically possible designs that respect time flow). The reasoning is that if all transient instructions' results are always zeros, they can't possibly be leaking any useful data, therefore the theoretical equivalent CPU design doesn't have any speculative-execution data leaks. +3. Formally prove that all digital signals from/to the concrete CPU core always exactly match the timing and data in all respects of the theoretical equivalent CPU design. This proves that the concrete CPU core can't have any speculative-execution data leaks. + +It is expected that automated formal proof software (stuff like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. Fayalite is a HDL software library that we have been developing since around April 2024 that targets the FIRRTL intermediate language (used by the Chisel ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of LLVM Circt, so is well maintained). + +## Ecosystem + +TODO From 3c95a139950b5ccafdc3531eb8ffd35a27d4d474 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 28 Nov 2024 19:50:21 -0800 Subject: [PATCH 02/11] add TODO european dimension --- src/grants/nlnet-first.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index 4c7fd51..f4003c1 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -60,3 +60,5 @@ It is expected that automated formal proof software (stuff like SMT solvers such ## Ecosystem TODO + +TODO European dimension? benefits people everywhere by having CPUs with better security, including Europeans. From 67d6d929e41246ee7fc3da24f3a0460c18596b6b Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 28 Nov 2024 21:09:23 -0800 Subject: [PATCH 03/11] fix subheader sizes --- src/grants/nlnet-first.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index f4003c1..e76cf45 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -30,13 +30,13 @@ TODO, come up with estimated budgets. ## Compare with existing/historical efforts -# UPEC, as described in "An Exhaustive Approach to Detecting Transient Execution Side Channels in RTL Designs of Processors" +### UPEC, as described in "An Exhaustive Approach to Detecting Transient Execution Side Channels in RTL Designs of Processors" According to , UPEC is limited in that it only works on a specific conservative mechanism (preventing speculative load instructions from executing untill all prior branches are resolved). Jacob Lifshay's idea, by contrast, should work even if the CPU runs speculative loads before resolving branches, with much less stringient conditions on those loads. -# "RTL Verification for Secure Speculation Using Contract Shadow Logic" +### "RTL Verification for Secure Speculation Using Contract Shadow Logic" From 007421bcd8a27b882ff2a202f983d7861ef7c05f Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 29 Nov 2024 14:43:15 -0800 Subject: [PATCH 04/11] fill out most sections of NLNet grant proposal --- src/grants/nlnet-first.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index e76cf45..b929dc2 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -6,7 +6,7 @@ Website/Wiki: # Abstract -Modern CPUs suffer from a [constant stream of new speculative-execution security flaws](https://en.wikipedia.org/wiki/Transient_execution_CPU_vulnerability#Timeline) ([Spectre](https://meltdownattack.com/)-style bugs), additionally software has to constantly add more convoluted and slow mitigations to properly inforce security boundaries, such as a WebAssembly VM needing to add code to prevent leaking data from outside the VM to whatever programs are running inside the VM, or a web browser needing to stop JavaScript code from seeing memory that it should not have access to. +Modern CPUs suffer from a [constant stream of new speculative-execution security flaws](https://en.wikipedia.org/wiki/Transient_execution_CPU_vulnerability#Timeline) ([Spectre](https://meltdownattack.com/)-style bugs), additionally software has to constantly add more convoluted and slow mitigations to properly enforce security boundaries, such as a WebAssembly VM needing to add code to prevent leaking data from outside the VM to whatever programs are running inside the VM, or a web browser needing to stop JavaScript code from seeing memory that it should not have access to. To address this major category of CPU flaws, Jacob Lifshay invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks -- this should work for nearly any kind of CPU design. @@ -14,7 +14,7 @@ We are working towards building a high-performance superscalar CPU with speculat ## Relevant Previous Involvement -* Jacob Lifshay -- TODO +* Jacob Lifshay -- Worked on designing PowerISA CPUs with Libre-SOC for 5yr, built a simple OoO Superscalar CPU simulator , built a RV32I CPU with VGA output in a few weeks that runs a 2.5D maze game . Also is the main author of the [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) HDL library * Others... TODO @@ -34,19 +34,19 @@ TODO, come up with estimated budgets. -According to , UPEC is limited in that it only works on a specific conservative mechanism (preventing speculative load instructions from executing untill all prior branches are resolved). Jacob Lifshay's idea, by contrast, should work even if the CPU runs speculative loads before resolving branches, with much less stringient conditions on those loads. +According to , UPEC is limited in that it only works on a specific conservative mechanism (preventing speculative load instructions from executing until all prior branches are resolved). by contrast our formal proof method should work even if the CPU runs speculative loads before resolving branches, with much less stringent conditions on those loads. ### "RTL Verification for Secure Speculation Using Contract Shadow Logic" -TODO +Contract Shadow Logic works by assuming that memory is partitioned into secret and non-secret regions, by contrast our formal proof method is based on verifying that no data processed by transient instructions (instructions that were speculatively executed and then canceled) can affect any digital signals that leave the processor. ## Technical challenges we expect to solve during the project We expect to solve 2 technical challenges: -* To create a working OoO Superscalar CPU with Speculative Execution. +* To create a working OoO Superscalar CPU with Speculative Execution, trying to design it such that it doesn't have any Spectre-style vulnerabilities (mostly by doing a better job of tracking any state whatsoever that has speculative modifications). * To make substantial progress on creating a formal proof that the CPU doesn't have any Spectre-style vulnerabilities. This is complex enough and has enough potential problems we may run into that we may not finish by the end of this grant, and may need additional grants afterward to finish, hence why the goal is making substantial progress instead of having the proof 100% complete and working. To address this general category of CPU flaws, I (Jacob Lifshay) invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks: @@ -55,10 +55,10 @@ To address this general category of CPU flaws, I (Jacob Lifshay) invented a way 2. Take the concrete cycle-accurate CPU design, and construct a theoretical equivalent that has the additional feature of looking into the future to determine which instructions will be canceled and preemptively forces their results to be zeros (or any other value that doesn't depend on transient instructions' data; since we're doing math here, we don't have to limit ourselves to physically possible designs that respect time flow). The reasoning is that if all transient instructions' results are always zeros, they can't possibly be leaking any useful data, therefore the theoretical equivalent CPU design doesn't have any speculative-execution data leaks. 3. Formally prove that all digital signals from/to the concrete CPU core always exactly match the timing and data in all respects of the theoretical equivalent CPU design. This proves that the concrete CPU core can't have any speculative-execution data leaks. -It is expected that automated formal proof software (stuff like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. Fayalite is a HDL software library that we have been developing since around April 2024 that targets the FIRRTL intermediate language (used by the Chisel ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of LLVM Circt, so is well maintained). +It is expected that automated formal proof software (stuff like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) is a HDL library written in Rust that we have been developing since around April 2024 that targets the [FIRRTL](https://github.com/chipsalliance/firrtl-spec) intermediate language (used by the [Chisel](https://www.chisel-lang.org/) ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of [LLVM Circt](https://circt.llvm.org/), so is well maintained): ## Ecosystem -TODO +We plan on working with the OpenPower Foundation for any custom ISA extensions we may need. We are already working with the FIRRTL specification GitHub repo to resolve problems we encounter, as well as with LLVM Circt, and with the Rust Language. -TODO European dimension? benefits people everywhere by having CPUs with better security, including Europeans. +This project benefits Europeans (as well as everyone else) by providing a CPU with good performance that doesn't suffer from Spectre-style flaws, as well as working on providing a method of formally proving if any particular CPU design doesn't suffer from Spectre-style flaws, hopefully encouraging CPU designers everywhere to formally prove their CPU designs to not have Spectre-style flaws instead of the reactionary fixes that they have been using that only covers known Spectre-style flaws and has a constant stream of failures. From c60c00243ae145925e5f9236c82dea9ecf06f234 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 29 Nov 2024 14:48:38 -0800 Subject: [PATCH 05/11] add link to WIP high-level CPU design --- src/grants/nlnet-first.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index b929dc2..780b505 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -55,7 +55,9 @@ To address this general category of CPU flaws, I (Jacob Lifshay) invented a way 2. Take the concrete cycle-accurate CPU design, and construct a theoretical equivalent that has the additional feature of looking into the future to determine which instructions will be canceled and preemptively forces their results to be zeros (or any other value that doesn't depend on transient instructions' data; since we're doing math here, we don't have to limit ourselves to physically possible designs that respect time flow). The reasoning is that if all transient instructions' results are always zeros, they can't possibly be leaking any useful data, therefore the theoretical equivalent CPU design doesn't have any speculative-execution data leaks. 3. Formally prove that all digital signals from/to the concrete CPU core always exactly match the timing and data in all respects of the theoretical equivalent CPU design. This proves that the concrete CPU core can't have any speculative-execution data leaks. -It is expected that automated formal proof software (stuff like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) is a HDL library written in Rust that we have been developing since around April 2024 that targets the [FIRRTL](https://github.com/chipsalliance/firrtl-spec) intermediate language (used by the [Chisel](https://www.chisel-lang.org/) ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of [LLVM Circt](https://circt.llvm.org/), so is well maintained): +It is expected that automated formal proof software (stuff like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) is a HDL library written in Rust that we have been developing since around April 2024 that targets the [FIRRTL](https://github.com/chipsalliance/firrtl-spec) intermediate language (used by the [Chisel](https://www.chisel-lang.org/) ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of [LLVM Circt](https://circt.llvm.org/), so is well maintained). + +A WIP high-level design of our CPU: ## Ecosystem From 8fbabfef40f0b46bfc810910b465bdb4c4d2a961 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 29 Nov 2024 15:34:34 -0800 Subject: [PATCH 06/11] add estimated budget --- src/grants/nlnet-first.md | 42 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index 780b505..8a39933 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -26,7 +26,45 @@ Requested Amount €50000 Nearly all of the cost is for labor, with some amount set aside for general project management (e.g. tracking funding, server maintenance, etc.), and for hardware costs such as buying bigger FPGAs so the CPU design will fit. -TODO, come up with estimated budgets. +We're aiming for a rate of somewhere around $69305.60/yr per person which is the minimum salary for small employers for 2025 in Washington State USA (where Jacob Lifshay lives). + +Estimated Budget: + +### General Project Management + +€2000 + +For tracking funding, server maintenance, and similar. + +### Hardware Costs + +€3000 + +For buying bigger FPGAs, CI server hardware improvements, Oscilloscopes (if necessary), and similar. + +### Improvements to Fayalite + +€10000 + +For adding the code for translation to Coq, adding tooling for generating FPGA bitstreams, as well as other improvements to Fayalite as necessary. + +### Building enough of the CPU to execute multiple instructions + +€10000 + +This covers getting register renaming and ALU and/or branch instructions working, as well as other portions of the CPU design as necessary. This may or may not include actually fetching those instructions from memory, instead the instructions may be supplied by a testing harness. + +### Implementing Memory Subsystem + +€15000 + +This covers the rest needed for the CPU to be able to fetch instructions from memory and execute them as well as implementing Load/Store instructions. + +### Work towards the Formal Proof of No Spectre bugs + +€10000 + +This covers working on the Formal Proof of No Spectre bugs as well as improvements to other software/hardware needed for that. ## Compare with existing/historical efforts @@ -46,7 +84,7 @@ Contract Shadow Logic works by assuming that memory is partitioned into secret a We expect to solve 2 technical challenges: -* To create a working OoO Superscalar CPU with Speculative Execution, trying to design it such that it doesn't have any Spectre-style vulnerabilities (mostly by doing a better job of tracking any state whatsoever that has speculative modifications). +* To create a working OoO Superscalar CPU with Speculative Execution, trying to design it such that it doesn't have any Spectre-style vulnerabilities (mostly by doing a better job of tracking any state whatsoever that has speculative modifications). The CPU probably will not yet support some of the features required for high performance (e.g. a complex cache hierarchy) and/or supporting running an operating system and/or floating-point. The plan is to add those features later if they are not completed as part of this grant. * To make substantial progress on creating a formal proof that the CPU doesn't have any Spectre-style vulnerabilities. This is complex enough and has enough potential problems we may run into that we may not finish by the end of this grant, and may need additional grants afterward to finish, hence why the goal is making substantial progress instead of having the proof 100% complete and working. To address this general category of CPU flaws, I (Jacob Lifshay) invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks: From 906907689edf32aade49c4f11e2e41c3e25e8480 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 29 Nov 2024 15:36:00 -0800 Subject: [PATCH 07/11] minor wording adjustment --- src/grants/nlnet-first.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index 8a39933..9fa8ede 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -26,7 +26,7 @@ Requested Amount €50000 Nearly all of the cost is for labor, with some amount set aside for general project management (e.g. tracking funding, server maintenance, etc.), and for hardware costs such as buying bigger FPGAs so the CPU design will fit. -We're aiming for a rate of somewhere around $69305.60/yr per person which is the minimum salary for small employers for 2025 in Washington State USA (where Jacob Lifshay lives). +We're aiming for a rate of somewhere around $69305.60/yr per person which is the minimum salary for small employers for 2025 in Washington State USA (where Jacob Lifshay lives at the time). Estimated Budget: From 4af662dea89b38bd1af1316cf653897d098f52d3 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 29 Nov 2024 16:03:46 -0800 Subject: [PATCH 08/11] wording fixes --- src/grants/nlnet-first.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index 9fa8ede..6a94b9f 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -6,9 +6,9 @@ Website/Wiki: # Abstract -Modern CPUs suffer from a [constant stream of new speculative-execution security flaws](https://en.wikipedia.org/wiki/Transient_execution_CPU_vulnerability#Timeline) ([Spectre](https://meltdownattack.com/)-style bugs), additionally software has to constantly add more convoluted and slow mitigations to properly enforce security boundaries, such as a WebAssembly VM needing to add code to prevent leaking data from outside the VM to whatever programs are running inside the VM, or a web browser needing to stop JavaScript code from seeing memory that it should not have access to. +Modern CPUs suffer from a [constant stream of new speculative-execution security flaws](https://en.wikipedia.org/wiki/Transient_execution_CPU_vulnerability#Timeline) ([Spectre](https://meltdownattack.com/)-style bugs). Because of that, software has to constantly add more convoluted and slow mitigations to properly enforce security boundaries, such as a WebAssembly VM needing to add code to prevent leaking data from outside the VM to whatever programs are running inside the VM, or a web browser needing to stop JavaScript code from seeing memory that it should not have access to. -To address this major category of CPU flaws, Jacob Lifshay invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks -- this should work for nearly any kind of CPU design. +To address this major category of CPU flaws, Jacob Lifshay formulated a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks -- this should work for nearly any kind of CPU design. We are working towards building a high-performance superscalar CPU with speculative execution and working on proving that it doesn't suffer from any speculative-execution data leaks, thereby demonstrating that this major category of CPU flaws can be fixed once and for all without crippling CPU performance. @@ -87,13 +87,13 @@ We expect to solve 2 technical challenges: * To create a working OoO Superscalar CPU with Speculative Execution, trying to design it such that it doesn't have any Spectre-style vulnerabilities (mostly by doing a better job of tracking any state whatsoever that has speculative modifications). The CPU probably will not yet support some of the features required for high performance (e.g. a complex cache hierarchy) and/or supporting running an operating system and/or floating-point. The plan is to add those features later if they are not completed as part of this grant. * To make substantial progress on creating a formal proof that the CPU doesn't have any Spectre-style vulnerabilities. This is complex enough and has enough potential problems we may run into that we may not finish by the end of this grant, and may need additional grants afterward to finish, hence why the goal is making substantial progress instead of having the proof 100% complete and working. -To address this general category of CPU flaws, I (Jacob Lifshay) invented a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks: +To address this general category of CPU flaws, Jacob Lifshay formulated a way to formally prove that a CPU with speculative execution doesn't suffer from any speculative-execution data leaks: 1. Assume that to leak data, you must be able to observe some change in the digital signals going from/to the CPU core that depends on the results (defined to include any side-effects that change any state, such as cache state changes or branch predictor changes) of some transient instructions (instructions that were speculatively executed and then canceled). 2. Take the concrete cycle-accurate CPU design, and construct a theoretical equivalent that has the additional feature of looking into the future to determine which instructions will be canceled and preemptively forces their results to be zeros (or any other value that doesn't depend on transient instructions' data; since we're doing math here, we don't have to limit ourselves to physically possible designs that respect time flow). The reasoning is that if all transient instructions' results are always zeros, they can't possibly be leaking any useful data, therefore the theoretical equivalent CPU design doesn't have any speculative-execution data leaks. 3. Formally prove that all digital signals from/to the concrete CPU core always exactly match the timing and data in all respects of the theoretical equivalent CPU design. This proves that the concrete CPU core can't have any speculative-execution data leaks. -It is expected that automated formal proof software (stuff like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) is a HDL library written in Rust that we have been developing since around April 2024 that targets the [FIRRTL](https://github.com/chipsalliance/firrtl-spec) intermediate language (used by the [Chisel](https://www.chisel-lang.org/) ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of [LLVM Circt](https://circt.llvm.org/), so is well maintained). +It is expected that automated formal proof software (like SMT solvers such as Z3) will probably be too slow to be usable for the formal correctness proof, therefore the plan is to use Fayalite to generate a translation of the CPU design to Coq or some other similar language for writing formal proofs. [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) is a HDL library written in Rust that we have been developing since around April 2024 that targets the [FIRRTL](https://github.com/chipsalliance/firrtl-spec) intermediate language (used by the [Chisel](https://www.chisel-lang.org/) ecosystem for generating Verilog; firtool, the FIRRTL to Verilog translator, is part of [LLVM Circt](https://circt.llvm.org/), so is well maintained). A WIP high-level design of our CPU: From 80c7463550aa660f95598563dc151de10ee0fb1d Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sat, 30 Nov 2024 16:23:03 -0800 Subject: [PATCH 09/11] add Cesar as requested in https://forum.libre-chip.org/t/starting-working-on-a-nlnet-grant-proposal/29/4 --- src/grants/nlnet-first.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index 6a94b9f..cacfb59 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -16,6 +16,11 @@ We are working towards building a high-performance superscalar CPU with speculat * Jacob Lifshay -- Worked on designing PowerISA CPUs with Libre-SOC for 5yr, built a simple OoO Superscalar CPU simulator , built a RV32I CPU with VGA output in a few weeks that runs a 2.5D maze game . Also is the main author of the [Fayalite](https://git.libre-chip.org/libre-chip/fayalite) HDL library +* Cesar Strauss - Contributed to the Libre-SOC project, mostly on digital +design and formal verification. Presented the talk "An introduction to +Formal Verification of Digital Circuits" on FOSDEM 2024 +(). + * Others... TODO # Requested support From 364340fcaa64ca91a9fb5a4befcaba847fc08e7a Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sat, 30 Nov 2024 20:37:02 -0800 Subject: [PATCH 10/11] submitted to NLNet, add NLNet's grant proposal ID --- src/SUMMARY.md | 2 +- src/grants/nlnet-first.md | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 8f2ce4d..60b3b40 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -2,7 +2,7 @@ * [Proposal for Libre-Chip's First CPU Architecture](first_arch/index.md) * [Register Renaming](first_arch/register_renaming.md) * [Grants](grants/index.md) - * [First NLNet Grant Proposal](grants/nlnet-first.md) + * [First NLNet Grant Proposal -- 2024-12-324](grants/nlnet-first.md) * [Conduct](Conduct.md) * [License](LICENSE.md) * [GPL 3.0](gpl-3.0.md) diff --git a/src/grants/nlnet-first.md b/src/grants/nlnet-first.md index cacfb59..556604a 100644 --- a/src/grants/nlnet-first.md +++ b/src/grants/nlnet-first.md @@ -1,4 +1,4 @@ -# First NLNet Grant Proposal -- First CPU Architecture And Formal Proof of No Spectre bugs +# First NLNet Grant Proposal -- First CPU Architecture And Formal Proof of No Spectre bugs -- 2024-12-324 Project Name: Libre-Chip's First CPU Architecture And Formal Proof of No Spectre bugs @@ -21,8 +21,6 @@ design and formal verification. Presented the talk "An introduction to Formal Verification of Digital Circuits" on FOSDEM 2024 (). -* Others... TODO - # Requested support Requested Amount €50000 From f62d5b01ea73a81dbe988a00267b2331dfe30243 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 15 Jan 2025 20:33:54 -0800 Subject: [PATCH 11/11] add link to https://forum.libre-chip.org/t/idea-for-maybe-allowing-much-wider-fetch-rename-etc-widths-in-a-cpu/33 --- src/first_arch/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/first_arch/index.md b/src/first_arch/index.md index 3501a70..9ca3f99 100644 --- a/src/first_arch/index.md +++ b/src/first_arch/index.md @@ -11,6 +11,7 @@ Possible follow-on work, order TBD: * Expand CPU to support more operations (e.g. floating-point, vector ops., paging) * Add FPGA-style programmable decoder and μOp Cache, with trap-to-software fallback for uncommon/complex ops, which allows running more ISAs such as RISC-V, older x86-32/64, more PowerISA support, and then if we can figure out the legal situation, ARM and modern x86-64. The idea is QEMU (or similar) will be compiled with a special compiler that generates both the fallback software and the bitstream for the decoder, the compiled output will be covered by QEMU's license which has some patent clauses, which hopefully helps with the legal situation. Jacob Lifshay came up with this idea [back in 2022](https://web.archive.org/web/20220612082603/https://bugs.libre-soc.org/show_bug.cgi?id=841) * Formal proof that the CPU doesn't have any spectre-style bugs even though it still is OoO superscalar with speculative execution. Jacob Lifshay came up with this idea [back in 2020](https://web.archive.org/web/20201021124234/https://bugs.libre-soc.org/show_bug.cgi?id=209) +* [Idea for much wider fetch/decode/rename width based on parallel-prefix-sum and taking more than 1 cycle per batch of renamed instructions](https://forum.libre-chip.org/t/idea-for-maybe-allowing-much-wider-fetch-rename-etc-widths-in-a-cpu/33) ## Register Renaming & Internal Registers