NetBSD Problem Report #53715

From gson@gson.org  Sat Nov 10 13:12:46 2018
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 89C067A111
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Nov 2018 13:12:46 +0000 (UTC)
Message-Id: <20181110131242.A455A9893F6@guava.gson.org>
Date: Sat, 10 Nov 2018 15:12:42 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: gdb can't step into indirect calls because retpolines
X-Send-Pr-Version: 3.95

>Number:         53715
>Category:       port-i386
>Synopsis:       gdb can't step into indirect calls because retpolines
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 10 13:15:00 +0000 2018
>Last-Modified:  Sat Nov 10 13:35:01 +0000 2018
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2018.11.09.15.20.36
>Organization:

>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:

When debugging a kernel issue using a remote kgdb setup as in
https://wiki.netbsd.org/kernel_debugging_with_qemu/ I was unable to
single-step into a function called indirectly through a function
pointer.  Instead, gdb continued straight to the following line
in the calling function:

(gdb) s
422                             error = dkd->d_diskstart(dksc->sc_dev, bp);
(gdb) s
423                             mutex_enter(&dksc->sc_iolock);

Disassembling the caller shows

   0xc0c68906 <dk_start+263>:   call   0xc114263b <__x86_indirect_thunk_eax>

which I assume is retpoline stuff.

>How-To-Repeat:

>Fix:

>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/53715: gdb can't step into indirect calls because
 retpolines
Date: Sat, 10 Nov 2018 13:32:16 +0000

 I suspect upstream GDB has done this work already (or is close).

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.