From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25514 invoked by alias); 19 Dec 2013 16:21:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25489 invoked by uid 89); 19 Dec 2013 16:21:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Dec 2013 16:21:31 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBJGLOPj023420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 19 Dec 2013 11:21:24 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBJGLMKj002882; Thu, 19 Dec 2013 11:21:23 -0500 Message-ID: <52B31D02.8010601@redhat.com> Date: Thu, 19 Dec 2013 16:21:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Sergio Durigan Junior CC: gdb-patches@sourceware.org, Gabriel Krisman Bertazi Subject: Re: [PATCH] Fix for PR breakpoints/16297: Fix catch syscall to work with syscall 0 References: <87fvpu4vgh.fsf@lestat.krisman.be> <52AF3DA0.3020406@redhat.com> <52AF3F0F.3030107@redhat.com> <52AF47D5.1040304@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-12/txt/msg00750.txt.bz2 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