Xenmmap.unmap sets the address to MAP_FAILED in xenmmap_stubs.c. If due to a
bug there were still references to the Xenbus and we attempt to use it then we
crash. Raise an exception instead of crashing.
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
(cherry picked from commit
5e317896342d553f0b55f72948bbf93a0f1147d3)
#include <caml/fail.h>
#include <caml/callback.h>
+#include <sys/mman.h>
#include "mmap_stubs.h"
#define GET_C_STRUCT(a) ((struct mmap_interface *) a)
{
CAMLparam2(interface, v);
struct xenstore_domain_interface *intf = GET_C_STRUCT(interface)->addr;
+ if (intf == (void*)MAP_FAILED)
+ caml_failwith("Interface closed");
intf->server_features = Int_val(v);