[PATCH] D136400: [llvm-ocaml] Migrate from naked pointers to prepare for OCaml 5

Alan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 14:25:29 PDT 2022


alan added a comment.

I'm concerned about the diagnostic handler-related functions. An arbitrary OCaml function can be set as the handler, so any LLVM function that invokes the diagnostic handler anywhere may allocate on the OCaml heap. What's more, any such LLVM function may throw an OCaml exception, which will unwind the stack, meaning:

- Calls to `free` in these bindings will not be reached. (The fix would be to allocate on the OCaml heap using `Abstract_tag`.)
- Assumptions about resource cleanup deeper in the LLVM code will be violated (e.g. C++ destructors may not run).

Is the diagnostic handler feature safe?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136400/new/

https://reviews.llvm.org/D136400



More information about the llvm-commits mailing list