Skip to content

Commit

Permalink
Fix xs.read_watch() python binding
Browse files Browse the repository at this point in the history
EAGAIN error wasn't properly handled. Details in patch description.

Fixes QubesOS/qubes-issues#4890
  • Loading branch information
marmarek committed Sep 6, 2019
1 parent 64b400f commit f4c636e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions patch-python-do-not-report-handled-EAGAIN-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 944d5e53fa4d77dc98d7b7e8a580f939a66e2212 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
<[email protected]>
Date: Tue, 20 Aug 2019 00:54:04 +0200
Subject: [PATCH] python: do not report handled EAGAIN error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <[email protected]>

match_watch_by_token() when returns an error, sets also exception within
python. This is generally the right thing to do, but when
xspy_read_watch() handle EAGAIN error internally, the exception needs to
be cleared. Otherwise it will fail like this:

xen.lowlevel.xs.Error: (11, 'Resource temporarily unavailable')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
(...)
result = self.handle.read_watch()
SystemError: <method 'read_watch' of 'xen.lowlevel.xs.xs' objects> returned a result with an error set

Fixes f6e1023412 "python: Extract registered watch search logic from xspy_read_watch()"
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
tools/python/xen/lowlevel/xs/xs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index ea50f86bc3..621039d7a7 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -531,6 +531,7 @@ again:
free(xsval);

if (!val && errno == EAGAIN) {
+ PyErr_Clear();
goto again;
}

--
2.20.1

1 change: 1 addition & 0 deletions xen.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Patch630: patch-0002-drivers-video-drop-unused-limits.patch
Patch631: patch-0003-drivers-video-drop-framebuffer-size-constraints.patch
Patch632: patch-0004-drivers-video-use-vlfb_info-consistently.patch
Patch633: patch-0005-video-fix-handling-framebuffer-located-above-4GB.patch
Patch634: patch-python-do-not-report-handled-EAGAIN-error.patch

# GCC7 fixes
Patch706: patch-mini-os-link-to-libgcc.a-to-fix-build-with-gcc7.patch
Expand Down

0 comments on commit f4c636e

Please sign in to comment.