Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org, Gabriel Krisman Bertazi <gabriel@krisman.be>
Subject: Re: [PATCH] Fix for PR breakpoints/16297: Fix catch syscall to work with syscall 0
Date: Thu, 19 Dec 2013 16:21:00 -0000	[thread overview]
Message-ID: <52B31D02.8010601@redhat.com> (raw)
In-Reply-To: <m3lhzhqz1j.fsf@redhat.com>

On 12/19/2013 03:50 AM, Sergio Durigan Junior wrote:
> @@ -27,6 +29,8 @@ main (void)
>  
>  	chroot (".");
>  
> +	read (0, NULL, 0);

I think the C implementation (libc or the compiler) is
free to skip actually calling the syscall, given bytes is 0.
Something like creating a pipe, and reading a byte off
of it might be safer.  But I won't object to leaving
this as is for now.

>  static int chroot_syscall = SYS_chroot;
> +/* The "read" syscall is zero on x86_64.  */
> +static int read_syscall = SYS_read;

Future readers who might not be familiar with this bug
probably won't realize that the emphasis should be on
zero, rather than the comment just happening to be
trying to be informative.  I'd suggest extending the comment:

+/* GDB had a bug where it couldn't catch syscall number 0.  In most
+   Linux architectures, syscall number 0 is restart_syscall, which
+   can't be called from userspace.  However, the "read" syscall
+   is zero on x86_64.  */
+static int read_syscall = SYS_read;


Otherwise looks fine to me.

Thanks!

-- 
Pedro Alves


  reply	other threads:[~2013-12-19 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-15  3:58 Gabriel Krisman Bertazi
2013-12-15  4:04 ` Sergio Durigan Junior
2013-12-16 17:51   ` Pedro Alves
2013-12-16 17:57     ` Pedro Alves
2013-12-16 18:03       ` Sergio Durigan Junior
2013-12-16 18:35         ` Pedro Alves
2013-12-19  3:50           ` Sergio Durigan Junior
2013-12-19 16:21             ` Pedro Alves [this message]
2013-12-19 19:09               ` Sergio Durigan Junior

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=52B31D02.8010601@redhat.com \
    --to=palves@redhat.com \
    --cc=gabriel@krisman.be \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /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