From owner-freebsd-current@FreeBSD.ORG Thu Feb 14 17:39:01 2008 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 1073F16A419; Thu, 14 Feb 2008 17:39:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id AD0B313C469; Thu, 14 Feb 2008 17:39:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=skuns.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JPi2y-000HXy-Mn; Thu, 14 Feb 2008 19:38:59 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id m1EHcTo2040052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 14 Feb 2008 19:38:29 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m1EHcohc000979; Thu, 14 Feb 2008 19:38:50 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m1EHcovm000978; Thu, 14 Feb 2008 19:38:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 14 Feb 2008 19:38:50 +0200 From: Kostik Belousov To: Ruslan Ermilov Message-ID: <20080214173850.GB57756@deviant.kiev.zoral.com.ua> References: <200802122009.m1CK94Y8026959@repoman.freebsd.org> <20080212200911.B49F416A51C@hub.freebsd.org> <20080212204803.GT57756@deviant.kiev.zoral.com.ua> <20080213113530.GB45243@team.vega.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SDgf156dd35oTvQ6" Content-Disposition: inline In-Reply-To: <20080213113530.GB45243@team.vega.ru> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 44556c58cf61beb49de4494ee559d59c X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 2238 [Feb 14 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: current@freebsd.org Subject: Re: [src] cvs commit: src/include unistd.h src/lib/libc/sys readlink.2 src/sys/compat/freebsd32 syscalls.master src/sys/kern syscalls.master vfs_syscalls.c src/sys/sys syscallsubr.h 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: Thu, 14 Feb 2008 17:39:01 -0000 --SDgf156dd35oTvQ6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 13, 2008 at 02:35:30PM +0300, Ruslan Ermilov wrote: > [ Replying to the list. ] >=20 > On Tue, Feb 12, 2008 at 10:48:04PM +0200, Kostik Belousov wrote: > > > -int readlink(const char *, char *, int); > > > +ssize_t readlink(const char *, char *, size_t); > > You do understand that this changes the ABI ? size_t and int have diffe= rent > > sizes on 64-bit arches, and now upper-half of the register used to pass > > the third arg is used. Amd64, fortunately, makes very hard to load a > > non-zero into the upper half, I am not so sure about IA64/sparc64. >=20 > I considered that. I've tested locally on amd64 and sparc64, and > ia64 on pluto2.freebsd.org. Since this is only a third argument, > it's passed in a 64-bit register, and for any meaningful value of it > (0 .. INT_MAX), there's no ABI change at all. I compared .s files. >=20 > : // cc -S a.c ; mv a.s a.s~ ; cc -S -DNEW a.c ; diff -u a.s~ a.s > : #include > : #include > :=20 > : #ifdef NEW > : ssize_t readlink(const char *, char *, size_t); > : #else > : int readlink(const char *, char *, int); > : #endif > :=20 > : void > : foo(void) > : { > : int i; > : char buf[1024]; > :=20 > : i =3D readlink("foo", buf, INT_MAX); > : } >=20 > > This change, IMHO, requires symbol version compat shims. >=20 > I don't think so. >=20 The slightly contrived example below works on RELENG_7 amd64, relevant output from the truss is readlink("/usr/X11R6","l",1) =3D 1 (0x1) on the CURRENT gives readlink("/usr/X11R6","l",1) =3D -4294967295 (0xffffff= ff00000001) [also please note wrong output for the third readlink arg; ktrace/kdump wor= ks ok]. .text .globl main main: movq $0xffffffff00000001, %rax movq %rax, %rdx movq $buf, %rax movq %rax, %rsi movq $path, %rax movq %rax, %rdi call readlink xorl %edi, %edi call exit =09 .section .rodata path: .asciz "/usr/X11R6" .data .comm buf, 0x80 --SDgf156dd35oTvQ6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAke0fKoACgkQC3+MBN1Mb4ihVwCdFFM1vg9XgQ7PdiavELg/fON1 SwgAoI5PdJmT0l178tad+m8HyvXRrQdh =LphW -----END PGP SIGNATURE----- --SDgf156dd35oTvQ6--