This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix for PR breakpoints/16297: Fix catch syscall to work with syscall 0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]