1+ /*!
2+ * @file lava_hypercall_struct.h
3+ * @brief Support for hypercalls from the PANDA guest to the taint2 plugin. Used by LAVA.
4+ *
5+ * @author
6+ * Tim Leek tleek@ll.mit.edu
7+ * Ryan Whelan rwhelan@ll.mit.edu
8+ * Joshua Hodosh josh.hodosh@ll.mit.edu
9+ * Michael Zhivich mzhivich@ll.mit.edu
10+ * Brendan Dolan-Gavitt brendandg@gatech.edu
11+ *
12+ * @copyright This work is licensed under the terms of the GNU GPL, version 2.
13+ * See the COPYING file in the top-level directory.
14+ */
15+ #pragma once
16+
17+ #ifndef __LAVA_HYPERCALL_STRUCT_H__
18+ #define __LAVA_HYPERCALL_STRUCT_H__
19+
20+ // lavaint must be 32 bits for architecture compatibility (4 bytes)
21+ typedef unsigned int lavaint ;
22+ #ifndef __cplusplus
23+ #define static_assert _Static_assert
24+ #endif
25+ static_assert (sizeof (lavaint ) == 4 , "lavaint size must be 4!" );
26+
27+ // Magic number used by the host to identify the hypercall as a legitimate
28+ // call intended for the taint2 plugin.
29+ #define LAVA_MAGIC 0xabcd
30+
31+ // CRITICAL: Ensure 1-byte packing so the structure size and field offsets
32+ // match exactly between the guest and the host (no compiler padding).
33+ #pragma pack(push,1)
34+ typedef struct panda_hypercall_struct {
35+ lavaint magic ; // Must be LAVA_MAGIC
36+ lavaint action ; // label / query / etc
37+ lavaint buf ; // ptr to memory we want labeled or queried or ...
38+ lavaint len ; // number of bytes to label or query or ...
39+ lavaint label_num ; // if labeling, this is the label number. if querying this should be zero
40+ lavaint src_column ; // column on source line
41+ lavaint src_filename ; // char * to filename.
42+ lavaint src_linenum ; // line number
43+ lavaint src_ast_node_name ; // the name of the l-value queries
44+ lavaint info ; // general info
45+ lavaint insertion_point ; // unused now.
46+ } PandaHypercallStruct ;
47+ #pragma pack(pop)
48+
49+ #endif // __LAVA_HYPERCALL_STRUCT_H__
0 commit comments