Skip to content

Commit aa96a3c

Browse files
committed
lguest: fix GPF in guest when using gdb.
Since the Guest is in ring 1, it can't read the debug registers: doing so gives a number of nasty messages: (gdb) run Starting program: /bin/sleep [ 31.170230] general protection fault: 0000 [#1] SMP [ 31.170230] Modules linked in: [ 31.170230] CPU: 0 PID: 2678 Comm: sleep Not tainted 3.11.0+ torvalds#64 [ 31.170230] task: cc5c09b0 ti: cc79c000 task.ti: cc79c000 [ 31.170230] EIP: 0061:[<c01333d8>] EFLAGS: 00000097 CPU: 0 [ 31.170230] EIP is at native_get_debugreg+0x58/0x70 [ 31.170230] EAX: 00000006 EBX: cc79dfb4 ECX: b7fff918 EDX: 00000000 [ 31.170230] ESI: cc5c09b0 EDI: 00000000 EBP: cc79df84 ESP: cc79df84 [ 31.170230] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0069 [ 31.170230] CR0: 00000008 CR2: 081ba69a CR3: 0e2f2000 CR4: 00000000 Signed-off-by: Rusty Russell <[email protected]>
1 parent 98fb4e5 commit aa96a3c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: arch/x86/lguest/boot.c

+7
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,12 @@ static void lguest_load_sp0(struct tss_struct *tss,
10561056
}
10571057

10581058
/* Let's just say, I wouldn't do debugging under a Guest. */
1059+
static unsigned long lguest_get_debugreg(int regno)
1060+
{
1061+
/* FIXME: Implement */
1062+
return 0;
1063+
}
1064+
10591065
static void lguest_set_debugreg(int regno, unsigned long value)
10601066
{
10611067
/* FIXME: Implement */
@@ -1303,6 +1309,7 @@ __init void lguest_init(void)
13031309
pv_cpu_ops.load_tr_desc = lguest_load_tr_desc;
13041310
pv_cpu_ops.set_ldt = lguest_set_ldt;
13051311
pv_cpu_ops.load_tls = lguest_load_tls;
1312+
pv_cpu_ops.get_debugreg = lguest_get_debugreg;
13061313
pv_cpu_ops.set_debugreg = lguest_set_debugreg;
13071314
pv_cpu_ops.clts = lguest_clts;
13081315
pv_cpu_ops.read_cr0 = lguest_read_cr0;

0 commit comments

Comments
 (0)