From owner-svn-src-all@FreeBSD.ORG Tue Nov 11 07:22:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85379C64; Tue, 11 Nov 2014 07:22:41 +0000 (UTC) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DD12F9C; Tue, 11 Nov 2014 07:22:40 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::96f:bc74:b3c9:9d0e] (unknown [IPv6:2001:7b8:3a7:0:96f:bc74:b3c9:9d0e]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 33D9BB80A; Tue, 11 Nov 2014 08:22:36 +0100 (CET) Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: multipart/signed; boundary="Apple-Mail=_BAF2B536-5000-401D-B0A4-A69E296D9104"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.5b1 From: Dimitry Andric In-Reply-To: Date: Tue, 11 Nov 2014 08:22:31 +0100 Message-Id: <23CF9B7D-5AB1-4A16-AC1D-6739B3164771@FreeBSD.org> References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <3279406.bOBVrcribU@ralph.baldwin.cx> To: Adrian Chadd X-Mailer: Apple Mail (2.1990.1) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Luigi Rizzo , John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2014 07:22:41 -0000 --Apple-Mail=_BAF2B536-5000-401D-B0A4-A69E296D9104 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii It is indeed used to calculate an address offset, but as it is already checked against NOCPU, it should be good: gnu/usr.bin/gdb/kgdb/kthr.c: kt->cpu =3D td.td_oncpu; gnu/usr.bin/gdb/kgdb/trgt_i386.c: if (kt =3D=3D NULL || kt->cpu =3D=3D= NOCPU) gnu/usr.bin/gdb/kgdb/trgt_i386.c: addr +=3D (kt->cpu * NGDT + = GPROC0_SEL) * sizeof(sd); Maybe the test could be strengthened to check that kt->cpu >=3D 0, but = it might be overkill. -Dimitry > On 11 Nov 2014, at 00:17, Adrian Chadd wrote: >=20 > just double-check that the cpu id isn't used to size anything; I've > seen it used as an offset into stuff, and NOCPU would've been entry > 255 in the array, not -1. >=20 > Ian pointed this out to me recently and I've only just started digging = into it. >=20 >=20 >=20 > -adrian >=20 >=20 > On 10 November 2014 12:35, John Baldwin wrote: >> On Monday, November 10, 2014 09:13:08 PM Dimitry Andric wrote: >>> I noted something similar for kgdb, when compiled with gcc: >>>=20 >>> cc1: warnings being treated as errors >>> /usr/src/gnu/usr.bin/gdb/kgdb/trgt_i386.c: In function >>> 'kgdb_trgt_fetch_tss': = /usr/src/gnu/usr.bin/gdb/kgdb/trgt_i386.c:142: >>> warning: comparison is always false due to limited range of data = type >>>=20 >>> In gnu/usr.bin/gdb/kgdb/kgdb.h, there is: >>>=20 >>> struct kthr { >>> struct kthr *next; >>> uintptr_t paddr; >>> uintptr_t kaddr; >>> uintptr_t kstack; >>> uintptr_t pcb; >>> int tid; >>> int pid; >>> u_char cpu; >>> }; >>>=20 >>> The cpu field is assigned from td.td_oncpu (which is an int) in >>> kgdb_thr_add_procs(), so I think it should be safe to change it to = an >>> int too: >>>=20 >>> Index: gnu/usr.bin/gdb/kgdb/kgdb.h >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- gnu/usr.bin/gdb/kgdb/kgdb.h (revision 274350) >>> +++ gnu/usr.bin/gdb/kgdb/kgdb.h (working copy) >>> @@ -41,7 +41,7 @@ >>> uintptr_t pcb; >>> int tid; >>> int pid; >>> - u_char cpu; >>> + int cpu; >>> }; >>>=20 >>> extern struct kthr *curkthr; >>=20 >> Yes, please commit. >>=20 >> -- >> John Baldwin --Apple-Mail=_BAF2B536-5000-401D-B0A4-A69E296D9104 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.26 iEYEARECAAYFAlRhuTsACgkQsF6jCi4glqMwGwCgy/uDSpIvgrmjqZykyBOB71FO aJYAoPysTm2dAAiqQR7Cclu2Nqg1FqHm =EfcO -----END PGP SIGNATURE----- --Apple-Mail=_BAF2B536-5000-401D-B0A4-A69E296D9104--