[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH] lib/ukdebug: asmdump: Stop on decoding errors



Checks for errors that may occur during instruction decoding with
libzydis.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/ukdebug/asmdump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ukdebug/asmdump.c b/lib/ukdebug/asmdump.c
index f73b0d65..7f992930 100644
--- a/lib/ukdebug/asmdump.c
+++ b/lib/ukdebug/asmdump.c
@@ -76,7 +76,8 @@ 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.