From nobody Thu Jun 29 08:20:11 2023 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 4QsBG351Ffz4knWR; Thu, 29 Jun 2023 08:20:11 +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 4QsBG33gpPz3tTm; Thu, 29 Jun 2023 08:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026811; 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=6Q7PPBkAs17GKCZ3LpE5Wh7QfEaGnEsUYlEhiL7SyfY=; b=R/a4Rz+XP9EIklhXA1vC9HqKxc4YVt2UJVH4IG6H9J8KEzs43sG5NDH3QkAOH9uEaIwCjX Xr/iZeHemw/gIExQcQYhty+mTLDyHWSDImMdEDPb0h2g2uz2cqj1CGX+drWPQtT77TwPwt Mzoa7H6DeLfJcJUSpCgIojhEz5/kfmvnCgrCYVaW8mP9Mw3Xs/8e7MRb9owmIwq4L0NM4u govw0wJcjE1rufRxnrfqp0CLB3VjQnp1eEXYeuOUzN8Bifbjfv7MFZwKyVYGKWW1JOcJFB oC69l/oSprfhy4IpYyGTe2K3Vj4C/6fHhR0K9fN08+dKPr/BDVNjjdPOKLOLGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026811; 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=6Q7PPBkAs17GKCZ3LpE5Wh7QfEaGnEsUYlEhiL7SyfY=; b=n0GA7FSUD1dT66KTi1WjtjQi6EVvZ5tKJDxOn7UqUsL+TEyvVQSOy4WdNurZyH1/Avq2aV ezSQ/nkEMxSebK6/uSzyTn0gLVy6SeVceAT0faluM8vK3bPmN2ikh94/3dV/PV27vlLf/x ePGgRq1PB46f5uRNTGCGkPxIz87zwn5m+6FPA7a6yY8/yicvGjWodhFhuHY9VcFMl72Xdi oN56NwH9BGx/m5f47S2w5CIP3eJ+vU7OIAeOy5EXAi50uyH/5+gNMBauQxivwevaoWT2gW DLt69Q9kdEfv8/9jPaKBk4kehnSCgod6CyDB0NKhlLdwjZGvvmoxPS7y1wMH2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688026811; a=rsa-sha256; cv=none; b=adoDXlad2QMXKAbBfO8v3+u6326nUlx2AXYDQxNtj9Zj3RpWWiDDwxeEW0lUzaiCDbpy/8 FhyzOTL1HI7+BVqAXWUE6THm1b9saM1PmvwDeWHLOil2jlRrejhkQszyup0pQo57v2Hni2 LhXEF7QB5Dbj3Zdrn72870/Z/vCZUIafKIRskWLThCCLIjrqtB1nm5Idxz/JpmSIyDaurB vE2mj4xsTaSYTx5yMPl75XH5XBVZ4W/PUFjSo3Kd/6DNYrx/vXbgca0WXMBmX6mmthCICN gaCpiBke7TI12OcwGOs7H+bvX0oeGu3hPA/TPUWT0yd+aksOerHFBCIU4ugMUQ== 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 4QsBG32gM1z182t; Thu, 29 Jun 2023 08:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 35T8KBKY079695; Thu, 29 Jun 2023 08:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 35T8KBKt079689; Thu, 29 Jun 2023 08:20:11 GMT (envelope-from git) Date: Thu, 29 Jun 2023 08:20:11 GMT Message-Id: <202306290820.35T8KBKt079689@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: dde5ee79d043 - stable/13 - linux(4): Don't relie on process osreldata when testing features 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dde5ee79d04385222a9704b704d2d2de0b3758a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=dde5ee79d04385222a9704b704d2d2de0b3758a7 commit dde5ee79d04385222a9704b704d2d2de0b3758a7 Author: Dmitry Chagin AuthorDate: 2023-04-26 13:56:41 +0000 Commit: Dmitry Chagin CommitDate: 2023-06-29 08:15:28 +0000 linux(4): Don't relie on process osreldata when testing features The ELF note identifyies the operating-system ABI that the executable was created for. The note data of the Glibc executable contains the earliest release number of the Linux kernel that supports this ABI. As of a current 2.37 version of Glibc, it is 3.2.0 for x86, 3.7.0 for Aarch64. Glibc does not use this release number and the current kernel's LINUX_VERSION_CODE to detect kernel features, using fallbacks to known previous way in case of ENOSYS or something else instead. A dynamically linked Glibc reads the current kernel's LINUX_VERSION_CODE from the ELF note in the vDSO or fallback to uname syscall if the vDSO can't be located and parse the release field in struct utsname. Glibc uses the current kernel's LINUX_VERSION_CODE for "kernel too old" check. While here use inlined LINUX_KERNVER for tests to improve readability, as suggested by emaste@. MFC after: 1 month (cherry picked from commit 76f8584e49cf7eedaa2e1312593bf46c7225d79a) --- sys/compat/linux/linux_elf.c | 8 ++++---- sys/compat/linux/linux_mib.h | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/compat/linux/linux_elf.c b/sys/compat/linux/linux_elf.c index f335f18e252f..1af861122f81 100644 --- a/sys/compat/linux/linux_elf.c +++ b/sys/compat/linux/linux_elf.c @@ -492,6 +492,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel) int __linuxN(copyout_auxargs)(struct image_params *imgp, uintptr_t base) { + struct thread *td = curthread; Elf_Auxargs *args; Elf_Auxinfo *aarray, *pos; struct proc *p; @@ -526,14 +527,13 @@ __linuxN(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); - if (p->p_osrel >= LINUX_KERNVER_2006030 || p->p_osrel == 0) + if (linux_kernver(td) >= LINUX_KERNVER(2,6,30)) AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary); - if ((p->p_osrel >= LINUX_KERNVER_2006026 || p->p_osrel == 0) && - imgp->execpathp != 0) + if (linux_kernver(td) >= LINUX_KERNVER(2,6,26) && imgp->execpathp != 0) AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, PTROUT(imgp->execpathp)); if (args->execfd != -1) AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); - if (p->p_osrel >= LINUX_KERNVER_5013000 || p->p_osrel == 0) + if (linux_kernver(td) >= LINUX_KERNVER(5,13,0)) AUXARGS_ENTRY(pos, LINUX_AT_MINSIGSTKSZ, imgp->sysent->sv_minsigstksz); AUXARGS_ENTRY(pos, AT_NULL, 0); diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index 41b53d40da3a..7022d811959b 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -58,11 +58,8 @@ int linux_kernver(struct thread *td); #define LINUX_VERSION_STR LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL) #define LINUX_KERNVER_2004000 LINUX_KERNVER(2,4,0) -#define LINUX_KERNVER_2006026 LINUX_KERNVER(2,6,26) -#define LINUX_KERNVER_2006030 LINUX_KERNVER(2,6,30) #define LINUX_KERNVER_2006039 LINUX_KERNVER(2,6,39) #define LINUX_KERNVER_5004000 LINUX_KERNVER(5,4,0) -#define LINUX_KERNVER_5013000 LINUX_KERNVER(5,13,0) #define linux_use54(t) (linux_kernver(t) >= LINUX_KERNVER_5004000)