Skip to content

Shims cannot trust user-defined types, need to always use deref_pointer_as #3841

Open
@RalfJung

Description

@RalfJung

Calling deref_pointer means we create a place at whatever type that argument was declared at by the user. But we can't trust that type, we should ideally entirely ignore it and use deref_pointer_as everywhere. Failure to do so can lead to ICEs like #3839.

To help with this, do the following:

  • rg -w deref_pointer src/shims
  • Pick one of the remaining places where we call deref_pointer
  • Figure out which type that argument is supposed to have
  • Replace the call with deref_pointer_as and the correct type

Getting the correct type will be the hardest part of this, and it depends on what the correct type is. Many basic types are available in this.machine.layouts, but struct types need to be looked up in libc/std or maybe we even have to construct one ourselves (or entirely change the code). If you are unsure about a concrete case, just ask here. :)

Metadata

Metadata

Labels

A-shimsArea: This affects the external function shimsC-cleanupCategory: cleaning up our codeE-good-first-issueA good way to start contributing, mentoring is available

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions