From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 88D787FA5F for ; Wed, 18 Jan 2017 11:15:34 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=Pass smtp.helo=postmaster@annexia.org Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of rich@annexia.org) identity=pra; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of rich@annexia.org designates 80.68.91.176 as permitted sender) identity=mailfrom; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@annexia.org designates 80.68.91.176 as permitted sender) identity=helo; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="postmaster@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3ASmiFsxcA/LxDg+MSfyAZG7ldlGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxc29Yh7h7PlgxGXEQZ/co6odzbGH7+a7CCdYsN7B6ClEK8McEUddyI?= =?us-ascii?q?0/pE8JPo2sMQXDNvnkbig3ToxpdWRO2DWFC3VTA9v0fFbIo3e/vnY4ExT7Mhdp?= =?us-ascii?q?dKyuQtaBx5f/6+fn8JTWZ0BMhSGhSbJ0NhS/6wvL5ecMho43YJwwwRvAuHcARK?= =?us-ascii?q?JzgytKIlSehFy0st2x955L+iJWtuIg/ohHS6qsLPdwdqBREDlzazN938bsrxSW?= =?us-ascii?q?FQY=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CVBQDDP39Y/7BbRFBdHRgHCwEXAQYBg?= =?us-ascii?q?wIBAQEBAR9fgQmDA5swAQEBAQEBBpZJggsqh2VAFwEBAQEBAQEBAQEBYiiCMxm?= =?us-ascii?q?CXnsTIQUoiSoRCp86kiaKVwWGATqKBYJngjEFlTGGDAGBSoUUinWQepJuIQI0g?= =?us-ascii?q?VEIhm0+NYh6AQEB?= X-IPAS-Result: =?us-ascii?q?A0CVBQDDP39Y/7BbRFBdHRgHCwEXAQYBgwIBAQEBAR9fgQm?= =?us-ascii?q?DA5swAQEBAQEBBpZJggsqh2VAFwEBAQEBAQEBAQEBYiiCMxmCXnsTIQUoiSoRC?= =?us-ascii?q?p86kiaKVwWGATqKBYJngjEFlTGGDAGBSoUUinWQepJuIQI0gVEIhm0+NYh6AQE?= =?us-ascii?q?B?= X-IronPort-AV: E=Sophos;i="5.33,249,1477954800"; d="scan'208";a="255972847" Received: from annexia.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 18 Jan 2017 11:15:34 +0100 Received: from rich by annexia.org with local (Exim 4.84_2) (envelope-from ) id 1cTnHB-00044Z-0k for caml-list@inria.fr; Wed, 18 Jan 2017 10:15:33 +0000 Date: Wed, 18 Jan 2017 10:15:33 +0000 From: "Richard W.M. Jones" To: caml-list@inria.fr Message-ID: <20170118101532.GC28111@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [Caml-list] Heap corruption in C binding when callback raises exception 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