Hi guys, can you help me with a review of this qick fix about project Fortify? (Internal only) go/code-terracotta-review-explainer
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
IPC: tse...@chromium.org
📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).
IPC reviewer(s): tse...@chromium.org
Reviewer source(s):
tse...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
base::checked_cast<uint32_t>(stride), 0, height_in_pixels * stride,can this overflow as well? Then truncated from size_t to 32 bits?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
plane.offset, plane.size,Should these maybe be `base::strict_cast<uint64_t>()` and `base::strict_cast<uint64_t>()`?
plane.offset, plane.size,Should these maybe be `base::strict_cast<uint64_t>()` and `base::strict_cast<uint64_t>()`?
base::checked_cast<uint32_t>(plane.stride), plane.offset,
plane.size, std::move(duped_fds[i]));Should these maybe be `base::strict_cast<uint64_t>()` and `base::strict_cast<uint64_t>()`?
UNSAFE_TODO(import_data.strides[plane]) =
base::checked_cast<uint32_t>(handle.planes[plane].stride);
UNSAFE_TODO(import_data.offsets[plane]) =
base::checked_cast<uint32_t>(handle.planes[plane].offset);These ones should remain `base::checked_cast<int>` because `int` is used in [`gbm_import_fd_modifier_data`](https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/minigbm/gbm.h;l=375-376;drc=698c5e9e8d94bc4ed988bd07b246cf37380851d0).
native_pixmap_handle, output);nit: Add `ASSERT_FALSE(output.planes.empty());`
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Hi Tom and Andres,
Thanks for the reviews. To land this safety fix as quickly as possible and avoid cross-component approval delays, I've decided to split the original CL into two parts:
1. This CL (Mojo Security): Focused strictly on the Mojo boundary. I've added range validation to the Traits to prevent the sign-extension exploit from a compromised renderer. This is the core fix for b:497542537.
2. Follow-up CL (Media Safety): I've moved the internal hygiene and safety improvements for media/gpu and chromeos/ash call sites here: https://crrev.com/c/7724047
In this patchset, I have also:
Do you agree to leave the full type migration (to uint32_t/uint64_t) and the overflow checks in test_shared_image_interface.cc in the subsequent permanent fix?
base::checked_cast<uint32_t>(stride), 0, height_in_pixels * stride,can this overflow as well? Then truncated from size_t to 32 bits?
Agree, however, to land the core security fix as quickly as possible and avoid cross-component approval delays, I have focused this CL strictly on the Mojo boundary and reverted changes to this test-only file.
For the internal Media/ChromeOS safety improvements, I've made follow-up CL: https://crrev.com/c/7724047
Should these maybe be `base::strict_cast<uint64_t>()` and `base::strict_cast<uint64_t>()`?
I've kept the constructor parameters as int (matching base state) to land the safety fix quickly. Since strict_cast to uint64_t would cause a compile error, I've used base::checked_cast<int> instead. This provides the same security guarantee by crashing on overflow.
You can see these updated call sites in the follow-up CL: https://crrev.com/c/7724047. The full header migration to uint64_t will follow in the permanent fix.
Should these maybe be `base::strict_cast<uint64_t>()` and `base::strict_cast<uint64_t>()`?
Same as above. Updated in the follow-up CL: https://crrev.com/c/7724047
base::checked_cast<uint32_t>(plane.stride), plane.offset,
plane.size, std::move(duped_fds[i]));Should these maybe be `base::strict_cast<uint64_t>()` and `base::strict_cast<uint64_t>()`?
Same as my previous comment. I've used checked_cast<int> where the destination is the NativePixmapPlane constructor (to match the int parameters in the header), and safe casts where the destination allows uint64_t.
Updated in: https://crrev.com/c/7724047
UNSAFE_TODO(import_data.strides[plane]) =
base::checked_cast<uint32_t>(handle.planes[plane].stride);
UNSAFE_TODO(import_data.offsets[plane]) =
base::checked_cast<uint32_t>(handle.planes[plane].offset);These ones should remain `base::checked_cast<int>` because `int` is used in [`gbm_import_fd_modifier_data`](https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/minigbm/gbm.h;l=375-376;drc=698c5e9e8d94bc4ed988bd07b246cf37380851d0).
Done
native_pixmap_handle, output);Sergio Solanonit: Add `ASSERT_FALSE(output.planes.empty());`
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
out->stride = base::checked_cast<int>(data.stride());can't these just be static_cast? Because we've already checked that the data will fit inside the requested `int`? We don't need the runtime check of base::checked_cast right?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
base::checked_cast<uint32_t>(stride), 0, height_in_pixels * stride,Sergio Solanocan this overflow as well? Then truncated from size_t to 32 bits?
Agree, however, to land the core security fix as quickly as possible and avoid cross-component approval delays, I have focused this CL strictly on the Mojo boundary and reverted changes to this test-only file.
For the internal Media/ChromeOS safety improvements, I've made follow-up CL: https://crrev.com/c/7724047
I don't see the this file being changed in your follow up CL? Looks like we might have needed CheckMul?
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |