Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: Jack Howarth <howarth@bromo.med.uc.edu>
Cc: gdb@sourceware.org
Subject: Re: [ANNOUNCEMENT] GDB 7.0 release process created
Date: Mon, 21 Sep 2009 19:19:00 -0000	[thread overview]
Message-ID: <187A0C0A-28B7-4A51-BE99-47C0F650C1F8@apple.com> (raw)
In-Reply-To: <20090921134617.GA30967@bromo.med.uc.edu>

Sorry, I don't watch the llvm lists.

My understanding was that the OS Security folks were not planning to  
turn off procmod in SnowLeopard.  A quick test shows the Apple gdb  
built setgid procmod but not codesigned was able to debug.  Maybe now  
you do need the plist (see point 1 below...), though?

At some point, however, the procmod access will go away - or so I was  
told...  Here is the "official" way task port access is granted on  
SnowLeopard (this is what will continue to be supported in the future):

1) In order to have task port access, the process has to request it  
using a plist baked into the binary.  If you look at Apple's gdb  
sources in the src/gdb directory, the plist is in the Info.plist file,  
and it gets added by adding a -sectcreate option to the link line in  
the Makefile.

2) Then the binary also has to be codesigned by some authority that is  
recognized by the user.  You can easily make an appropriate  
codesigning authority with the Certificate Assistant which is part of  
the KeyChain Access tool, or if the FSF already has one that you can  
use, that's even better.  I make an unvalidated one by hand for my own  
development purposes, and there's a target in the gdb Makefile:  
"codesign-gdb" that does the codesigning on the gdb binary if you need  
to see how that is done.  The annoying bit here is that you have to  
ship and install the certificate along with the binary, since the user  
has to say they trust it.

3) There's another trick to this, however, which is that even if you  
fill these requirements, the user will be asked to authenticate to use  
the debugger once per login session.  This is done by the taskgated  
daemon that "task_for_pid" calls down to, and it will put up a dialog  
box if gdb is running in a session that can connect to the Window  
Server.  That's okay for gdb running in a terminal session on your  
local machine, but doesn't work if you are ssh'ed into the machine.   
Fortunately there are API's that you can use to request this  
permission so you can query for the password in the terminal if you  
want.  There's a function "macosx_get_task_for_pid_rights" in the  
SnowLeopard sources for gdb (in macosx-nat-inferior.c) that does just  
that.

The gdb that Apple ships gets special treatment  because it is  
codesigned by the Apple codesigning authority.  I forget all the  
details, but I don't think that this treatment is available to non- 
Apple codesigned apps.

Again, I am pretty sure steps 2 & 3 are NOT necessary for SnowLeopard.

Jim


On Sep 21, 2009, at 6:46 AM, Jack Howarth wrote:

> On Mon, Sep 21, 2009 at 03:35:55PM +0200, Jonas Maebe wrote:
>>
>> Apple's gdb developers are usually quite responsive on Apple's xcode-
>> users list: http://lists.apple.com/mailman/listinfo/xcode-users
>>
>>
>> Jonas
>
> Jonas,
>   I'll wait and see what response I get from my post on llvm-dev first
> (as all the heavy lifting is on llvm/clang at Apple now). Actually, I
> just found out on llvm-dev last Friday that libgcc in Snow Leopard is
> actually subsumed into libSystem now (and the FSF libgcc is never
> actually used). Never heard that anywhere else before. Makes life
> interesting when a compiler is creating exception handling for a  
> completely
> different unwinder than the one actually used at runtime.
>              Jack


  parent reply	other threads:[~2009-09-21 19:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 22:20 Joel Brobecker
2009-09-18  0:42 ` Tom Tromey
2009-09-18  0:49 ` Hui Zhu
2009-09-20  2:54 ` Jack Howarth
2009-09-20  3:50   ` Paul Pluzhnikov
2009-09-20 14:32     ` Joel Brobecker
2009-09-20 15:02       ` Paul Pluzhnikov
2009-09-20 15:28         ` Joel Brobecker
2009-09-20 16:14           ` Paul Pluzhnikov
2009-09-20 17:12             ` Joel Brobecker
2009-09-20 17:36               ` Jack Howarth
2009-09-20 17:40                 ` Joel Brobecker
2009-09-20 18:37                 ` Paul Pluzhnikov
2009-09-20 19:12                   ` Jack Howarth
2009-09-20 20:22                     ` Paul Pluzhnikov
2009-09-21  4:34                   ` Joel Brobecker
2009-09-21 12:57                     ` Jack Howarth
2009-09-21 13:36                       ` Jonas Maebe
2009-09-21 13:46                         ` Jack Howarth
2009-09-21 13:55                           ` Jonas Maebe
2009-09-21 19:19                           ` Jim Ingham [this message]
2009-09-22 12:59                             ` Mark Wielaard
2009-09-22 13:30                               ` Jonas Maebe
2009-09-22 14:31                                 ` Mark Wielaard
2009-09-22 15:56                                   ` Daniel Jacobowitz
2009-09-22 17:10                                     ` Jack Howarth
2009-09-22 17:34                                       ` Daniel Jacobowitz
2009-09-22 18:11                                         ` Mark Wielaard
2009-09-22 19:28                                           ` Tom Tromey
2009-09-21 13:26                     ` Jack Howarth
2009-09-20 16:19       ` Paul Pluzhnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=187A0C0A-28B7-4A51-BE99-47C0F650C1F8@apple.com \
    --to=jingham@apple.com \
    --cc=gdb@sourceware.org \
    --cc=howarth@bromo.med.uc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox