From nobody Thu Feb 17 10:55:24 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A992A19D49C2; Thu, 17 Feb 2022 10:55:24 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JzsDX4NH9z4jpB; Thu, 17 Feb 2022 10:55:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645095324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C9W3j6+FFfpX79akrYpvEiBo6P/ZrtLjq2zUDsiZD2I=; b=FTB5Z7HcOmhRlHignI/XeRrayM9ABA9qOADz/DzCnaMHSfF4GocrUWCXniPrQwi97BhlEj Lz6mLAHtJbClU/C/2Zszg60wakE/4waWDG8eKvtdBZXyI/H4n12E9YQG6aB2dc0K7wrI0S YIspQi45g1W0X+jWOCn+C9hCjfxD6VpKafaebLvjX6ZxshUDfj4xOEGQD85EVLrZ3TchL7 B+r/QJaJofoLv8vpQeWWUkozjmwNdu6yOychgI9JA1XXJopNwxtcQI7qZt+iyhzRHX8wVC EX0BE8O85g1+hNM+VKZj2V+ZHgGJLPbA+HkRwhqHW2vaoA8DabuCnRHb3+6iDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7628B9B4; Thu, 17 Feb 2022 10:55:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21HAtO5k019881; Thu, 17 Feb 2022 10:55:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21HAtObA019880; Thu, 17 Feb 2022 10:55:24 GMT (envelope-from git) Date: Thu, 17 Feb 2022 10:55:24 GMT Message-Id: <202202171055.21HAtObA019880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 187a63535228 - stable/13 - linux: adjust ordering of Linux auxv and add dummy AT_HWCAP2 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 187a635352288a11735c095690b36a2583d5701d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645095324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C9W3j6+FFfpX79akrYpvEiBo6P/ZrtLjq2zUDsiZD2I=; b=LYjBKU88Io1JnJZ6tdHX+sP8/EHkJsaZ/JKCDC/MbjNCCheivjWphKIzSgvodvJhE77TUu P2WxjrySFz31QHoC1zP3W81uV0CIeDWqo+/evPzfmPB6hE6SbIZ+oRxTKbx0d4LuJc2mNi qUxPIdYw/o/2YD8cxtnE2pRlbDuA8n0Wdd38N1wgC/v2rf8M/QP8IhDHNjRsmu9QgHGT7B WL1gYny78Tq3WavR7yUSI65WrJyf/xCW9RfmzevDpoz6VDClhQbljVnlCAW67Msx7R7C0N ErWfjle9BSKbyy3sMyCmv+c3fOjqJNTnE6007S+BtW8RS1erQt9hKgXPOBDJZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645095324; a=rsa-sha256; cv=none; b=FvvhTQtV3SmCOvd7ebS0YDbgW5Jvcwf1rctE3RXfzvKUZR5cSRB5wT1JkKjFrFjRgoIfpV 01JJj1+/LuCTcZcenklwUj5BsPc6SuAsbF1HECcPxlXFneR4ebIHgannYeceHfwDRnMiai 2WK3/nV4UKcswZJN5tPyI0m6PTgsvgdaF/pK/cLeYLmyBKpLwlbd2FEUOspoPtvX4Agzxi gIYEeVjR0CBzKLw8Km62HAbxCPEJuKHmNl3VGm+jVJYRT+nrddXaYMEu/aGKbxipYNgsLA jrgYSw8lMGl0hktLKYi28/+JXszRq+WpGt6hS+ezHqKjhlV5NmvPfqrhYr6Y/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=187a635352288a11735c095690b36a2583d5701d commit 187a635352288a11735c095690b36a2583d5701d Author: Edward Tomasz Napierala AuthorDate: 2021-04-13 11:38:37 +0000 Commit: Edward Tomasz Napierala CommitDate: 2022-02-13 21:06:37 +0000 linux: adjust ordering of Linux auxv and add dummy AT_HWCAP2 This should be a no-op; the purpose of this is to reduce a spurious difference between Linuxulator and Linux, to make debugging core dumps slightly easier. Note that AT_HWCAP2 we pass to Linux binaries is always 0, instead of being equal to 'cpu_feature2'. This matches what I've observed under Ubuntu Focal VM. Reviewed By: chuck, dchagin Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29609 (cherry picked from commit ca6e1fa3ce87f56847633530cb94a6fb63405680) --- sys/amd64/linux/linux.h | 2 +- sys/amd64/linux/linux_sysvec.c | 5 +++-- sys/amd64/linux32/linux.h | 2 +- sys/amd64/linux32/linux32_sysvec.c | 11 ++++++----- sys/compat/linux/linux_misc.h | 1 + 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index d343f920f6eb..cf9f5cccb287 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -88,7 +88,7 @@ typedef struct { /* * Miscellaneous */ -#define LINUX_AT_COUNT 19 /* Count of used aux entry types. */ +#define LINUX_AT_COUNT 20 /* Count of used aux entry types. */ struct l___sysctl_args { diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index d4d7146ae224..ad1b286845df 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -265,11 +265,11 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR, imgp->proc->p_sysent->sv_shared_page_base); AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); - AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); AUXARGS_ENTRY(pos, AT_BASE, args->base); AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); @@ -278,12 +278,13 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid); - AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary); + AUXARGS_ENTRY(pos, LINUX_AT_HWCAP2, 0); if (imgp->execpathp != 0) AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp); if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index e79d16e9e28a..244daba4b5c0 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -101,7 +101,7 @@ typedef struct { /* * Miscellaneous */ -#define LINUX_AT_COUNT 20 /* Count of used aux entry types. +#define LINUX_AT_COUNT 21 /* Count of used aux entry types. * Keep this synchronized with * linux_fixup_elf() code. */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 935d755e1904..c09d18675448 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -199,10 +199,11 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) M_WAITOK | M_ZERO); issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; + AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO, linux32_vsyscall); AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR, imgp->proc->p_sysent->sv_shared_page_base); - AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO, linux32_vsyscall); AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); /* * Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0, @@ -217,21 +218,21 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); - AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); + AUXARGS_ENTRY(pos, AT_BASE, args->base); AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); - AUXARGS_ENTRY(pos, AT_BASE, args->base); - AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid); AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); + AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid); AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, PTROUT(imgp->canary)); + AUXARGS_ENTRY(pos, LINUX_AT_HWCAP2, 0); if (imgp->execpathp != 0) AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, PTROUT(imgp->execpathp)); if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index da76753e3d24..bd8b2f3f63b4 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -88,6 +88,7 @@ extern const char *linux_kplatform; * differ from AT_PLATFORM. */ #define LINUX_AT_RANDOM 25 /* address of random bytes */ +#define LINUX_AT_HWCAP2 26 /* CPU capabilities, second part */ #define LINUX_AT_EXECFN 31 /* filename of program */ #define LINUX_AT_SYSINFO 32 /* vsyscall */ #define LINUX_AT_SYSINFO_EHDR 33 /* vdso header */