From: "Richard W.M. Jones" <rich@annexia.org>
To: caml-list@inria.fr
Subject: [Caml-list] Heap corruption in C binding when callback raises exception
Date: Wed, 18 Jan 2017 10:15:33 +0000 [thread overview]
Message-ID: <20170118101532.GC28111@annexia.org> (raw)
https://github.com/libguestfs/libguestfs/blob/master/mllib/visit-c.c
This code wraps a C function which recurses over a directory
structure, calling back into OCaml code for every file seen.
If the OCaml callback raises an exception then it's supposed to stop
the recursion and re-raise the exception in the main function.
This all works fine except when the OCaml callback raises an exception
on aarch64 (not x86_64). The exception is re-raised fine, but a
subsequent call to Gc.compact dies in caml_oldify_local_roots.
Presumably something corrupts the local roots in some way (the stack
trace in gdb is unfortunately quite useless).
Can someone see what I'm doing wrong in the exception catching /
re-raising code or elsewhere?
The C function and callback are defined here:
https://github.com/libguestfs/libguestfs/blob/master/cat/visit.h
Rich.
--
Richard Jones
next reply other threads:[~2017-01-18 10:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 10:15 Richard W.M. Jones [this message]
2017-01-18 10:21 ` Richard W.M. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170118101532.GC28111@annexia.org \
--to=rich@annexia.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox