|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH v2] lib/ukdebug: uk_asmdumpk(), uk_asmdumpn(): Stop decoding on errors
Checks for errors that may occur during instruction decoding with
libzydis.
Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
lib/ukdebug/asmdump.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/ukdebug/asmdump.c b/lib/ukdebug/asmdump.c
index f73b0d65..f860533c 100644
--- a/lib/ukdebug/asmdump.c
+++ b/lib/ukdebug/asmdump.c
@@ -43,7 +43,7 @@
/**
* Disassemble <num_ins> instructions with zydis starting
- * with instruction at <addr>
+ * with instruction at <instr>
*/
static int _asmdump(struct out_dev *o,
const void *instr, unsigned int count)
@@ -76,7 +76,10 @@ static int _asmdump(struct out_dev *o,
while (count) {
addr = ((__uptr) instr) + offset;
- ZydisDecoderDecodeBuffer(&dcr, (const void *) addr, 16, &ins);
+ if (!ZYAN_SUCCESS(ZydisDecoderDecodeBuffer(&dcr,
+ (const void *) addr,
+ 16, &ins)))
+ break;
ZydisFormatterFormatInstruction(&fmt, &ins, buf, sizeof(buf),
addr);
ret = outf(o, "%08"__PRIuptr" <+%d>: %hs\n", addr, offset, buf);
--
2.20.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |