From owner-svn-src-head@freebsd.org Mon Aug 24 13:40:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 591C83C0596; Mon, 24 Aug 2020 13:40:36 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZtYJ1hhfz4p7f; Mon, 24 Aug 2020 13:40:36 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E00519467; Mon, 24 Aug 2020 13:40:36 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07ODeaxW068402; Mon, 24 Aug 2020 13:40:36 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODeaBG068401; Mon, 24 Aug 2020 13:40:36 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202008241340.07ODeaBG068401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 24 Aug 2020 13:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364675 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 364675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:40:36 -0000 Author: luporl Date: Mon Aug 24 13:40:35 2020 New Revision: 364675 URL: https://svnweb.freebsd.org/changeset/base/364675 Log: [PowerPC] Make new auxv format default Assume ELF images without OSREL use the new auxv format. This is specially important for rtld, that is not tagged. Using direct exec mode with new (ELFv2) binaries that expect the new auxv format would result in crashes otherwise. Unfortunately, this may break direct exec'ing old binaries, but it seems better to correctly support new binaries by default, considering the transition to ELFv2 happened quite some time ago. If needed, a sysctl may be added to allow old auxv format to be used when OSREL is not found. Reviewed by: bdragon Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D25651 Modified: head/sys/powerpc/powerpc/elf_common.c Modified: head/sys/powerpc/powerpc/elf_common.c ============================================================================== --- head/sys/powerpc/powerpc/elf_common.c Mon Aug 24 13:19:16 2020 (r364674) +++ head/sys/powerpc/powerpc/elf_common.c Mon Aug 24 13:40:35 2020 (r364675) @@ -36,7 +36,22 @@ __elfN(powerpc_copyout_auxargs)(struct image_params *i Elf_Auxinfo *argarray, *pos; int error; - if (imgp->proc->p_osrel >= P_OSREL_POWERPC_NEW_AUX_ARGS) + /* + * XXX If we can't find image's OSREL, assume it uses the new auxv + * format. + * + * This is specially important for rtld, that is not tagged. Using + * direct exec mode with new (ELFv2) binaries that expect the new auxv + * format would result in crashes otherwise. + * + * Unfortunately, this may break direct exec'ing old binaries, + * but it seems better to correctly support new binaries by default, + * considering the transition to ELFv2 happened quite some time + * ago. If needed, a sysctl may be added to allow old auxv format to + * be used when OSREL is not found. + */ + if (imgp->proc->p_osrel >= P_OSREL_POWERPC_NEW_AUX_ARGS || + imgp->proc->p_osrel == 0) return (__elfN(freebsd_copyout_auxargs)(imgp, base)); args = (Elf_Auxargs *)imgp->auxargs;