@@ -50,6 +50,7 @@
#include <xen/paging.h>
#include <xen/virtual_region.h>
#include <xen/watchdog.h>
+#include <xen/xsplice.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/atomic.h>
@@ -1190,7 +1191,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
/* WARN, BUG or ASSERT: decode the filename pointer and line number. */
filename = bug_ptr(bug);
- if ( !is_kernel(filename) )
+ if ( !is_kernel(filename) && !is_patch(filename) )
goto die;
fixup = strlen(filename);
if ( fixup > 50 )
@@ -1217,7 +1218,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
case BUGFRAME_assert:
/* ASSERT: decode the predicate string pointer. */
predicate = bug_msg(bug);
- if ( !is_kernel(predicate) )
+ if ( !is_kernel(predicate) && !is_patch(predicate) )
predicate = "<unknown>";
printk("Assertion '%s' failed at %s%s:%d\n",
@@ -124,6 +124,28 @@ static int verify_payload(const xen_sysctl_xsplice_upload_t *upload, char *n)
return 0;
}
+bool_t is_patch(const void *ptr)
+{
+ struct payload *data;
+
+ /*
+ * No locking since this list is only ever changed during apply or revert
+ * context.
+ */
+ list_for_each_entry ( data, &applied_list, applied_list )
+ {
+ if ( ptr >= data->rw_addr &&
+ ptr < (data->rw_addr + data->rw_size) )
+ return 1;
+
+ if ( ptr >= data->ro_addr &&
+ ptr < (data->ro_addr + data->ro_size) )
+ return 1;
+ }
+
+ return 0;
+}
+
unsigned long xsplice_symbols_lookup_by_name(const char *symname)
{
struct payload *data;
@@ -479,6 +501,30 @@ static int prepare_payload(struct payload *payload,
region->start = (unsigned long)payload->text_addr;
region->end = (unsigned long)(payload->text_addr + payload->text_size);
+ /* Optional sections. */
+ for ( i = 0; i < BUGFRAME_NR; i++ )
+ {
+ char str[14];
+
+ snprintf(str, sizeof(str), ".bug_frames.%u", i);
+ sec = xsplice_elf_sec_by_name(elf, str);
+ if ( !sec )
+ continue;
+
+ if ( sec->sec->sh_size &&
+ (sec->sec->sh_size % sizeof(*region->frame[i].bugs)) )
+ {
+ dprintk(XENLOG_DEBUG, XSPLICE "%s: Wrong size of .bug_frames.%u!\n",
+ elf->name, i);
+ return -EINVAL;
+ }
+
+ region->frame[i].bugs = sec->load_addr;
+ if ( sec->sec->sh_size)
+ region->frame[i].n_bugs = sec->sec->sh_size /
+ sizeof(*region->frame[i].bugs);
+ }
+
return 0;
}
@@ -49,6 +49,7 @@ struct xsplice_symbol {
int xsplice_op(struct xen_sysctl_xsplice_op *);
void check_for_xsplice_work(void);
+bool_t is_patch(const void *addr);
unsigned long xsplice_symbols_lookup_by_name(const char *symname);
/* Arch hooks. */
@@ -101,6 +102,10 @@ static inline int xsplice_op(struct xen_sysctl_xsplice_op *op)
return -EOPNOTSUPP;
}
static inline void check_for_xsplice_work(void) { };
+static inline bool_t is_patch(const void *addr)
+{
+ return 0;
+}
#endif /* CONFIG_XSPLICE */
#endif /* __XEN_XSPLICE_H__ */