Darius MercadierHey, 2 comments:
- Apart from a handful of exceptions, this is CL is mostly just updating DEBUG-only or tracing functions. It's fine of course, but I just wanted to point it out.
- Gemini missed _a bunch_ of examples. Just from the file I currently had opened, the first switch I found was https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/turboshaft/store-store-elimination-reducer-inl.h;l=444;drc=0e7eee33ad88dcbf15116e7f11a8cf8c7b56904f, and this CL didn't update it. From a quick look at the CL, it looks like it only updated functions that _only_ contain a switch. Also fine, but I also wanted to point it out :p
Omer KatzMmmh the Gerrit didn't like my link. I was referring to TryGetRawUint32Constant in store-store-elimination-reducer-inl.h
Omer KatzI don't expect this CL to be exhaustive. It's a bunch of locations that gemini found, but it's not all locations. We could try to run the prompt a few more times and see what it finds. Probably the prompt could also be improved.
I think debug-only still makes sense to update. It's pretty much free and if it means we don't later get a report that we need to downgrade to a bug (and potentially explain why) then I think it's a win.
I ran it a few more times and found a few more instances.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
This CL uses Gemini to identify exhaustive switches over enums thatOmer KatzFor documentation, the actual prompt was:
```
Find all switch statements over enums that exhaustively list all enum values, each case returns, and there's no default case or `UNREACHABLE()` after the switch. Add an `UNREACHABLE()` after the switch.
```
Acknowledged
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Block UB due to switch on corrupted values
When switching over an enum value we already require that the switch
covers all enum values. When that is achieved by exhaustively listing
all values, rather than a default case, a corrupted value can thus not
match any of the cases. If the switch cases are all returning values and
there is no default return after the switch, this can lead to UB and
potentially sandbox escapes.
This CL uses Gemini to identify exhaustive switches over enums that
return but don't have a default catch-all path, and adds UNREACHABLE()
after them to crash in case of unexpected values.
This CL doesn't try to limit the changes to just switches that take
in-sandbox corruptible values or switches that are known to result in
issues. Instead, we take a conservative approach and adjust all found
switches.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |