From owner-freebsd-amd64@FreeBSD.ORG Sun Dec 5 17:38:13 2010 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 954201065674 for ; Sun, 5 Dec 2010 17:38:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id E764E8FC23 for ; Sun, 5 Dec 2010 17:38:12 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oB5HOtbQ064001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 5 Dec 2010 19:24:55 +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.4/8.14.4) with ESMTP id oB5HOtIM003503; Sun, 5 Dec 2010 19:24:55 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oB5HOtsA003502; Sun, 5 Dec 2010 19:24:55 +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: Sun, 5 Dec 2010 19:24:55 +0200 From: Kostik Belousov To: pfgshield-freebsd@yahoo.com Message-ID: <20101205172455.GB184@deviant.kiev.zoral.com.ua> References: <201012051355.oB5Dtex4077823@freefall.freebsd.org> <739586.26564.qm@web113517.mail.gq1.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2B/JsCI69OhZNC5r" Content-Disposition: inline In-Reply-To: <739586.26564.qm@web113517.mail.gq1.yahoo.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-amd64@freebsd.org, avg@freebsd.org, bug-followup@freebsd.org Subject: Re: amd64/124134: [kernel] The kernel doesn't follow the calling convention in the SVR4/i386 ABI X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Dec 2010 17:38:13 -0000 --2B/JsCI69OhZNC5r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 05, 2010 at 07:08:07AM -0800, pfgshield-freebsd@yahoo.com wrote: > The code has certainly changed a lot ... >=20 > Reading the posting on the link with a possible fix: >=20 > "... > Can you try to add to kernel sources, into file sys/amd64/amd64/machdep.c > function exec_setregs(td, entry, stack, ps_strings) > somewhere at the end >=20 > pcb->pcb_flags |=3D PCB_FULLCTX; > ... " >=20 > We don't have anything similar to this in exec_setregs(), and from my und= erstanding the issue could not be easily fixed without breaking binary comp= atibility so I would think the issue is still there. >=20 > This PR was only for reference though as it doesn't cause trouble for us:= I'm OK with the PR being closed. >=20 I looked at the PR before. Looking again now, I have the same conclusion, that is I do not understand what is the issue. On the first return into usermode after the successfull execve(2), kernel sets the following registers: - %rsp (properly aligned) - %rdi (1st parameter in usermode ABI; contains the pointer to startup frame, i.e. &argc) - all other GP registers are zeroed. ABI rev. 0.99 requires the following setup: - %rsp properly aligned and has the value &argc - %rdx points to a function to be registered with atexit(3), or NULL. We do satisfy the ABI requirement for %rdx content in the trivial way, by passing 0. The layout of the startup frame also seems conforming. --2B/JsCI69OhZNC5r Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkz7yuYACgkQC3+MBN1Mb4g0+gCdHr3LI4WutdnTD8He0+hFYF72 Z6IAoMXjfMPwXwmBlJhaxXlG+gV9vs4t =yePc -----END PGP SIGNATURE----- --2B/JsCI69OhZNC5r--