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

[PATCH 2/3] x86/PV: replace assertions in '0' debug key stack dumping


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 29 Sep 2021 11:42:54 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Y7ccXA22nntJPvmIaAdNM7vs28zhnf2Wqchn+7jd8mY=; b=cOzLO5BBOgxZ1teDP8yhZNedntYQ7d/3BOlwhf4rXpPa0tHXdlCPtD/dw682wyAtOaMl+/6matDsiSZX7jTfdml/l6vmpPtOihkAtYRT9pJGVwiZccMhQ2iRL8P+0f4OyMjFCSEkBGjStsyTsOuL/6iO5NHEVScsvvayGZegFXt11waLJro1ALZnQoLKRuixDa29UsRGCFqTzEHHqb8eGxlISpftKVp6UIG/Pdo9qYW+yrv1S0K/wJiiKbocgOFi139s3173K7pJQbsfLEMvzkJnvlwyK7rCUWQWNe/BKsWNLO6OjvAz8cAl+m53i3C9asSDJ1hmr8Bsli++FIPPHA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YRtGTDVearZ/+MjEozVlI3PIqqe/quFylaWisaQiEz3rndBeaWcB7aVPNH/1wkSu70g5Z/7sB+OCGmHzrubNQIUovpAKnLOQMRh/4Je0rjppDwZja7ibGwN2RP9xByASS3axQGej+LubUdZ+Kv5dYpSZnVEVo0YcdWyoF9a/9A3RKnFbfmP9zIZXdmGXzFjHM1pRvgxQIJjR9pztdL+9tyXnjpy8Vxs4Jv+cmpkSEtkTn9zgtk/yMDlJ1h69ihRYEqk1NWclPc7CvRKZfShZUdI10Ca0l28hW1AYJtmBKwQiWtPOMPaTm6dHL/rW7UQH/2Pdqh50/V1bIzgAUGCLYw==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 29 Sep 2021 09:43:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While it was me to add them, I'm afraid I don't see justification for
the assertions: A vCPU may very well have got preempted while in user
mode. Limit compat guest user mode stack dumps to the containing page
(like is done when using do_page_walk()), and suppress their dumping
altogether for 64-bit Dom0.

Fixes: cc0de53a903c ("x86: improve output resulting from sending '0' over 
serial")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
An alternative to suppressing the dump for 64-bit would be to make
do_page_fault() guest-user-mode aware.

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -254,7 +254,6 @@ static void compat_show_guest_stack(stru
         struct vcpu *vcpu;
         unsigned long mfn;
 
-        ASSERT(guest_kernel_mode(v, regs));
         mfn = read_cr3() >> PAGE_SHIFT;
         for_each_vcpu( v->domain, vcpu )
             if ( pagetable_get_pfn(vcpu->arch.guest_table) == mfn )
@@ -269,6 +268,8 @@ static void compat_show_guest_stack(stru
             }
             mask = PAGE_SIZE;
         }
+        else if ( !guest_kernel_mode(v, regs) )
+            mask = PAGE_SIZE;
     }
 
     for ( i = 0; i < debug_stack_lines * 8; i++ )
@@ -328,7 +329,12 @@ static void show_guest_stack(struct vcpu
     {
         struct vcpu *vcpu;
 
-        ASSERT(guest_kernel_mode(v, regs));
+        if ( !guest_kernel_mode(v, regs) )
+        {
+            printk("User mode stack\n");
+            return;
+        }
+
         vcpu = maddr_get_owner(read_cr3()) == v->domain ? v : NULL;
         if ( !vcpu )
         {




 


Rackspace

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