NetBSD Problem Report #46476

From dyoung@ojctech.com  Wed May 23 16:40:15 2012
Return-Path: <dyoung@ojctech.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 7C6B863B88D
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 23 May 2012 16:40:15 +0000 (UTC)
Message-Id: <20120523164035.10C9627C48@cuw.ojctech.com>
Date: Wed, 23 May 2012 11:40:35 -0500 (CDT)
From: dyoung@ojctech.com
Reply-To: dyoung@ojctech.com
To: gnats-bugs@gnats.NetBSD.org
Subject: on i386, gdb silently fails to set a breakpoint on PaX-MPROTECTed binary
X-Send-Pr-Version: 3.95

>Number:         46476
>Category:       toolchain
>Synopsis:       on i386, gdb silently fails to set a breakpoint on PaX-MPROTECTed binary
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    christos
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 23 16:45:00 +0000 2012
>Closed-Date:    Fri Oct 06 21:35:21 +0000 2017
>Last-Modified:  Fri Oct 06 21:35:21 +0000 2017
>Originator:     David Young
>Release:        NetBSD 5.1rc4
>Organization:
>Environment:
>Description:
        When I try to set a breakpoint in a program that's protected
        with 'paxctl +M', the breakpoint isn't actually activated
        because of the MPROTECTion, but gdb does not tell me so
        because of some deficiency in gdb's error checking.

	gdb needs to check for and report the failure.

>How-To-Repeat:
	% paxctl +M program
	% gdb program
	(gdb) break main
	(gdb) run
	*never breaks*
>Fix:
	Improve error checking, but how?

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: toolchain-manager->christos
Responsible-Changed-By: dyoung@NetBSD.org
Responsible-Changed-When: Wed, 23 May 2012 17:13:50 +0000
Responsible-Changed-Why:
Christos says to assign this to him.  Thank you, Christos.


From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46476: on i386, gdb silently fails to set a breakpoint on PaX-MPROTECTed binary
Date: Wed, 23 May 2012 13:20:30 -0400

 On May 23,  4:45pm, dyoung@ojctech.com (dyoung@ojctech.com) wrote:
 -- Subject: toolchain/46476: on i386, gdb silently fails to set a breakpoint 

 Works on current, what version is it broken (kernel version, userland version,
 gdb version)?

 GNU gdb (GDB) 7.3.1
 Copyright (C) 2011 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 and "show warranty" for details.
 This GDB was configured as "i486--netbsdelf".
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>...
 Reading symbols from /net/shiny/src-6/NetBSD/cvsroot/src/external/gpl3/gdb/bin/gdb/hello...done.
 (gdb) break main
 Breakpoint 1 at 0x8048709: file hello.c, line 6.
 (gdb) r
 Starting program: /net/shiny/src-6/NetBSD/cvsroot/src/external/gpl3/gdb/bin/gdb/hello 
 Warning:
 Cannot insert breakpoint 1.
 Error accessing memory address 0x8048709: Input/output error.
 Cannot insert breakpoint -1.
 Temporarily disabling shared library breakpoints:
 breakpoint #-1

 (gdb) q

State-Changed-From-To: open->closed
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Fri, 06 Oct 2017 23:35:21 +0200
State-Changed-Why:
GDB and any other debugger via ptrace(2) can set breakpoints now with PaX MPROTECT

$ sysctl -d security.pax.mprotect.ptrace                                                                                                                                               
security.pax.mprotect.ptrace: When enabled, allow ptrace(2) to override mprotect permissions on traced processes


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.