From owner-freebsd-current@FreeBSD.ORG Sun Dec 16 19:35:02 2007 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71D5916A469 for ; Sun, 16 Dec 2007 19:35:02 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.188]) by mx1.freebsd.org (Postfix) with ESMTP id 32E6913C4EA for ; Sun, 16 Dec 2007 19:35:01 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by rv-out-0910.google.com with SMTP id l15so1773072rvb.43 for ; Sun, 16 Dec 2007 11:35:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; bh=J+kks+plUCRyikMrX7PD/odxaeUzHlG1aPk8X40IeK0=; b=LuxtorH04JVq3Hhjm5WH6Ga0xAJnTNKUdLzPz7ipq8PaIsgwR9wN03ZYRvKysZxa+sYqGQYuKqHJTS/XBUteZYfLxvNEdWtjghPgK0lPuflOjrrvtRDfo8RaBJd9wJbANSL25r1Cylk3RG7ymkQb/8McfIIq53aFWa3hN7lQrCU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; b=OIWOyPkdss9Drt4URJRUzRUTyzopz3Uc1KetN3h+Sspl+6FhAyerQRm8UDy6wjs+A0iLiqQhtCYtWUz7dqCF3GsE/+mK2+NI22zwj/KzRfjMVITHTrTLqCFT7NMLytpSBtsNTnBE/fjHRmBzxOTgV28VsuxJOvJnmjGQ4CXvCfU= Received: by 10.141.99.4 with SMTP id b4mr3382011rvm.208.1197833701449; Sun, 16 Dec 2007 11:35:01 -0800 (PST) Received: from kan.dnsalias.net ( [24.218.183.247]) by mx.google.com with ESMTPS id a42sm14344259rne.2007.12.16.11.34.59 (version=SSLv3 cipher=OTHER); Sun, 16 Dec 2007 11:34:59 -0800 (PST) Date: Sun, 16 Dec 2007 14:34:54 -0500 From: Alexander Kabaev To: Maxim Konovalov Message-ID: <20071216143454.7239c97b@kan.dnsalias.net> In-Reply-To: <20071216211832.X83419@mp2.macomnet.net> References: <20071216211832.X83419@mp2.macomnet.net> X-Mailer: Claws Mail 3.0.2 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/T4uhsuUO0aRf_uvZtbOHjX="; protocol="application/pgp-signature"; micalg=PGP-SHA1 Cc: current@freebsd.org Subject: Re: route(8) core dump, possible gcc(1) related X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2007 19:35:02 -0000 --Sig_/T4uhsuUO0aRf_uvZtbOHjX= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 16 Dec 2007 21:27:17 +0300 (MSK) Maxim Konovalov wrote: > Hello, >=20 > gcc w/ default flags: >=20 > # route add 172.19.16.0.0/16 10.10.10.2 > zsh: segmentation fault (core dumped) >=20 > gcc -O0: >=20 > # route add 172.19.16.0.0/16 10.10.10.2 > route: bad address: 172.19.16.0.0/16 >=20 > I failed to find any bugs in this code snippet where route(8) > dumps a core (line 1041): >=20 > 1033 q =3D strchr(s,'/'); > 1034 if (q && which =3D=3D RTA_DST) { > 1035 *q =3D '\0'; > 1036 if ((val =3D inet_network(s)) !=3D INADDR_NONE) { > 1037 inet_makenetandmask( > 1038 val, &su->sin, strtoul(q+1, > 0, 0)); 1039 return (0); > 1040 } > 1041 *q =3D '/'; > 1042 } >=20 > Any comments? >=20 Preliminary results show that inet_network from libc is somehow thrashing $ebx even if it is not supposed to. -O0 disables value caching in register and always allocates stack slot for the 'q' pointer, so the problem is not visible. Thanks for the test case, I'll look some more.=20 --=20 Alexander Kabaev --Sig_/T4uhsuUO0aRf_uvZtbOHjX= Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHZX3eQ6z1jMm+XZYRAvKQAJ9LZTxPEdLmU1qPrSekZotVU4nHnQCfUeCC qHrxw3OT2DiEE4BSHCgArTk= =9xgT -----END PGP SIGNATURE----- --Sig_/T4uhsuUO0aRf_uvZtbOHjX=--