rust-lang / compiler-team

A home for compiler team planning documents, meeting minutes, and other such things.
https://rust-lang.github.io/compiler-team/
Apache License 2.0
387 stars 67 forks source link

type_id is not sufficiently collision-resistant #774

Open apiraino opened 2 months ago

apiraino commented 2 months ago

Meeting proposal info

Summary

See opening comment in rust#129014:

The soundness of functions like downcast relies on the type_id of two different types never being equal. Currently, the type_id is a 128-bit hash of the full type identity, computed specifically via SipHash-1-3 with an all-zero key. This is not a strong enough hash function for this purpose.

and:

We should do one of the following:

  1. switch to a stronger hash function, or
  2. switch to a different scheme that doesn't rely on collision-resistance of the hash function.

Discussed on Zulip during triage meeting.

About this issue

This issue corresponds to a meeting proposal for the compiler team steering meeting. It corresponds to a possible topic of discussion. You can read more about the steering meeting procedure here.

Comment policy

These issues are meant to be used as an "announcements channel" regarding the proposal, and not as a place to discuss the technical details. Feel free to subscribe to updates. We'll post comments when reviewing the proposal in meetings or making a scheduling decision. In the meantime, if you have questions or ideas, ping the proposers on Zulip (or elsewhere).

RalfJung commented 2 months ago

Cc https://github.com/rust-lang/rust/issues/129030