From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74455 invoked by alias); 19 Jun 2017 13:26:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 73640 invoked by uid 89); 19 Jun 2017 13:26:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*r:508, H*c:application X-HELO: vmicros1.altlinux.org Date: Mon, 19 Jun 2017 13:26:00 -0000 From: "Dmitry V. Levin" To: libc-alpha@sourceware.org Subject: Re: [PATCH] S390: Sync ptrace.h with kernel. [BZ #21539] Message-ID: <20170619132645.GA10947@altlinux.org> Mail-Followup-To: libc-alpha@sourceware.org References: <20170613200522.GA14306@altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: X-SW-Source: 2017-06/txt/msg00802.txt.bz2 --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2350 On Mon, Jun 19, 2017 at 03:10:57PM +0200, Stefan Liebler wrote: > On 06/13/2017 10:05 PM, Dmitry V. Levin wrote: > > On Tue, Jun 06, 2017 at 12:17:33PM +0200, Stefan Liebler wrote: > > [...] > >> diff --git a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c b/s= ysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c > >> new file mode 100644 > >> [...] > >> + /* Get information about tracee: gprs, last breaking address. = */ > >> + parea.len =3D sizeof (regs); > >> + parea.process_addr =3D (unsigned long) ®s; > >> + parea.kernel_addr =3D 0; > >> + ptrace (PTRACE_PEEKUSR_AREA, pid, &parea); > >=20 > > Note that you can verify whether PTRACE_PEEKUSR_AREA has returned > > the expected result by comparing registers with those returned > > by PTRACE_GETREGSET. The latter is implemented on s390 since > > linux 2.6.27 so its use in glibc is safe. > >=20 > Okay. Now the gprs are obtained by PTRACE_PEEKUSR_AREA and=20 > PTRACE_GETREGSET. Afterwards I use memcmp to check whether the values=20 > are the same. > >> + ptrace (PTRACE_GET_LAST_BREAK, pid, NULL, &last_break); > >=20 > > As these ptrace calls are expected to succeed, > > you might want to check their return code. > >=20 > Done with several usages of TEST_VERIFY_EXIT. >=20 > >> + > >> + printf ("child IA: %p last_break: %p\n", > >> + (void *) regs[1], (void *) last_break); > >> + > >> + /* Execute tracee until next taken branch. > >> + > >> + Note: > >> + Before the commit which introduced this testcase, > >> + /sysdeps/unix/sysv/linux/s390/sys/ptrace.h > >> + uses ptrace-request 12 for PTRACE_GETREGS, > >> + but /include/uapi/linux/ptrace.h > >> + uses 12 for PTRACE_SINGLEBLOCK. > >> + > >> + The s390 kernel has no support for PTRACE_GETREGS! > >> + Thus glibc ptrace.h is adjusted to match kernel ptrace.h. > >> + > >> + This test ensures, that PTRACE_SINGLEBLOCK defined in glibc > >> + works as expected. If the kernel would interpret it as > >> + PTRACE_GETREGS, then the tracee will not make any progress > >> + and this testcase will time out. */ > >> + ptrace (req_singleblock, pid, NULL, NULL); > >=20 > > Likewise. >=20 > I've attached the patch with the mentioned changes and the NEWS entry=20 > requested by Andreas. >=20 > Is this okay? Looks fine, thanks. --=20 ldv --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature; name="signature.asc" Content-length: 801 -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJZR9EVAAoJEAVFT+BVnCUIHksP/2tUx2OvK8Z8JG/rdFxc4kLN 0BrVsAsN6Y2sjjNbToCkASwElj6s8MSNEXXNa1o4CDAGL/gIb93yHJEk37J6/WcL PSQWzsG9jXxBItqS5ZmXAbDK4v02g33Z7AdF4CqHya0JsHxTEPBGaRYyHNfZpEnk A1Gs3WgK0wyNeZru4dgSwN4m2VVp3jAuK2JcX6pqpc04vY1YHZ2Bb3arrG3xLisy YUXWuqZABkJwFfsUjRE9i9IZcy4UWej2qfbc2duHtRNqWLyvMJzrLcrfZOTElAIP D8L25t/hVoCuSe3uNXApCoGAm1DALCi5hujQizbTkToZtTUXPLusFQINvjBAmXPv JmhDu0ZH1kiwIQvvcjMEWD8qmZCj2xBVaFGiWPGtFG9l3tc5Ke/vQKXUfyVFIqlj x0VPz76YJKsTRPdHziEhKfSbdPMQ+G4nLnW5Lw4Yz2eIuuqfo+HU4e/3PaRCmbP6 4jaqfcM4JMZdircHKeHchEcnhMVrrGFfIk/j4Er5QvQtK38rT1ce0Fb2OGaTdviM CPHvmjtjhCGtFWGwajyB7s/od/TxNzH5Su8Wacfi81r8paNkTtDISkTcMKzDzn04 Hx7xkyD9MyBDJcAbS7BkTxFA3d0GdJlxp9UJeE9lMbbe2x8TcMKzXOiEi+AMJsR/ UA8ced0/GGsgiD+Dqwpu =/60N -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--