Date
1 - 3 of 3
[RISC-V] [tech-tee] [RISC-V] [tech-privileged] comments on PMP enhancements
Mr Tariq Kurd <tariq.kurd@...>
Hi Nick, John,
toggle quoted message
Show quoted text
Here's my proposal for adding two fields to the proposed MSECCFG CSR: DPL and DMC. This proposal assumes that the programming model for the permissions is sufficient without adding another bit per PMP entry. If this is not the case then we should look further at adding another bit (M-bit in my proposal, or John's proposal). If we think that the programming model is sufficient then hopefully adding these two bits can solve my problem in a simple way Reading through this thread there is still an open question about programming SPMP permissions, for example, which we should resolve. Tariq -----Original Message-----
From: tech-tee@... [mailto:tech-tee@...] On Behalf Of Nick Kossifidis Sent: 18 February 2020 03:27 To: John Hauser <jh.riscv@...> Cc: tech-tee@...; tech-privileged@... Subject: Re: [RISC-V] [tech-tee] [RISC-V] [tech-privileged] comments on PMP enhancements Hello John, Στις 2020-02-14 22:56, John Hauser έγραψε: So does the original PMP spec and the group's proposal. There are people already using PMP as-is in production, providing TEE and secure boot mechanisms (e.g. multizone and keystone) without needing the ability to have removable / editable rules on M-mode. For 1+ year that we've been working on this proposal to improve PMP so that it can also be used to provide access / execution prevention from M-mode, we've only heard of such a requirement from Huawei so that the PMP spec matches their solution. I'm not against incorporating such a feature, all I want is to make sure it's there for the right reasons and that it's defined properly. On one hand I get your point that we need to be as flexible as possible, on the other hand we can't please everyone, especially by making an already established security control weaker. RISC-V already allows for vendors to implement their own PMP mechanism anyway and vendors will do that regardless of the PMP spec, the proposed mseccfg CSR may make this even easier / cleaner to do so e.g. by having vendor-specific fields there in the future. Where do we put the line between a spec that provides a set of security guarantees, and allowing for that spec to be weaker for flexibility ? At least in Huawei's case what they want can be integrated to the group's proposal (or even the current PMP spec since it's independent of MML) easily, and hopefully without compromising security if defined / used properly. What happens if a vendor asks for something that allows e.g. for a security control to be completely bypassed (e.g. disable SMEP), or for an insecure crypto algorithm to be added on one of our specs, or for a security mechanism that's not secure at all ? Will we go for flexibility or for security ? I understand you're afraid that offering any compromises in the PMPWhen a system gets compromised it's everyone's problem. It's not a matter of having or not having a hw mechanism, it's a matter of properly defining what's the goal of this mechanism and its scope. If we say for example that a region is "protected by PMP" when on M-mode, and the corresponding rule can be removed / edited by M-mode at any time, in a few instructions, then we will be lying. If the spec is not absolutely clear on how a security mechanism works and under which conditions it provides security guarantees, things will go wrong. It has happened many times in the past where people created specs or products that allowed for less-secure (or even totally insecure) configurations to be used. Regards, Nick |
|
Joe Xie
Hi Tariq, all,
toggle quoted message
Show quoted text
After a rethink, I actually think that the restriction imposed by lock is a good feature to security. For example, in your use case that BR wants to lockdown its sub-regions one by one to prevent FI, one solution is to move most BR code to U mode and just leave a small piece of PMP management code in M mode, the M mode FW then can only enable U mode region when needed. So I am really not sure we want to add more flexibility to loosen M mode protections if pushing SW to U mode can solve the problem and makes your M mode FW more secure. Do you agree? I am ok with the DMC bit as it is clear and saves one region. Currently in our implementation we use background entry, but yes I agree 16 PMP entry is a problem.. -----Original Message-----
From: tech-privileged@... <tech-privileged@...> On Behalf Of Mr Tariq Kurd Sent: Wednesday, February 19, 2020 1:13 AM To: Nick Kossifidis <mick@...>; John Hauser <jh.riscv@...> Cc: tech-tee@...; tech-privileged@... Subject: Re: [RISC-V] [tech-tee] [RISC-V] [tech-privileged] comments on PMP enhancements External email: Use caution opening links or attachments Hi Nick, John, Here's my proposal for adding two fields to the proposed MSECCFG CSR: DPL and DMC. This proposal assumes that the programming model for the permissions is sufficient without adding another bit per PMP entry. If this is not the case then we should look further at adding another bit (M-bit in my proposal, or John's proposal). If we think that the programming model is sufficient then hopefully adding these two bits can solve my problem in a simple way Reading through this thread there is still an open question about programming SPMP permissions, for example, which we should resolve. Tariq -----Original Message----- From: tech-tee@... [mailto:tech-tee@...] On Behalf Of Nick Kossifidis Sent: 18 February 2020 03:27 To: John Hauser <jh.riscv@...> Cc: tech-tee@...; tech-privileged@... Subject: Re: [RISC-V] [tech-tee] [RISC-V] [tech-privileged] comments on PMP enhancements Hello John, Στις 2020-02-14 22:56, John Hauser έγραψε: So does the original PMP spec and the group's proposal. There are people already using PMP as-is in production, providing TEE and secure boot mechanisms (e.g. multizone and keystone) without needing the ability to have removable / editable rules on M-mode. For 1+ year that we've been working on this proposal to improve PMP so that it can also be used to provide access / execution prevention from M-mode, we've only heard of such a requirement from Huawei so that the PMP spec matches their solution. I'm not against incorporating such a feature, all I want is to make sure it's there for the right reasons and that it's defined properly. On one hand I get your point that we need to be as flexible as possible, on the other hand we can't please everyone, especially by making an already established security control weaker. RISC-V already allows for vendors to implement their own PMP mechanism anyway and vendors will do that regardless of the PMP spec, the proposed mseccfg CSR may make this even easier / cleaner to do so e.g. by having vendor-specific fields there in the future. Where do we put the line between a spec that provides a set of security guarantees, and allowing for that spec to be weaker for flexibility ? At least in Huawei's case what they want can be integrated to the group's proposal (or even the current PMP spec since it's independent of MML) easily, and hopefully without compromising security if defined / used properly. What happens if a vendor asks for something that allows e.g. for a security control to be completely bypassed (e.g. disable SMEP), or for an insecure crypto algorithm to be added on one of our specs, or for a security mechanism that's not secure at all ? Will we go for flexibility or for security ? I understand you're afraid that offering any compromises in the PMPWhen a system gets compromised it's everyone's problem. It's not a matter of having or not having a hw mechanism, it's a matter of properly defining what's the goal of this mechanism and its scope. If we say for example that a region is "protected by PMP" when on M-mode, and the corresponding rule can be removed / edited by M-mode at any time, in a few instructions, then we will be lying. If the spec is not absolutely clear on how a security mechanism works and under which conditions it provides security guarantees, things will go wrong. It has happened many times in the past where people created specs or products that allowed for less-secure (or even totally insecure) configurations to be used. Regards, Nick ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- |
|
Yes, the reason I labelled it separate M&L was because the existing "legacy" proposal essentially combines the functionality into a single "L" bit. > But: if an entry is created (necessarily by M-mode) that is locked and such that M-mode can no longer touch that region but S/U mode can - that is v either intentional or that M-mode code is buggy, in my opinion. Such an entry is impossible under the existing standard. There's no way to encode it. Of course - I was referring to sep_M&L proposals, (e.g. with MML=1, L=1, M-0). Sorry for the confusion - too many proposals floating around. The enhanced proposal can make a region inaccessible to M, accessible to S/U - but doesn't allow it to be locked. I do understand that if you want to ensure that a locked rule can't be undone, you need ensure that all entries with lower entry numbers than it are also locked. That's another way of saying that we shouldn't be inventing new modes to prevent this, we just need to do avoid obvious buggy code (I don't know if any of the proposals actually do something like that, so don't take that as criticism). Mr. Kurd's proposal does not similarly lock down all of M mode's executable regions against modification nor prevent the creation of new PMP entries for executable regions. Well, that would be a pretty simple modification of his proposal, then: disallow creation of new Mode X regions when MML=1. If that modification was made, what drawbacks remain? I do understand that this might require a particular BootRom coding sequence; I'd like to explore that to see if it would be unreasonable or not. I don't see an equivalent of the shared data regions that the sepM&L and enhanced proposals have. There is something similar that allows S/U to have execution privileges in a shared access region and only if it is unlocked, and I don't know if that should be a concern or not. I'd still like to simplify either proposal by removing DMC and replacing it with "any entry locked". Once you've locked a region, there is no need to access unmapped regions, since you can do that from the locked region |
|