From nobody Sat Jun 10 18:33: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 4Qdmm81SWqz4cKJr; Sat, 10 Jun 2023 18:33:12 +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 4Qdmm813H8z47f2; Sat, 10 Jun 2023 18:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686421992; 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=NWhUiUaLe0Wu+fZZfFcptf9rtlk6d9jpBSqLnqyT3UI=; b=qlVj1jDVLpajobuJ1lKdbhK/an+NVLya/6iwtAGBrL7b+f/ASvKltZvNcdXQVvHwyNRgQe 9Mxj0Tdw1uMvf6SNmBCNrXzgbMeVZs6o5SjjsPhAOQ/F4q2/V3uTyvyfT9qT3Cz4MIW5HK SLhT7gKcoOhkpiK0Gadw8EIDJr/Ku2c3qxNobzJ02Zrq7TsiLBc6Msr0/zbAh5u6f3ESQw jCn3XOWrEb0F4++zycfUeJUXbGe9z17ySYJY2IvR24PBgTncFdOIBirdUKeeIAaPtHxFog Bv4wnIKMuoc+/t/YpUCHxSaAPUTCiQj84qA8ydHxTk+e6XAsJ0ZjqY4oKQHDnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686421992; 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=NWhUiUaLe0Wu+fZZfFcptf9rtlk6d9jpBSqLnqyT3UI=; b=mCEH9UvZc6y2K88q/ATy+8Rf2cL9m0PCfX9cMxhoRFteFYsmSymezpPhTOj857C4wW5HKH SJ5R7/JfTKmPrmgjqNOZCAI7/AK6qGzvwVD1tHSa0pt++rPLOSTI9UkrUXRMNis4QEln+g lDPONgq+pzcgZKlB40VKLxTB3BofP0BXfNjuggVeCWXYlyqMx/2XubH0C74H848HBVLqkY 5eo9O1T+mVo/1y0I6x9y5MpR7bxkFJ8r55GXVKb6SNmT6WfCpn/QHFWFaHz/oxO5NcCbt0 ++OMJ8xAh8wWHXnyPozZiTxp+uUKKjArObp/5pMgkTPEvHBB+cS1gDshth+Awg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686421992; a=rsa-sha256; cv=none; b=R4MmQaZWH+GskvBJED8jzgP2eEtk6AcQtf2o1NUcQPnt20EL1Cclolqkia4TCfuyR5Ntct /aCK1qbcm8q8WlhU87yBELoxfFX/DYGLLbXFZVlNRLAEXmXT17NXB+NjKkdVhjIOfMjl4V vsx2kB7OzSQTvwfF2dHSbnJQYQKM5ugNcX1yuk7hSVjcHg3gBByA4+GnmjwT5ox8P26s2N 7NZQWdlF+ONXCl9rVtjw0EW0v/9wCepZcbMbBFhjRyj8L+f47c0yUNrs7OEc2DMQ+RrCSx aC9kGvHpV/mjbjXD9hNzIwemzkYyhJ4knM1LbsUwUKp7AkhXt4XNr7wogVHxRg== 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 4Qdmm8078zzSQ0; Sat, 10 Jun 2023 18:33:12 +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 35AIXB3E014663; Sat, 10 Jun 2023 18:33:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35AIXBpO014662; Sat, 10 Jun 2023 18:33:11 GMT (envelope-from git) Date: Sat, 10 Jun 2023 18:33:11 GMT Message-Id: <202306101833.35AIXBpO014662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Graham Perrin Subject: git: 0c2cdf496834 - stable/13 - rc(8): document how to reload rc's configuration 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: grahamperrin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c2cdf496834490ab25b763ee7cae5d006d39729 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by grahamperrin: URL: https://cgit.FreeBSD.org/src/commit/?id=0c2cdf496834490ab25b763ee7cae5d006d39729 commit 0c2cdf496834490ab25b763ee7cae5d006d39729 Author: Mina Galić AuthorDate: 2023-06-02 18:01:03 +0000 Commit: Graham Perrin CommitDate: 2023-06-10 18:32:15 +0000 rc(8): document how to reload rc's configuration The fact that rc(8) only reads its configuration once is in the man page, but how to trigger a reload is only in the code. Discovered while trying to make cloud-init disable and stop syslogd. Thanks to RhodiumToad for providing the words. Reviewed by: debdrup, grahamperrin Approved by: grahamperrin, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D40329 (cherry picked from commit 0981275c75d5678172eb9dd8fbc89ef61c05c979) --- share/man/man8/rc.8 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/share/man/man8/rc.8 b/share/man/man8/rc.8 index 8b6fc094b7db..14cc83d8e32d 100644 --- a/share/man/man8/rc.8 +++ b/share/man/man8/rc.8 @@ -31,7 +31,7 @@ .\" @(#)rc.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd July 4, 2022 +.Dd June 1, 2023 .Dt RC 8 .Os .Sh NAME @@ -124,10 +124,9 @@ to load various .Xr rc.subr 8 shell functions to use. .It -Load the configuration files. +Load the configuration files (see below for reloading). .It -Determine if booting in a jail, -and add +Determine if booting in a jail, and add .Dq Li nojail (no jails allowed) or .Dq Li nojailvnet @@ -371,6 +370,17 @@ the command name (see the .Sx EXAMPLES section). .Pp +The configuration files are normally read only once at the start of a boot +sequence; if a script needs to +.Cm enable +or +.Cm disable +any other script that would run later in the sequence, it must send a +.Dv SIGALRM +to the rc process (identified by +.Ev $RC_PID ) +to have it re-read the files. +.Pp The following key points apply to old-style scripts in .Pa /usr/local/etc/rc.d/ : .Bl -bullet From nobody Sun Jun 11 20:09:03 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 4QfQrJ102Nz4cpwG; Sun, 11 Jun 2023 20:09:04 +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 4QfQrH5klnz3HGH; Sun, 11 Jun 2023 20:09:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686514143; 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=R16RFMHsz6buM2tTMKCQBWEPTSGU7JO6IFXiMWjWOxg=; b=wuq3ZC1k9j7lt9M4xWR7WZDUpHsQayIKdK8rqTysnLE+FJ3pf89X+SzRyh1RnkZCoxT0Vl 8hPBkeRAU/JS95yA1LF4KULwMdUOC59awe5W69UOMeJFvxopsxk4EBqJGSsOzEB6H+zRJi HeWXGph+HLkGD8uUcWFvHrhOyzMevCnN2qjIG1VqQTTdl8cvbIX+O1A10zUlxsLP4jMSFk l62189JwJJ13OqCvbQm4idR89TxaBT3xQKt59JF+PIh+9StgchrJiQyyBYp2rCW1Sm6tz1 H0i/YM0A4RIcq4JK4x6eYz8gMmS2McZmD4mi7diafKir0CyVvCj4jgvCMM9IQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686514143; 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=R16RFMHsz6buM2tTMKCQBWEPTSGU7JO6IFXiMWjWOxg=; b=T4/ub3u6dWoxrGoRCVn/rH86A+/J7Ie4KpZL4nGuZax3IeZ1kIHqfLkrZfRG5z844kcWCW 1hMF2alOijN8h88v0a51cK96wGZy+q98d6ADTF3TTVJXFYKm6wA6vPceP9enwJAMaaFr33 WiU3SEj7GLsJnOal8rkyM/AF2UVYH6NYcQPNvFK/CO4I7okkxoNwzHfcOPdmUapFXSsi0A a1/4DuEkffQFXtK3yoK2wwuaTLo16yq0M77SWcUkvbmvf18jKakO0VCMlD+7YZBK9h+z7L AYGIJkAE3jZRFtBAa8hcDgYi1vUQrBYUJ1Je6rvJ0mMSKl0edz+9KkoHOyea1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686514143; a=rsa-sha256; cv=none; b=FMEjNo/5XN8eLdBkNx/SkneuRTdUFa1zUpY8gGLictZixkWMc5bi1sFGQiy9oQVCn702I6 ld+a+rTaKI+TidF3oKbfNfZct+3dr89Et0/NEaFC0J7bknfwpWy7Oyak2UHwa/2+i3elTj Vcg1lkNYo2s4aiF1jYcW1LOO36PUZhRgWE48nujYprl5+GJuD5Wl7S6rNcViDri8tfBLR6 jWTjmNC/PbPcrnxlWD9dqJMhEU4a0dvLyKv7b51/JYEGS4di2YttRn/iGC9gPe83fxR/pc h0DDTb0035IROWVYZZemCaU6E7+pFN0tfZVmziuDcmlcpYBNRYRJTEMjAOExcw== 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 4QfQrH4gCtz19xK; Sun, 11 Jun 2023 20:09:03 +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 35BK93JK035015; Sun, 11 Jun 2023 20:09:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BK93EU035014; Sun, 11 Jun 2023 20:09:03 GMT (envelope-from git) Date: Sun, 11 Jun 2023 20:09:03 GMT Message-Id: <202306112009.35BK93EU035014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 4deff63c5d78 - stable/13 - gssd: Improve failure message when running in a jail 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4deff63c5d7837d74ea2cafc0f0373b11daf143e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4deff63c5d7837d74ea2cafc0f0373b11daf143e commit 4deff63c5d7837d74ea2cafc0f0373b11daf143e Author: Rick Macklem AuthorDate: 2023-05-28 18:06:27 +0000 Commit: Rick Macklem CommitDate: 2023-06-11 20:07:55 +0000 gssd: Improve failure message when running in a jail If a jail is not correctly configured to run nfsd(8) in the jail, gssd(8) cannot run. This patch improves the failure message for this case. (cherry picked from commit 697727110b68e483c320d834bcbcdf01c01142a1) --- usr.sbin/gssd/gssd.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c index 5589da37c195..92ecd8faaddb 100644 --- a/usr.sbin/gssd/gssd.c +++ b/usr.sbin/gssd/gssd.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -112,8 +113,9 @@ main(int argc, char **argv) * directly to us. */ struct sockaddr_un sun; - int fd, oldmask, ch, debug; + int fd, oldmask, ch, debug, jailed; SVCXPRT *xprt; + size_t jailed_size; /* * Initialize the credential cache file name substring and the @@ -243,7 +245,27 @@ main(int argc, char **argv) gss_next_id = 1; gss_start_time = time(0); - gssd_syscall(_PATH_GSSDSOCK); + if (gssd_syscall(_PATH_GSSDSOCK) < 0) { + jailed = 0; + if (errno == EPERM) { + jailed_size = sizeof(jailed); + sysctlbyname("security.jail.jailed", &jailed, + &jailed_size, NULL, 0); + } + if (debug_level == 0) { + if (jailed != 0) + syslog(LOG_ERR, "Cannot start gssd." + " allow.nfsd must be configured"); + else + syslog(LOG_ERR, "Cannot start gssd"); + exit(1); + } + if (jailed != 0) + err(1, "Cannot start gssd." + " allow.nfsd must be configured"); + else + err(1, "Cannot start gssd"); + } svc_run(); gssd_syscall(""); From nobody Sun Jun 11 23:40:19 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 4QfWX40fXkz4cLXS; Sun, 11 Jun 2023 23:40:20 +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 4QfWX36d8Yz438J; Sun, 11 Jun 2023 23:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526819; 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=Sy5sq1pK7JIoyoUZ1lc0tqkm5PBZZ8OIpTiTcKNbRZo=; b=TyTp2RUxAR6T/P/31Vpy1JsXz2RT6JDu4UBTyFP0nyL8YT8CeF0dyDfWvM21J+Rh7/8rhA bwKKFfDrZFIpCBSuN0GBnNt1CbT8HwjiiXrfieUCCH8WPkWqnc6PrIp2K6rNayDgXKBXRf f2gawN1K8G8t4kBCoFn2c01ASXhwAzROztVSvWuSmMONL4bqgKAkGuHf3Pk2IuxoF9YGOq HGG0dQg/yUZ6MiC0P93O6F0CvOiU3afscbusa/t+DmrwtO1tLFw1GjUEzcrGV7pCx+wxUM 7hBwdM5M5MRSkboAqkXd0bQCwxeEk/uRzzO5k6cZKGgvKTKzaokZvrQsAlRQiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526819; 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=Sy5sq1pK7JIoyoUZ1lc0tqkm5PBZZ8OIpTiTcKNbRZo=; b=wK+CJkYGLpxdXbSd4Bjk4rXtjvK5o+DAsuZSbt10chzlFzyeL6FjGvpV82cyOTwQYA6e2G UHpDw72ePkpPgGxqIUeGYipwbQSrv3XdN9NQDUh02371Og0sUmgDbbfVdMeT4ZJHdpR+ov w7jFcGCYLlidbDFR5Bmy1lKEG3Ht6k+cXTJ6q24a1V2v6+lSuHDIdYJ81pLTy4/Q3uJXc1 ohFl0ZXYrRggdXqEvzEdDVgWNO5BA5XAsic0ZFDWMczyYHdCI53gsdy0lfVmDwm/82E7RZ p7e6tgJ9eXez8b3t2Pv6nhGsQDxeOJ48sK5aOsLtLh3qoZPKrEiyHYKFNltsYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686526819; a=rsa-sha256; cv=none; b=yc8DhUI75VCyYwV0EvVqjUuXUDGTJC40nKF82e+Yx9MOc1EADBPcWOlLBcPHrMWefyr5zH jW3G32Uf81Mc5UQ+gwkAxSR9y5BzuaF3hvMSFa7W+fJpWXbiV9iOjxMh6yHpE48umGNhmr zksOQY/fngG2fX31XZ2Nhq3KyHJb4yRsuSO2DrzY3RDSHAxdy/wFqL8ItZjHYfvdoKlsOL U6V5mGN8nczVKUUj94WH91HN4BMFxR8AxG7z/d90/8P2UTDiq9tMbenPtSFQcCGvM3D5SQ 4MET9OdCEag/H6vkuHGJPaqeMmdWkyKvn6bahhcfhZginWE3/kihDKRLQZ84bw== 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 4QfWX35VhYzJDF; Sun, 11 Jun 2023 23:40:19 +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 35BNeJFR087793; Sun, 11 Jun 2023 23:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BNeJOp087792; Sun, 11 Jun 2023 23:40:19 GMT (envelope-from git) Date: Sun, 11 Jun 2023 23:40:19 GMT Message-Id: <202306112340.35BNeJOp087792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d231ca7fe394 - stable/13 - rtld_tls.h: style 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d231ca7fe394c32bc8e2bb42949841245e8c912e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d231ca7fe394c32bc8e2bb42949841245e8c912e commit d231ca7fe394c32bc8e2bb42949841245e8c912e Author: Konstantin Belousov AuthorDate: 2023-06-05 01:15:31 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-11 23:39:43 +0000 rtld_tls.h: style (cherry picked from commit a7bca6949252f32bb39440cb2914ba23e1c01551) --- libexec/rtld-elf/rtld_tls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld_tls.h b/libexec/rtld-elf/rtld_tls.h index e150ad7f2613..01b26707159a 100644 --- a/libexec/rtld-elf/rtld_tls.h +++ b/libexec/rtld-elf/rtld_tls.h @@ -58,7 +58,7 @@ * The value returned from this function is suitable for installing * directly into the thread pointer register. */ -void *_rtld_allocate_tls(void* oldtls, size_t tcbsize, size_t tcbalign) +void *_rtld_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) __exported; /* From nobody Sun Jun 11 23:40:20 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 4QfWX5276Jz4cLMb; Sun, 11 Jun 2023 23:40:21 +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 4QfWX51Wdnz438s; Sun, 11 Jun 2023 23:40:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526821; 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=bfTyMwhol4lX0L5dnIKNigE1nWDIB6vUM4ykE9fNOJ4=; b=mWEIBzGDXFOPScwK9Qa6cHT8BZrF49dn4zRXaVWzAwD/9b5rZTR8VybN50ro7s8Ra9+FKq x/RkCOzx3JAK78m3xvMvrBCVUMJ1Zrmaqwc0RNGQoIQSrvWeP2i2RW0WS2Ox1ImHU30nt5 hl0EMODvs+4joX2IK08KdkPBEcPleFJqW7yQ8b1y849WbQTLEn0nGP1W63Lz0ASh4G6LGH D5BjBmoz5PM7Otbw8M6S6xzWkQPbtBOZ7pGrGZjcSRWYtr2NbOuRRN1Oa0C0qX4jabSiF8 FY3Arga+eq8hzuY6EGdXPAzjwl0u2ovoXiBvHP7sXLNw6HOqquPc775GAqW7TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526821; 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=bfTyMwhol4lX0L5dnIKNigE1nWDIB6vUM4ykE9fNOJ4=; b=SYNXjdlmzAdiA5wHLmoRXjPmH3voRqINi9b+z5RXjcb8QxWI2Dqq1vL/e0lDF/Z9HWy6v8 1XeXeUNzww7jW9dPC5v9vXxrSWHTPX2pYkMxbEvBaTJ8keGZcqdjpEN8pZar/togHoQkrf xJdKE+7jWWS1Yeh6TS35UtZUuvBETdFQNFjyVNDh+PxVIBR+3Ndb7HDdBsBo99V6Z2k3ZO Y9Zt23RTi2pqZP7aSZBEVIedem/filOng+lxtgYhBUoQ0Su/cUuD9T3uyrQEIsRHg+Wy0u tprHeeIawTPGstqkFe9dskpgQWvka+wogAhfYBWklI4/d4i7k7KRXRDDotkP/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686526821; a=rsa-sha256; cv=none; b=ayNPtSatulgBqC4kFyK+LPUTnb+rb6K0ixPw0dU6Gm2OyRfilDI4FenxeuFwv9yS/sBGAX PUU/IBnyjgwU3jlRaVaI+sGSr8N89JBbbIp1xucl90DezAVcfqdrvEZa6p+qAJE+v1+aZJ X/nZfVHYQMdZCTNBZnHBdm7YfZCjrP/Z7nD81Y66fxdDj2bLfSBDb0OyvIoP+px+nRgWA2 U8a9r0txXlxHDFxque4+HFrsPAfxPf2mwAADqbF6P07HtR0vSRiBA5NcxGeXFtTEoPf2BX rEGCtCTELmKLXJreZ0JviOLT92LOL5m04tBmzw/ra5th5RA4SP8sufxwMdJh3A== 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 4QfWX45sgSzHgZ; Sun, 11 Jun 2023 23:40:20 +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 35BNeK0W087813; Sun, 11 Jun 2023 23:40:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BNeKX4087812; Sun, 11 Jun 2023 23:40:20 GMT (envelope-from git) Date: Sun, 11 Jun 2023 23:40:20 GMT Message-Id: <202306112340.35BNeKX4087812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 60e3db0c4527 - stable/13 - rtld: rename tls_done to tls_static 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60e3db0c45273bfdcd0afd88138ccd32ef0049d9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=60e3db0c45273bfdcd0afd88138ccd32ef0049d9 commit 60e3db0c45273bfdcd0afd88138ccd32ef0049d9 Author: Konstantin Belousov AuthorDate: 2023-06-05 00:43:55 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-11 23:39:43 +0000 rtld: rename tls_done to tls_static (cherry picked from commit 283a4f409731ba3a4eb1be41e151c20e8a960c03) --- libexec/rtld-elf/aarch64/reloc.c | 2 +- libexec/rtld-elf/amd64/reloc.c | 4 ++-- libexec/rtld-elf/arm/reloc.c | 2 +- libexec/rtld-elf/i386/reloc.c | 2 +- libexec/rtld-elf/map_object.c | 2 +- libexec/rtld-elf/mips/reloc.c | 4 ++-- libexec/rtld-elf/powerpc/reloc.c | 2 +- libexec/rtld-elf/powerpc64/reloc.c | 2 +- libexec/rtld-elf/riscv/reloc.c | 4 ++-- libexec/rtld-elf/rtld.c | 8 ++++---- libexec/rtld-elf/rtld.h | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c index d83da4df0ec5..f9a1ae4c2b6c 100644 --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -470,7 +470,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * modules. If we run out of space, we generate an * error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error( diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index c9a2734853b6..e1e24bc462d6 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -258,7 +258,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * dynamically loaded modules. If we run out * of space, we generate an error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available " @@ -279,7 +279,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * dynamically loaded modules. If we run out * of space, we generate an error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available " diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c index c3219d52bf7e..9f39a315a4e7 100644 --- a/libexec/rtld-elf/arm/reloc.c +++ b/libexec/rtld-elf/arm/reloc.c @@ -319,7 +319,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rel *rel, SymCache *cache, if (def == NULL) return -1; - if (!defobj->tls_done && !allocate_tls_offset(obj)) + if (!defobj->tls_static && !allocate_tls_offset(obj)) return -1; tmp = (Elf_Addr)def->st_value + defobj->tlsoffset; diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index b9c16e2cd154..f7123f91f6fb 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -242,7 +242,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * dynamically loaded modules. If we run out * of space, we generate an error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available " diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index fb5854910ee2..149b8945bf35 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -433,7 +433,7 @@ obj_free(Obj_Entry *obj) { Objlist_Entry *elm; - if (obj->tls_done) + if (obj->tls_static) free_tls_offset(obj); while (obj->needed != NULL) { Needed_Entry *needed = obj->needed; diff --git a/libexec/rtld-elf/mips/reloc.c b/libexec/rtld-elf/mips/reloc.c index 12bfb01ba4ad..6867e9e1553c 100644 --- a/libexec/rtld-elf/mips/reloc.c +++ b/libexec/rtld-elf/mips/reloc.c @@ -588,7 +588,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, if (def == NULL) return -1; - if (!defobj->tls_done && !allocate_tls_offset(obj)) + if (!defobj->tls_static && !allocate_tls_offset(obj)) return -1; val += (Elf_Addr)def->st_value - TLS_DTV_OFFSET; @@ -616,7 +616,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, if (def == NULL) return -1; - if (!defobj->tls_done && !allocate_tls_offset(obj)) + if (!defobj->tls_static && !allocate_tls_offset(obj)) return -1; val += (Elf_Addr)(def->st_value + defobj->tlsoffset diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c index ab09b1536d80..56985ef51d8d 100644 --- a/libexec/rtld-elf/powerpc/reloc.c +++ b/libexec/rtld-elf/powerpc/reloc.c @@ -252,7 +252,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj, * modules. If we run out of space, we generate an * error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available for static " diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c index 1dcdd2478403..93907ebd97d3 100644 --- a/libexec/rtld-elf/powerpc64/reloc.c +++ b/libexec/rtld-elf/powerpc64/reloc.c @@ -247,7 +247,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld __unused, Obj_Entry *obj, * modules. If we run out of space, we generate an * error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error("%s: No space available for static " diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c index 48d513b94ec6..b5dea298b74d 100644 --- a/libexec/rtld-elf/riscv/reloc.c +++ b/libexec/rtld-elf/riscv/reloc.c @@ -325,7 +325,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * modules. If we run out of space, we generate an * error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error( @@ -352,7 +352,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * modules. If we run out of space, we generate an * error. */ - if (!defobj->tls_done) { + if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { _rtld_error( diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index dc8353ba6628..8aa717021c97 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5520,11 +5520,11 @@ allocate_tls_offset(Obj_Entry *obj) { size_t off; - if (obj->tls_done) + if (obj->tls_static) return (true); if (obj->tlssize == 0) { - obj->tls_done = true; + obj->tls_static = true; return (true); } @@ -5555,7 +5555,7 @@ allocate_tls_offset(Obj_Entry *obj) tls_last_offset = off; tls_last_size = obj->tlssize; - obj->tls_done = true; + obj->tls_static = true; return (true); } @@ -5931,7 +5931,7 @@ distribute_static_tls(Objlist *list, RtldLockState *lockstate) return; STAILQ_FOREACH(elm, list, link) { obj = elm->obj; - if (obj->marker || !obj->tls_done || obj->static_tls_copied) + if (obj->marker || !obj->tls_static || obj->static_tls_copied) continue; distrib(obj->tlsoffset, obj->tlsinit, obj->tlsinitsize, obj->tlssize); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index e8e997753c6f..7db3f00e0dc5 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -251,7 +251,7 @@ typedef struct Struct_Obj_Entry { bool traced : 1; /* Already printed in ldd trace output */ bool jmpslots_done : 1; /* Already have relocated the jump slots */ bool init_done : 1; /* Already have added object to init list */ - bool tls_done : 1; /* Already allocated offset for static TLS */ + bool tls_static : 1; /* Already allocated offset for static TLS */ bool phdr_alloc : 1; /* Phdr is allocated and needs to be freed. */ bool z_origin : 1; /* Process rpath and soname tokens */ bool z_nodelete : 1; /* Do not unload the object and dependencies */ From nobody Sun Jun 11 23:40:21 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 4QfWX633Y8z4cLPl; Sun, 11 Jun 2023 23:40:22 +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 4QfWX60vFxz43Wy; Sun, 11 Jun 2023 23:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526822; 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=EAcHsXV8sxLCqlGvUF1PRptGm5rXW1+T9zerxrFuFbg=; b=YSnqWA2jfi/w76+YzUtZjYa0+W/D36F1pJ5kQAD9fa14JM2i4V+vbSPuq5QRAVaH1KQkvb tLDYS95dNgpsMpP1gM31gNpPujJQtY4AupIZHQp9jtdn9+h1VxSMvqMCS4SCbqnRtPn8Kp hcIXMgPPs1a6h+PwlEsYwBu/y2Z3vN+wvO1AuyRP2pohViwWbSj8/t/52i+hMF9/tif68o cCLwZNctifnp1+y+blCbMmJ0t3GzbWfUbxDmsWKYMXK0baPkFOoD/uUbZQo5/NyM2NVALs PnT8yDOTS3YApXbrXBc1I/6igOpM7aB1+HYy95LAG3G5DSHPkPnN9YhqSaHiXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526822; 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=EAcHsXV8sxLCqlGvUF1PRptGm5rXW1+T9zerxrFuFbg=; b=G1isQOJnwVdaOkAMzOi+SfmrdaTfSwY7Ty230WSeJ//6NM9JkCPlMOExIKIAD6UJ/HtRT5 7uLOdkBQNU0MaXg4EjU1gpSGH/pvShZGf2Gc+ldiRjuA4W1/vui/ZQ2MWSZssF3z6Of5LQ F1XCnTecEVjYqpeRC4BArVNdK7DbJRLl7zJh0dgC44H0kUQIawWtlfEV6GRtbxqP1WyLxB RTyb0/Z7TpNiwMGW2B+96EqJMmL8CKe/mRxkuUBLGd2TMbxHcPef1sKghqD55AvMQsBDpo ek88XNQOC5m8YcAP3gWWhqmIrGPaRLeg1a75WVr343L8cVo6Rg5IZJJcFwAsgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686526822; a=rsa-sha256; cv=none; b=ohlmDyG/6jHItGda8NUQERkRTeoflGNq2GPPjTBmbZ9ZGygdvNdl5/14Z4WGlwS5EXZh8T CzcxX7QQKwIiadY+HfIluH7uVdN3TlHQNQQWAQxAAvMR85mElkKszqbD1esJqrF4sdBdq+ BHSW4vW0EoDQcKwQlD4y772EkaQcBXA0zJpVCEgYHsBarIiBa776GDfjnMMN0E0nEwXPp4 sYgoYdaeH45VLynSlTQ726AXaNtYz1PtN8STJIaxLzWQwxCLoZqoccNqIQlpn8YwxeUwud +Zl/EH5tsg9nj48IieaBcKkH/DaxEuks0uUcPrsYYDcn5cLTEn1TpXQlZCQQRA== 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 4QfWX56nsczJ30; Sun, 11 Jun 2023 23:40:21 +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 35BNeLUQ087835; Sun, 11 Jun 2023 23:40:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BNeLvt087834; Sun, 11 Jun 2023 23:40:21 GMT (envelope-from git) Date: Sun, 11 Jun 2023 23:40:21 GMT Message-Id: <202306112340.35BNeLvt087834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: dc56749b2074 - stable/13 - rtld: do not allow both dynamic DTV index and static TLS offset 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dc56749b2074b4f3e95e7295ac60f04e611949e3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dc56749b2074b4f3e95e7295ac60f04e611949e3 commit dc56749b2074b4f3e95e7295ac60f04e611949e3 Author: Konstantin Belousov AuthorDate: 2023-06-05 00:54:46 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-11 23:39:43 +0000 rtld: do not allow both dynamic DTV index and static TLS offset (cherry picked from commit 91880e07f605edb90339685bc934699a4344de3b) --- libexec/rtld-elf/rtld.c | 14 ++++++++++++++ libexec/rtld-elf/rtld.h | 1 + 2 files changed, 15 insertions(+) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8aa717021c97..017833164a18 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5509,6 +5509,17 @@ allocate_module_tls(int index) rtld_die(); } + if (obj->tls_static) { +#ifdef TLS_VARIANT_I + p = (char *)_tcb_get() + obj->tlsoffset; +#else + p = (char *)_tcb_get() - obj->tlsoffset; +#endif + return (p); + } + + obj->tls_dynamic = true; + p = malloc_aligned(obj->tlssize, obj->tlsalign, obj->tlspoffset); memcpy(p, obj->tlsinit, obj->tlsinitsize); memset(p + obj->tlsinitsize, 0, obj->tlssize - obj->tlsinitsize); @@ -5520,6 +5531,9 @@ allocate_tls_offset(Obj_Entry *obj) { size_t off; + if (obj->tls_dynamic) + return (false); + if (obj->tls_static) return (true); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 7db3f00e0dc5..9bc75dc97546 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -252,6 +252,7 @@ typedef struct Struct_Obj_Entry { bool jmpslots_done : 1; /* Already have relocated the jump slots */ bool init_done : 1; /* Already have added object to init list */ bool tls_static : 1; /* Already allocated offset for static TLS */ + bool tls_dynamic : 1; /* A non-static DTV entry has been allocated */ bool phdr_alloc : 1; /* Phdr is allocated and needs to be freed. */ bool z_origin : 1; /* Process rpath and soname tokens */ bool z_nodelete : 1; /* Do not unload the object and dependencies */ From nobody Sun Jun 11 23:40:22 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 4QfWX72q7qz4cLKt; Sun, 11 Jun 2023 23:40:23 +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 4QfWX71TDYz43c4; Sun, 11 Jun 2023 23:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526823; 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=93Mmxu/pcmd5M5vlNUm5O6AOOvdWcYVp1gHAeYUjz1w=; b=V/DVHbNo3Id/TRj1hy0Gsh4Kbr0qakE9EQBY/ALCFOVFbnt0xJ+ya17Q7q3YNKpLXsvQlJ CwUJot8p2ndEHY+TkPV4b9pqCM0aN9oO0NfK0iq9NO8fi8jMx3a1YLzmrvbxJEVvFsT9eR 33aQRdgnlP/S6z9fxa24JWyfq4JsS9c6TXa33htwNuEE0YYJIDdsEkFi5JMmjc0bshJ2M4 MVJWKWiAtkofWTdzgyywMLr09syjelYVrl69C0S2mJEL2XkKw15tIhcKH+C54lp+gAn3nV /A9FSDW1qroGruj60ebFTXwQU2oGA96lbnNtLKsfbkYi8swLOFPYQN4w9B/t2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526823; 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=93Mmxu/pcmd5M5vlNUm5O6AOOvdWcYVp1gHAeYUjz1w=; b=aat7Vi1AtCynZifrBrolS+6pYjbA203qOKQRpxbFxcmH7opvqrFjugqN8pTPOHTEEKVMKw JQD/6R5SamsHCxOqSnGXmFFz2wnbjS+m6DBHki/i0KUW8XyDMGxNWjYvfqB/PI1VE+n/5E PCdb1sJp6A3sJftlrHXLNXyDyTVloCsXE77tK7kjfeY9uGOe2ojN2m4yZ41nl7BSPT9KWj dGsKCVtAl84vZ+AZyBcvCrSbyRAFk7KdbdWskQljSmIlTucQ/8ufmKshImzmBBivLdJctb MfPf6jcx9NG7lPW6E9pFWnmdPprCEGKk8435hRlUV4zQK0yK93akzYiJEQlUoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686526823; a=rsa-sha256; cv=none; b=l8aLmc5KqseinsbR3cefLSK4EvWDr9gEt+/HCh+XeF+1Op+t1sWoZaGgWBENb5swe0EOjA szP7p0kNaMw9gog55/r144oxLRVnyZ6j0XuomSyL9siBsYL+AUsROLuKNTkJ3k6vQukbVt HUcbddyXA+hL9oUFZ1C7QRDNUqFdmS2SviUDA+ve8iE08JLbu+qNys+F8soKudI2/gX0GW cLknYEdLSEjvmMZajF8vnQSg/AI8Y8a7yfBVoq/ipLyC8iSE8D6lttKCTNuWQxxKL4436D QdeBuQQiontfId719FxDONDzvpuIKjB9tphpESGNPqxhoxsn9FC/cj5FiTaF8A== 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 4QfWX70bHwzJBQ; Sun, 11 Jun 2023 23:40:23 +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 35BNeM4q087856; Sun, 11 Jun 2023 23:40:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BNeMq0087855; Sun, 11 Jun 2023 23:40:22 GMT (envelope-from git) Date: Sun, 11 Jun 2023 23:40:22 GMT Message-Id: <202306112340.35BNeMq0087855@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 62bc41c614ec - stable/13 - rtld: fix allocate_module_tls() variant I fallback to static allocation 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 62bc41c614ece3fa32010a92cb57738303795666 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=62bc41c614ece3fa32010a92cb57738303795666 commit 62bc41c614ece3fa32010a92cb57738303795666 Author: Konstantin Belousov AuthorDate: 2023-06-09 00:51:32 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-11 23:39:43 +0000 rtld: fix allocate_module_tls() variant I fallback to static allocation (cherry picked from commit e9a38ed2fa61fd264a80f24ceb35f39b0ac6463d) --- libexec/rtld-elf/rtld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 017833164a18..91b09b5fbd25 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5511,7 +5511,7 @@ allocate_module_tls(int index) if (obj->tls_static) { #ifdef TLS_VARIANT_I - p = (char *)_tcb_get() + obj->tlsoffset; + p = (char *)_tcb_get() + obj->tlsoffset + TLS_TCB_SIZE; #else p = (char *)_tcb_get() - obj->tlsoffset; #endif From nobody Sun Jun 11 23:40:24 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 4QfWX82dc0z4cLLD; Sun, 11 Jun 2023 23:40: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 4QfWX826Tyz43CK; Sun, 11 Jun 2023 23:40:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526824; 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=p//QUizHwqPOjEieTTShu40b0xAsbW35CDipa30wXcU=; b=TaozGpkLkNA464RSG14zbS5GLSe7P0bR33ADdRP22QZ95XNDDp5eBmbIDL+D1N9IkIU32f KXBIVSSBOd5siRfz5IZLkomPqpLnYZtoBrjCUEDZRu/ITdvN+/c9CsVL7NDjys+potrnfs Kg+Jh99bFNYBaeVQ4e9VWSUdELVK6oIeOzyt4aQOQyTeatj8t+0L5N6TqwyfS2ZQbBAKD2 MbWIpz82gW0xwkCmugssVAjJHm7fIw/yJ+jEeV/gQpBhUNHPy3XeQJlYRUQXZeg4969iZ3 2V9AJAs0xzz44z93hzXfsDQqZ5g8rnR1V4mJuYJwrysSGQdiik6NC6m44gHtHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686526824; 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=p//QUizHwqPOjEieTTShu40b0xAsbW35CDipa30wXcU=; b=ytsBDumrbDMf9GiDZbTajulDte/Vi+QnUE2ybB95g45at/3/jofqvhxs4Z5dbip6Xbq/Y2 swGAenGI5N5phSPLF9PWTfTD4UTCsSIQUixhGMvytQKu9BIpUrH0kuG3UrKLruJDptIsO8 A5IehJ9eRvn1OAm3lRPE3oGcDYyHx8fL9dvRb6Il9+Vf5itHUHfYMaTS4XzYw83RYxHSLA 2s1ZlyRP7MhvPOvm9rwEux3z65tbQ115W7U2vmkk28rU7ko5V0zVOfcj3OpW0KGCAhKJnD pi3ibVMjsEQUjaNQNjpLEm2YuR7tp7J8WCWadDlUlmuoq/VA2PEeeVeNLMps/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686526824; a=rsa-sha256; cv=none; b=o8Edvr5SgWx8SrkDBSNNzsG7bynkN9yE2FW5D6An+dJSl8qFJDx/gqNKgoxa2WJVJdseMB W06bLwM1PuuoEMORzsuoirrnNoyTFswoBGw5JHFcta2t75q+U6mgsN8RMGSFJWt+B7Mf0/ Dsl/JIg7sH5fgn03dqbXlQy2LEozgjT8VNN5iDz9GbmUwtDsIMn4+XnPP+5CpNrUEOUY8f ai6YBZyhpxMR+WKAJr2ZbqJ2oQ0NGtqfqiMQk1qqMgKPNEiGcvKxDMNxZxOKFwPvSC40WR 7vl5j8mPIYkjbVDIIju41nLCaqLd0y7xQnF9LKz20NQAyt9kEo36R+RTBwgNCw== 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 4QfWX81CWlzJDG; Sun, 11 Jun 2023 23:40: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 35BNeOfC087885; Sun, 11 Jun 2023 23:40:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35BNeOBk087884; Sun, 11 Jun 2023 23:40:24 GMT (envelope-from git) Date: Sun, 11 Jun 2023 23:40:24 GMT Message-Id: <202306112340.35BNeOBk087884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d0fec56f9052 - stable/13 - rtld: fix typo in comment 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d0fec56f90523fea2a1b963ceb6d854ff3a6aebf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d0fec56f90523fea2a1b963ceb6d854ff3a6aebf commit d0fec56f90523fea2a1b963ceb6d854ff3a6aebf Author: Konstantin Belousov AuthorDate: 2023-06-10 01:35:14 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-11 23:39:43 +0000 rtld: fix typo in comment (cherry picked from commit a254f671025f3da313e1d02646b6402f54006e14) --- libexec/rtld-elf/aarch64/rtld_machdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h index ce6f6fc6c7c0..6d89d557d16f 100644 --- a/libexec/rtld-elf/aarch64/rtld_machdep.h +++ b/libexec/rtld-elf/aarch64/rtld_machdep.h @@ -64,7 +64,7 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, * Pass zeros into the ifunc resolver so we can change them later. The first * 8 arguments on arm64 are passed in registers so make them known values * if we decide to use them later. Because of this ifunc resolvers can assume - * no arguments are passeed in, and if this changes later will be able to + * no arguments are passed in, and if this changes later will be able to * compare the argument with 0 to see if it is set. */ #define call_ifunc_resolver(ptr) \ From nobody Mon Jun 12 01:24:32 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 4QfYrK1qdjz4cjQP; Mon, 12 Jun 2023 01:24:33 +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 4QfYrK0qQgz4LP5; Mon, 12 Jun 2023 01:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686533073; 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=NrTPowjegZR2012uZBfVkrL5YxnnQ2PWHkrs73vjm4E=; b=N7RDweaZYZjgWFjKq85pRz9yBZ/zILKhlAZ8JziDHKsWg/rneSBQbT9zRp+jgyeNzZDerh oAkUyNQ2oQUSbxsuQKDXKcfFZaLVfO8Xk4btrNtrkmYob/rOl8UMp2DhPB37aB/Ra64cz5 cRDehEthcAJWpcoSO4p2rdGJss1EmG/+SAaT8NwSRZ7148Yp6ZabywV/ciQCkn0SfWjbw5 dCgLmR/pNZXIMA8G4p4ybzFgUF2osTISBcdGY/JvxR5pE4azIBu/bFuYJKGnBPF8Tr0BZr q/g69wdyx/15d00qQpYFp4n+JZsoAKowAjU0R9+n2X/QColyp+uK7XzNldRNjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686533073; 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=NrTPowjegZR2012uZBfVkrL5YxnnQ2PWHkrs73vjm4E=; b=npd51qqPSj0cO1qc1R6C9xqhzmGCMKxYlesEc/6VNcbpNX7/MdlCD9CSPdKBJ4cLM2Klg2 0aGwHvJqEDHt6KIHThBRBRpXdK9blL+46vJN28ItNc9zFHf6pvUo5MmaR4uY+3IbLwNykA s87CroXGL+A5JKvK3cDbPw9WsaThdr1oxn4lM5p8nbA5W6QfQMTV3BRYQ849zaqhTY+2GK KOkkB8e8efMw/wwhQOmEUM31p/GV3ljidTyw+g7QsofHa1f+wY0AQrwDQi7npjQztS0BNg XvtxWMSlJ1ab+xjyW/ecgjNuvqljWQNxbM+vBnCTX3A2fL53/KvmA1HEh1dQyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686533073; a=rsa-sha256; cv=none; b=W3RlFhKGwRSejLjjRj1MKO7B4Q0+FO/W9C0sWabblxVW7Gu2A+FTwgZx7z1Yh/gACk2v8Z czoYBh8H1WMGSSYPEPublmd5MtH5zNV4cTFcv2EIuovmjG/czEXqPryJoHTghqbQ/BJnBD 6GBy8KqdiRQw8S+OV5nPen7XwtJTQ1Smy5sY/KACFJE5h7hF7vEtCCkwI5xsoU742yuRmP vk+S7G1QQ0CEjCsPXM+2t285MHShpqQJX1cF40d6KxHjJJduD27zpm1+I8OfmR7L14yK3H j2rhXKE67Vg6Qd2/ax4802NPnNeEFyawl+4ta2JVHzyjnFdppOnhI0a3grNZ7Q== 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 4QfYrJ737bzLrT; Mon, 12 Jun 2023 01:24:32 +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 35C1OWOq059495; Mon, 12 Jun 2023 01:24:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35C1OW4U059494; Mon, 12 Jun 2023 01:24:32 GMT (envelope-from git) Date: Mon, 12 Jun 2023 01:24:32 GMT Message-Id: <202306120124.35C1OW4U059494@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 4eee1fcdfc77 - stable/13 - nfsuserd: Improve failure message when running in a jail 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4eee1fcdfc778640b93d3ba897d3206fa04484ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4eee1fcdfc778640b93d3ba897d3206fa04484ee commit 4eee1fcdfc778640b93d3ba897d3206fa04484ee Author: Rick Macklem AuthorDate: 2023-05-29 20:38:07 +0000 Commit: Rick Macklem CommitDate: 2023-06-12 01:23:37 +0000 nfsuserd: Improve failure message when running in a jail If a jail is not correctly configured to run nfsd(8) in the jail, nfsuserd(8) cannot run. This patch improves the failure message for this case. (cherry picked from commit a94018e2003b83c10e8fb814f7a8d47e2513da95) --- usr.sbin/nfsuserd/nfsuserd.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/usr.sbin/nfsuserd/nfsuserd.c b/usr.sbin/nfsuserd/nfsuserd.c index 1e99f806637d..3444b16fea78 100644 --- a/usr.sbin/nfsuserd/nfsuserd.c +++ b/usr.sbin/nfsuserd/nfsuserd.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -127,7 +128,8 @@ main(int argc, char *argv[]) #ifdef INET6 struct sockaddr_in6 *sin6; #endif - int s; + int jailed, s; + size_t jailed_size; if (modfind("nfscommon") < 0) { /* Not present in kernel, try loading it */ @@ -326,10 +328,19 @@ main(int argc, char *argv[]) #else if (nfssvc(NFSSVC_NFSUSERDPORT | NFSSVC_NEWSTRUCT, &nargs) < 0) { if (errno == EPERM) { - fprintf(stderr, - "Can't start nfsuserd when already running"); - fprintf(stderr, - " If not running, use the -force option.\n"); + jailed = 0; + jailed_size = sizeof(jailed); + sysctlbyname("security.jail.jailed", &jailed, + &jailed_size, NULL, 0); + if (jailed != 0) { + fprintf(stderr, "Cannot start nfsuserd. " + "allow.nfsd might not be configured\n"); + } else { + fprintf(stderr, "Cannot start nfsuserd " + "when already running."); + fprintf(stderr, " If not running, " + "use the -force option.\n"); + } } else { fprintf(stderr, "Can't do nfssvc() to add port\n"); } From nobody Mon Jun 12 12:22:25 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 4QfrRP2MRDz4d9qy; Mon, 12 Jun 2023 12:22:25 +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 4QfrRP1tFWz3qSc; Mon, 12 Jun 2023 12:22:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572545; 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=lRprnXM/5O8XvrIor95zYZvCP/19pqvNOrxnMDUdpLY=; b=V0W+77YOKXRq24XY+REcLmS2kcqnG748GXP6jl6HRipLrnWZ6kUDsvo2AdVQ9aS8WdpA2T dhF4J7AJAgJ5tJS4qaJYpKlfU8V7tKZ3Ie2zw1Utu4VQrCHADGGCl8v4rO0mTjGTzbhTV4 Hf9QKQSXqXw8N4SxH7hj57BFdfbpG/2VfVGo4T7GWo/qAVqKuVk/E5IPNlVOUgT6smB5HP q3RK40wUPBjKU/Y/Dy1EoBkO95l3lBgaYba8qlv6sk5vUXpeE4XbspZOGt4eCVD7e1hVso 5UtuA5AJUHyPbgdoKcrPyjZoqbGH/1Vy1GIBTTJyJ1aH/9DCcvAeui8uS9RVow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572545; 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=lRprnXM/5O8XvrIor95zYZvCP/19pqvNOrxnMDUdpLY=; b=aNTE6fGTLieiUgcaYsDv10oyzUCEp+z6tZj7d4wtQBWWTut7r0FLrZCr0K+ap/2lgOAyrM g43U5xn+wjgtK83thuJAQG2n8psXwxRnMMksU5otvp1tzyl6hotb2Af2vtYTCR2o2iejJc 8L5KzBcgXuWwilBfup+xM9QheCrvNdjbdKeFsul0v5rMDWf0aLc3aZQsifQy4t075UvJbd YlrFnxja22R5XHotDyCY/8dMhqG7MaHhTpwH7yq5nN6waYUy4vhHLuZoFlOJqJ5iN9LZUU lL0iSocrTG5Q4yfa5u01SRH9TKIeS2BZnz0SMuoccoKfxso1l255aqKWj7kzzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572545; a=rsa-sha256; cv=none; b=fAZkXPnQk7mt4woebnMA1yF/FrhxDTOAQtZuBr6uZnLR8+kRAcY4JAS8etO++Zv0c7G6wj qRwHi/226jG3Mw2rJOjjPmqfHfuEFRPwsI2cGMlN+8Ys8G7XFCMt4gxs5+V37CdcfjvviY rGv953d8TA2hRVtEWeius/BXYyQd5o9lkSyL7unn10sha5qMTGkai+J/58vnsGopOJfXSu usnbTcVCW+vyJ7/tN93+wDORQp4QI3KWG+dm8MNXWz8WoReC5dO3wEGC3pEBdsvZOYgxna fVctV1uSw7ytICgnVszoSCvCM6ps0WMd9htjG4ZmNWZw8dZmkFbUEZe0XsWwyA== 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 4QfrRP10RYzg2x; Mon, 12 Jun 2023 12:22:25 +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 35CCMPtj047994; Mon, 12 Jun 2023 12:22:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMPqo047993; Mon, 12 Jun 2023 12:22:25 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:25 GMT Message-Id: <202306121222.35CCMPqo047993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 9c5a91f96994 - stable/13 - lib/csu: Get rid of unused fptr typedef on amd64. 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c5a91f96994139211aa9900dcf98a358869a854 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9c5a91f96994139211aa9900dcf98a358869a854 commit 9c5a91f96994139211aa9900dcf98a358869a854 Author: Gleb Popov AuthorDate: 2021-07-22 15:28:21 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 01:51:24 +0000 lib/csu: Get rid of unused fptr typedef on amd64. (cherry picked from commit feac06569a381dd7fec92c7d490fc34ef0bbdda5) --- lib/csu/amd64/crt1_c.c | 2 -- lib/csu/i386/crt1_c.c | 6 ++---- lib/csu/riscv/crt1_c.c | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/csu/amd64/crt1_c.c b/lib/csu/amd64/crt1_c.c index 9dbd34492023..f1c99de9ffe0 100644 --- a/lib/csu/amd64/crt1_c.c +++ b/lib/csu/amd64/crt1_c.c @@ -34,8 +34,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "ignore_init.c" -typedef void (*fptr)(void); - #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); diff --git a/lib/csu/i386/crt1_c.c b/lib/csu/i386/crt1_c.c index 0d82cda6fa1f..b39134824f7e 100644 --- a/lib/csu/i386/crt1_c.c +++ b/lib/csu/i386/crt1_c.c @@ -34,8 +34,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "ignore_init.c" -typedef void (*fptr)(void); - extern void _start(char *, ...); #ifdef GCRT @@ -45,11 +43,11 @@ extern int eprol; extern int etext; #endif -void _start1(fptr, int, char *[]) __dead2; +void _start1(void (*)(void), int, char *[]) __dead2; /* The entry function, C part. */ void -_start1(fptr cleanup, int argc, char *argv[]) +_start1(void (*cleanup)(void), int argc, char *argv[]) { char **env; diff --git a/lib/csu/riscv/crt1_c.c b/lib/csu/riscv/crt1_c.c index 9291d6d200df..11519e46c7f3 100644 --- a/lib/csu/riscv/crt1_c.c +++ b/lib/csu/riscv/crt1_c.c @@ -41,8 +41,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "ignore_init.c" -typedef void (*fptr)(void); - #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); From nobody Mon Jun 12 12:22:26 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 4QfrRQ3P2jz4d9g3; Mon, 12 Jun 2023 12:22:26 +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 4QfrRQ32gcz3qbM; Mon, 12 Jun 2023 12:22:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572546; 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=a2FR4ZmJrImEsAT0Df/nDeMjxVWl6FZG+w4bIb1GvdQ=; b=wujQ7YRA2TnvFt3DbONH3/ncqBJzuyW74maUfjKJ3YisoRDto/2gVtz/3Mhad/BIGDnISK OWYSNdoNERt9PjvjFGMXNV6jDJzkvl62v5QYxRPbP1Kzvx1T5Z53y5mXhIAdDnMqEsewtP zxcGNWw2LmjxCoSN34XYcIwe3iUFwbqZdpMOiRkNq4hFxPVL+8/w7lZbqCCEtz9T+V28qt J/hrFo+KkAobnJcE8Sv7qCdh4D18Ya6Ih8IB+ZfnS+rvzGD6AAYl1pan/3jX88mjJhanoy 1FMA0+7njkEZ/Md1Ca+qSgiC40jD1qOjKCQ3ZravTPtmGD9Dy6ta9XsChDEbWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572546; 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=a2FR4ZmJrImEsAT0Df/nDeMjxVWl6FZG+w4bIb1GvdQ=; b=wPCJgWfYAb2LVqUhbjSwmG+EKk+JGZZOtsh7rzTA9NZHp4DqineqjF06fGWLnWXzkybA1r SD66tPc7rHqfnlsFqmv71WRCTEz3CUc1UgkhHcXxF1w501vKxV/2afyxn4D1KeMnz60kLf IX0cR5PzjVqwG/l83oNHBaK60bmXVj3CuMQqkLd4gFBCfaBJ/kylX21Exq7ngfeqakROP5 PxcefXsL+Qk2r0UP6aPQ0CouEjub9W3KJNEQ6s9Z/6FTEgB1l0o9G5cS9OoH5Q3EljWuCP RTzRtTxLzarHiQIjqICpd0FnWlnNgIEdYan/vI1se/N/nyBjlfq+IgoCYaoKPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572546; a=rsa-sha256; cv=none; b=dYns0llwypLpPW2Y0Ke5YukFeklXsknpI+6KmpIlvxS4dKXBQ4W1HNheQAiXUOeS5RVfII qXFMWhMTAWchxVb43cLMJLhO8UdlyQC7OMvbeZVIBV1QOofoxKA4urmZbqfz0avRK2QoS+ gevHAVr97Nh55DRAdZCcMY+ZvF88AhA3Th0vuLS0kMfVnFO484AYPm26TUtJSt0RDBQWxb TMnG2QUuG+/vWVyqbovV6Se/coPBGuqoHzQsqCVpaA9maFhEfkRgPwWl3RoqwbvfsKzVUC Fm3Ztm+lgF3kzSaKUvJMEi5EoVLHjiZjUrpV4Ax01GJHJivslQb0pcztEKrMPA== 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 4QfrRQ1tVDzfwj; Mon, 12 Jun 2023 12:22:26 +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 35CCMQE0048014; Mon, 12 Jun 2023 12:22:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMQtw048013; Mon, 12 Jun 2023 12:22:26 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:26 GMT Message-Id: <202306121222.35CCMQtw048013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: aea1d51e854e - stable/13 - csu: move common code to libc 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aea1d51e854e06565b609d4fb065787d7d8328b4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aea1d51e854e06565b609d4fb065787d7d8328b4 commit aea1d51e854e06565b609d4fb065787d7d8328b4 Author: Konstantin Belousov AuthorDate: 2022-10-30 23:47:44 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 12:19:38 +0000 csu: move common code to libc For MFC purposes, keep lib/csu code intact, only add lib/libc/csu bits. This allows stable/13 to run simple binaries compiled on 14. (cherry picked from commit 51015e6d0f570239b0c2088dc6cf2b018928375d) --- lib/libc/Makefile | 1 + lib/libc/csu/Makefile.inc | 10 ++ lib/libc/csu/Symbol.map | 4 + lib/libc/csu/aarch64/Makefile.inc | 4 + lib/libc/csu/aarch64/reloc.c | 46 +++++++++ lib/libc/csu/amd64/Makefile.inc | 4 + lib/libc/csu/amd64/reloc.c | 63 ++++++++++++ lib/libc/csu/arm/Makefile.inc | 4 + lib/libc/csu/i386/Makefile.inc | 4 + lib/libc/csu/i386/reloc.c | 85 +++++++++++++++++ lib/libc/csu/ignore_init.c | 184 ++++++++++++++++++++++++++++++++++++ lib/libc/csu/mips/Makefile.inc | 4 + lib/libc/csu/powerpc/Makefile.inc | 4 + lib/libc/csu/powerpc64/Makefile.inc | 4 + lib/libc/csu/powerpc64/reloc.c | 69 ++++++++++++++ lib/libc/csu/riscv/Makefile.inc | 4 + lib/libc/include/libc_private.h | 6 ++ 17 files changed, 500 insertions(+) diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 6363cef8d48b..43efccba08dd 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -93,6 +93,7 @@ MIASM= NOASM= .include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc" +.include "${LIBC_SRCTOP}/csu/Makefile.inc" .include "${LIBC_SRCTOP}/db/Makefile.inc" .include "${LIBC_SRCTOP}/compat-43/Makefile.inc" .include "${LIBC_SRCTOP}/gdtoa/Makefile.inc" diff --git a/lib/libc/csu/Makefile.inc b/lib/libc/csu/Makefile.inc new file mode 100644 index 000000000000..453303bea608 --- /dev/null +++ b/lib/libc/csu/Makefile.inc @@ -0,0 +1,10 @@ +# + +.PATH: ${LIBC_SRCTOP}/csu +.include "${LIBC_SRCTOP}/csu/${LIBC_ARCH}/Makefile.inc" + +SRCS+= \ + ignore_init.c + +CFLAGS+= -I${LIBC_SRCTOP}/csu/${LIBC_ARCH} +SYM_MAPS+=${LIBC_SRCTOP}/csu/Symbol.map diff --git a/lib/libc/csu/Symbol.map b/lib/libc/csu/Symbol.map new file mode 100644 index 000000000000..7fc09add5e45 --- /dev/null +++ b/lib/libc/csu/Symbol.map @@ -0,0 +1,4 @@ +FBSD_1.7 { + __libc_start1; + __libc_start1_gcrt; +}; diff --git a/lib/libc/csu/aarch64/Makefile.inc b/lib/libc/csu/aarch64/Makefile.inc new file mode 100644 index 000000000000..b3420a638164 --- /dev/null +++ b/lib/libc/csu/aarch64/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_RELA \ + -DINIT_IRELOCS="" diff --git a/lib/libc/csu/aarch64/reloc.c b/lib/libc/csu/aarch64/reloc.c new file mode 100644 index 000000000000..f3dbf3e3b570 --- /dev/null +++ b/lib/libc/csu/aarch64/reloc.c @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2019 Leandro Lupori + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +static void +crt1_handle_rela(const Elf_Rela *r) +{ + typedef Elf_Addr (*ifunc_resolver_t)( + uint64_t, uint64_t, uint64_t, uint64_t, + uint64_t, uint64_t, uint64_t, uint64_t); + Elf_Addr *ptr, *where, target; + + switch (ELF_R_TYPE(r->r_info)) { + case R_AARCH64_IRELATIVE: + ptr = (Elf_Addr *)r->r_addend; + where = (Elf_Addr *)r->r_offset; + target = ((ifunc_resolver_t)ptr)(0, 0, 0, 0, 0, 0, 0, 0); + *where = target; + break; + } +} diff --git a/lib/libc/csu/amd64/Makefile.inc b/lib/libc/csu/amd64/Makefile.inc new file mode 100644 index 000000000000..b3420a638164 --- /dev/null +++ b/lib/libc/csu/amd64/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_RELA \ + -DINIT_IRELOCS="" diff --git a/lib/libc/csu/amd64/reloc.c b/lib/libc/csu/amd64/reloc.c new file mode 100644 index 000000000000..adb52e42a32c --- /dev/null +++ b/lib/libc/csu/amd64/reloc.c @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2018 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +static void +crt1_handle_rela(const Elf_Rela *r) +{ + Elf_Addr *ptr, *where, target; + u_int p[4]; + uint32_t cpu_feature, cpu_feature2; + uint32_t cpu_stdext_feature, cpu_stdext_feature2; + + do_cpuid(1, p); + cpu_feature = p[3]; + cpu_feature2 = p[2]; + do_cpuid(0, p); + if (p[0] >= 7) { + cpuid_count(7, 0, p); + cpu_stdext_feature = p[1]; + cpu_stdext_feature2 = p[2]; + } else { + cpu_stdext_feature = 0; + cpu_stdext_feature2 = 0; + } + + switch (ELF_R_TYPE(r->r_info)) { + case R_X86_64_IRELATIVE: + ptr = (Elf_Addr *)r->r_addend; + where = (Elf_Addr *)r->r_offset; + target = ((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, + uint32_t))ptr)(cpu_feature, cpu_feature2, + cpu_stdext_feature, cpu_stdext_feature2); + *where = target; + break; + } +} diff --git a/lib/libc/csu/arm/Makefile.inc b/lib/libc/csu/arm/Makefile.inc new file mode 100644 index 000000000000..2534e6579f38 --- /dev/null +++ b/lib/libc/csu/arm/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_SUPPRESS \ + -DINIT_IRELOCS="" diff --git a/lib/libc/csu/i386/Makefile.inc b/lib/libc/csu/i386/Makefile.inc new file mode 100644 index 000000000000..ac0984df2349 --- /dev/null +++ b/lib/libc/csu/i386/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_REL \ + -DINIT_IRELOCS="" diff --git a/lib/libc/csu/i386/reloc.c b/lib/libc/csu/i386/reloc.c new file mode 100644 index 000000000000..13438035841d --- /dev/null +++ b/lib/libc/csu/i386/reloc.c @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2018 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +static void +crt1_handle_rel(const Elf_Rel *r) +{ + Elf_Addr *where, target; + u_int cpuid_supported, p[4]; + uint32_t cpu_feature, cpu_feature2; + uint32_t cpu_stdext_feature, cpu_stdext_feature2; + + __asm __volatile( + " pushfl\n" + " popl %%eax\n" + " movl %%eax,%%ecx\n" + " xorl $0x200000,%%eax\n" + " pushl %%eax\n" + " popfl\n" + " pushfl\n" + " popl %%eax\n" + " xorl %%eax,%%ecx\n" + " je 1f\n" + " movl $1,%0\n" + " jmp 2f\n" + "1: movl $0,%0\n" + "2:\n" + : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); + if (cpuid_supported) { + do_cpuid(1, p); + cpu_feature = p[3]; + cpu_feature2 = p[2]; + do_cpuid(0, p); + if (p[0] >= 7) { + cpuid_count(7, 0, p); + cpu_stdext_feature = p[1]; + cpu_stdext_feature2 = p[2]; + } else { + cpu_stdext_feature = 0; + cpu_stdext_feature2 = 0; + } + } else { + cpu_feature = 0; + cpu_feature2 = 0; + cpu_stdext_feature = 0; + cpu_stdext_feature2 = 0; + } + + switch (ELF_R_TYPE(r->r_info)) { + case R_386_IRELATIVE: + where = (Elf_Addr *)r->r_offset; + target = ((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, + uint32_t))*where)(cpu_feature, cpu_feature2, + cpu_stdext_feature, cpu_stdext_feature2); + *where = target; + break; + } +} diff --git a/lib/libc/csu/ignore_init.c b/lib/libc/csu/ignore_init.c new file mode 100644 index 000000000000..60c45d7e735f --- /dev/null +++ b/lib/libc/csu/ignore_init.c @@ -0,0 +1,184 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2012 Konstantin Belousov + * Copyright (c) 2018, 2023 The FreeBSD Foundation + * + * Parts of this software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include "libc_private.h" + +extern void (*__preinit_array_start[])(int, char **, char **) __hidden; +extern void (*__preinit_array_end[])(int, char **, char **) __hidden; +extern void (*__init_array_start[])(int, char **, char **) __hidden; +extern void (*__init_array_end[])(int, char **, char **) __hidden; +extern void (*__fini_array_start[])(void) __hidden; +extern void (*__fini_array_end[])(void) __hidden; +extern void _fini(void) __hidden; +extern void _init(void) __hidden; + +extern int _DYNAMIC; +#pragma weak _DYNAMIC + +#if defined(CRT_IRELOC_RELA) +extern const Elf_Rela __rela_iplt_start[] __weak_symbol __hidden; +extern const Elf_Rela __rela_iplt_end[] __weak_symbol __hidden; + +#include "reloc.c" + +static void +process_irelocs(void) +{ + const Elf_Rela *r; + + for (r = &__rela_iplt_start[0]; r < &__rela_iplt_end[0]; r++) + crt1_handle_rela(r); +} +#elif defined(CRT_IRELOC_REL) +extern const Elf_Rel __rel_iplt_start[] __weak_symbol __hidden; +extern const Elf_Rel __rel_iplt_end[] __weak_symbol __hidden; + +#include "reloc.c" + +static void +process_irelocs(void) +{ + const Elf_Rel *r; + + for (r = &__rel_iplt_start[0]; r < &__rel_iplt_end[0]; r++) + crt1_handle_rel(r); +} +#elif defined(CRT_IRELOC_SUPPRESS) +#else +#error "Define platform reloc type" +#endif + +static void +finalizer(void) +{ + void (*fn)(void); + size_t array_size, n; + + array_size = __fini_array_end - __fini_array_start; + for (n = array_size; n > 0; n--) { + fn = __fini_array_start[n - 1]; + if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1) + (fn)(); + } + _fini(); +} + +static void +handle_static_init(int argc, char **argv, char **env) +{ + void (*fn)(int, char **, char **); + size_t array_size, n; + + if (&_DYNAMIC != NULL) + return; + + atexit(finalizer); + + array_size = __preinit_array_end - __preinit_array_start; + for (n = 0; n < array_size; n++) { + fn = __preinit_array_start[n]; + if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1) + fn(argc, argv, env); + } + _init(); + array_size = __init_array_end - __init_array_start; + for (n = 0; n < array_size; n++) { + fn = __init_array_start[n]; + if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1) + fn(argc, argv, env); + } +} + +extern char **environ; + +static void +handle_argv(int argc, char *argv[], char **env) +{ + const char *s; + + if (environ == NULL) + environ = env; + if (argc > 0 && argv[0] != NULL) { + __progname = argv[0]; + for (s = __progname; *s != '\0'; s++) { + if (*s == '/') + __progname = s + 1; + } + } +} + +void +__libc_start1(int argc, char *argv[], char *env[], void (*cleanup)(void), + int (*mainX)(int, char *[], char *[])) +{ + handle_argv(argc, argv, env); + + if (&_DYNAMIC != NULL) { + atexit(cleanup); + } else { +#ifndef CRT_IRELOC_SUPPRESS + INIT_IRELOCS; + process_irelocs(); +#endif + _init_tls(); + } + + handle_static_init(argc, argv, env); + exit(mainX(argc, argv, env)); +} + +/* XXXKIB _mcleanup and monstartup defs */ +extern void _mcleanup(void); +extern void monstartup(void *, void *); + +void +__libc_start1_gcrt(int argc, char *argv[], char *env[], + void (*cleanup)(void), int (*mainX)(int, char *[], char *[]), + int *eprolp, int *etextp) +{ + handle_argv(argc, argv, env); + + if (&_DYNAMIC != NULL) { + atexit(cleanup); + } else { +#ifndef CRT_IRELOC_SUPPRESS + INIT_IRELOCS; + process_irelocs(); +#endif + _init_tls(); + } + + atexit(_mcleanup); + monstartup(eprolp, etextp); + + handle_static_init(argc, argv, env); + exit(mainX(argc, argv, env)); +} diff --git a/lib/libc/csu/mips/Makefile.inc b/lib/libc/csu/mips/Makefile.inc new file mode 100644 index 000000000000..2534e6579f38 --- /dev/null +++ b/lib/libc/csu/mips/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_SUPPRESS \ + -DINIT_IRELOCS="" diff --git a/lib/libc/csu/powerpc/Makefile.inc b/lib/libc/csu/powerpc/Makefile.inc new file mode 100644 index 000000000000..2534e6579f38 --- /dev/null +++ b/lib/libc/csu/powerpc/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_SUPPRESS \ + -DINIT_IRELOCS="" diff --git a/lib/libc/csu/powerpc64/Makefile.inc b/lib/libc/csu/powerpc64/Makefile.inc new file mode 100644 index 000000000000..5d59d40eb393 --- /dev/null +++ b/lib/libc/csu/powerpc64/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_RELA \ + -DINIT_IRELOCS="init_cpu_features(env)" diff --git a/lib/libc/csu/powerpc64/reloc.c b/lib/libc/csu/powerpc64/reloc.c new file mode 100644 index 000000000000..5ba191d07cd9 --- /dev/null +++ b/lib/libc/csu/powerpc64/reloc.c @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2019 Leandro Lupori + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +static uint32_t cpu_features; +static uint32_t cpu_features2; + +static void +init_cpu_features(char **env) +{ + const Elf_Auxinfo *aux; + + /* Find the auxiliary vector on the stack. */ + while (*env++ != 0) /* Skip over environment, and NULL terminator */ + ; + aux = (const Elf_Auxinfo *)env; + + /* Digest the auxiliary vector. */ + for (; aux->a_type != AT_NULL; aux++) { + switch (aux->a_type) { + case AT_HWCAP: + cpu_features = (uint32_t)aux->a_un.a_val; + break; + case AT_HWCAP2: + cpu_features2 = (uint32_t)aux->a_un.a_val; + break; + } + } +} + +static void +crt1_handle_rela(const Elf_Rela *r) +{ + typedef Elf_Addr (*ifunc_resolver_t)( + uint32_t, uint32_t, uint64_t, uint64_t, + uint64_t, uint64_t, uint64_t, uint64_t); + Elf_Addr *ptr, *where, target; + + switch (ELF_R_TYPE(r->r_info)) { + case R_PPC_IRELATIVE: + ptr = (Elf_Addr *)r->r_addend; + where = (Elf_Addr *)r->r_offset; + target = ((ifunc_resolver_t)ptr)(cpu_features, cpu_features2, + 0, 0, 0, 0, 0, 0); + *where = target; + break; + } +} diff --git a/lib/libc/csu/riscv/Makefile.inc b/lib/libc/csu/riscv/Makefile.inc new file mode 100644 index 000000000000..2534e6579f38 --- /dev/null +++ b/lib/libc/csu/riscv/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_SUPPRESS \ + -DINIT_IRELOCS="" diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 78a75cc6284d..5fa7a6da1198 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -255,6 +255,12 @@ enum { int _yp_check(char **); #endif +void __libc_start1(int, char *[], char *[], + void (*)(void), int (*)(int, char *[], char *[])) __dead2; +void __libc_start1_gcrt(int, char *[], char *[], + void (*)(void), int (*)(int, char *[], char *[]), + int *, int *) __dead2; + /* * Initialise TLS for static programs */ From nobody Mon Jun 12 12:22:27 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 4QfrRR58Sgz4d9rD; Mon, 12 Jun 2023 12:22:27 +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 4QfrRR4CqYz3qfT; Mon, 12 Jun 2023 12:22:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572547; 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=dQ78l0DaGQLGXH/Ejs5RRovptyZ3Jtt1CCsIy5R24hA=; b=vQfR862X3vpyD8XGIy5pYUFNLRZyhBv6JAMI4Jb06aaMAGZFSFE/aLBxgZWoMs5wlH3e5/ uUjFAlBCZyX555MT3FGl4LT063zEybbUGMBgZzSHE82H+5R5iUabkwPIxtb06OdLTHNmJZ NmS6U4QqWi/SikHRkhUONj2HuJGXv/obP+cpzk6x2I3Muu2lW/W1ZAABmAF8m3UiwjR8mC 6fyt4SOr7PfPf8onft9j9/0o+V8CC5yi9lb9+0ejgVX4dsIfKkAIyDFZRiexNlwLgNHsVS GglRvrFxT44yUhrAVjZnMtukcnwYsxkmXRpNUpN4NfF0RSkm2k6+l/og6233VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572547; 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=dQ78l0DaGQLGXH/Ejs5RRovptyZ3Jtt1CCsIy5R24hA=; b=cs9IKET0jIkTIHvxbF5iopP92YCA6hBd1x/L+RC8t/dflHsHJi1iLpGtREkHGVqIIeG/Ge L1aT4zOTbWtsEDwOINEexznfVo+H9DX85XP1u2aZlFxkMAbCaP0ipLbHWu+imGDXwJEomI cFkzi7KE/x/IdDRPo89qUyiJwPQ1H5MOeKFsJndqyiKo70s8e/ml6B2Do/SGeGQABYncG7 OtI5U/bob7pOSuRsWzjW8v7342zNcsCInewj8OSqVbsw0p4ukrF5GTklDv+9wFVU6CZ02A Ov53yqqxQERLhW5haFtLSh1ztS2eNAYgBdM2KS3fa1izXkrhvmaM9aR37hFPQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572547; a=rsa-sha256; cv=none; b=lhMo/nwM9bTxH82JUOEU9GG7nb5Vv5RC5iKJDN6OYxw+di/klghL5BUSMgGF267rZuSHmv O6rWfRKD12x131AIYsp2PhqjnuKmj6WKWs1dAew5nlaA44wV7ogNUUcErjqcuITsb3+Yjg gq/48sIAkDPtGq9PiaMYVTLZIRu85Jp4E7zRYzhX5GulM0VGMAlbi3tf3s1v1RZVGs5DGM jG9WiYAANpY5SALrl9PVzNVXL3LRy1lhYNYtJIWhVf6wpoJchSYZMkIPWCtQ/ifbrk9Vaj Hxzi2/KhImRbcYuPSBXzuVovIsWySAS+zh+JKDxQ4DItOW2P64dzlloiDMK4DQ== 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 4QfrRR32Nwzg1d; Mon, 12 Jun 2023 12:22:27 +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 35CCMRZk048036; Mon, 12 Jun 2023 12:22:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMR8a048035; Mon, 12 Jun 2023 12:22:27 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:27 GMT Message-Id: <202306121222.35CCMR8a048035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3f7327695061 - stable/13 - x86: microoptimize static PIE startup 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f732769506181f77f38b656fa32692f4b87c9fd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3f732769506181f77f38b656fa32692f4b87c9fd commit 3f732769506181f77f38b656fa32692f4b87c9fd Author: Konstantin Belousov AuthorDate: 2022-11-01 01:42:50 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 12:19:38 +0000 x86: microoptimize static PIE startup (cherry picked from commit 0303938539f3f12da65128fc67f883efe82dc125) --- lib/libc/csu/amd64/Makefile.inc | 2 +- lib/libc/csu/amd64/reloc.c | 14 ++++++++++---- lib/libc/csu/i386/Makefile.inc | 2 +- lib/libc/csu/i386/reloc.c | 14 ++++++++++---- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/libc/csu/amd64/Makefile.inc b/lib/libc/csu/amd64/Makefile.inc index b3420a638164..f14033217580 100644 --- a/lib/libc/csu/amd64/Makefile.inc +++ b/lib/libc/csu/amd64/Makefile.inc @@ -1,4 +1,4 @@ # CFLAGS+= -DCRT_IRELOC_RELA \ - -DINIT_IRELOCS="" + -DINIT_IRELOCS="init_cpu_features()" diff --git a/lib/libc/csu/amd64/reloc.c b/lib/libc/csu/amd64/reloc.c index adb52e42a32c..0a5a24929954 100644 --- a/lib/libc/csu/amd64/reloc.c +++ b/lib/libc/csu/amd64/reloc.c @@ -29,13 +29,13 @@ __FBSDID("$FreeBSD$"); #include #include +static uint32_t cpu_feature, cpu_feature2; +static uint32_t cpu_stdext_feature, cpu_stdext_feature2; + static void -crt1_handle_rela(const Elf_Rela *r) +init_cpu_features(void) { - Elf_Addr *ptr, *where, target; u_int p[4]; - uint32_t cpu_feature, cpu_feature2; - uint32_t cpu_stdext_feature, cpu_stdext_feature2; do_cpuid(1, p); cpu_feature = p[3]; @@ -49,6 +49,12 @@ crt1_handle_rela(const Elf_Rela *r) cpu_stdext_feature = 0; cpu_stdext_feature2 = 0; } +} + +static void +crt1_handle_rela(const Elf_Rela *r) +{ + Elf_Addr *ptr, *where, target; switch (ELF_R_TYPE(r->r_info)) { case R_X86_64_IRELATIVE: diff --git a/lib/libc/csu/i386/Makefile.inc b/lib/libc/csu/i386/Makefile.inc index ac0984df2349..f3f8c2b176ce 100644 --- a/lib/libc/csu/i386/Makefile.inc +++ b/lib/libc/csu/i386/Makefile.inc @@ -1,4 +1,4 @@ # CFLAGS+= -DCRT_IRELOC_REL \ - -DINIT_IRELOCS="" + -DINIT_IRELOCS="init_cpu_features()" diff --git a/lib/libc/csu/i386/reloc.c b/lib/libc/csu/i386/reloc.c index 13438035841d..f99b1089cf47 100644 --- a/lib/libc/csu/i386/reloc.c +++ b/lib/libc/csu/i386/reloc.c @@ -29,13 +29,13 @@ __FBSDID("$FreeBSD$"); #include #include +static uint32_t cpu_feature, cpu_feature2; +static uint32_t cpu_stdext_feature, cpu_stdext_feature2; + static void -crt1_handle_rel(const Elf_Rel *r) +init_cpu_features(void) { - Elf_Addr *where, target; u_int cpuid_supported, p[4]; - uint32_t cpu_feature, cpu_feature2; - uint32_t cpu_stdext_feature, cpu_stdext_feature2; __asm __volatile( " pushfl\n" @@ -72,6 +72,12 @@ crt1_handle_rel(const Elf_Rel *r) cpu_stdext_feature = 0; cpu_stdext_feature2 = 0; } +} + +static void +crt1_handle_rel(const Elf_Rel *r) +{ + Elf_Addr *where, target; switch (ELF_R_TYPE(r->r_info)) { case R_386_IRELATIVE: From nobody Mon Jun 12 12:22:28 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 4QfrRT0Vlrz4d9lK; Mon, 12 Jun 2023 12:22:29 +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 4QfrRS4qw3z3qmx; Mon, 12 Jun 2023 12:22:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572548; 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=/Em2mEdXfbj7ppQxxdA9K2vPPNWcGCwSn3ffNwd1q6A=; b=NrG5vFKEuZYb1yA0zUKaVfGK22LiJRlIq0Jqvblg4RI5U5fIMgB4rRaYD6zaXlrHFbCSIX GbNNz6SyZVxjTm6DhqYIQCc3fJLvbHU3TQQwBoC5n2WvzKIRCM9ysAFZMv9+A7Ek1cPX6q AJx1P1AzTICZBli6BV7xBsdalzbzZOlJ8X3HMeybfMES5IwhUxY4PVDAWWIcObb8bo45Bo m0O7IXn6bWV0OCzf0m1sWSSUOWykcUAEsXtb/jrBA9tbpQoSAHVGmItV+t5W6APUjIht3g sgT++f1ZssS3Q4VYMrvlghM+IM5umCkTfONPt4EM9YQDkykQiauCPFS/S2UfEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572548; 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=/Em2mEdXfbj7ppQxxdA9K2vPPNWcGCwSn3ffNwd1q6A=; b=l55DMJkj6RplwlHJt//ELiBV9KO8MSpjgzhr3BlEIUJBz+uWvK1XOohMI1V2t0QlvA5YhR YQbI4zFoROg0wUStbd9umUonVoKHsRBP3le0EXzlGB5XJVOkHVxD93B6CVpqwnYjmH2VxI Jreu0eVope6twCmm0VpV7p19indv3mz33ltfnka/Iqlb4Kkli/9gEP5llUd0X4c95A3JmE c8Z+0otwJR0nyx/70K+hoIKzjjI7YurJbiPtDiIT+9nLRveUviF+gcpEcYqD3RhqalxosQ C0quqLItida4dgKKD+c8hFx4KnHhATlmw4Pgcv0TSpNhw9v9KMih6LwKNK7W8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572548; a=rsa-sha256; cv=none; b=LGdDi2wpC5wz2OfJBUj+Hl3371T1SfELTAddyvrvrH1fU14ltFvrHYPai45KhsvmBrT6x3 y2FKj+zfGB/o5M4ggCiga8FxNHJGYPM922oZaIvFLBkx8GKOY6E06e1aolLkaPRg58roXi VXJrviVWvVCtagoIgk6+h8n6mvjHNE1zP3SE5Oj8Mr3ZJjAkzlFtcpn+RH8gZgh5rEEypO 2wYwiEC2h6h7ZoBjvLhqFfW+MjjY8NMqa6nqIUfECGCXOy9WS6Xy9b8fiiPcYIY9GMIfCV MNgTKDlNnqOCRj7rOBVP8JQJ2yNc7Y13HSg1CaYkFdz5ZO8o8rhc5tq5oS0OhQ== 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 4QfrRS3klzzfQp; Mon, 12 Jun 2023 12:22:28 +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 35CCMSwj048060; Mon, 12 Jun 2023 12:22:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMSje048059; Mon, 12 Jun 2023 12:22:28 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:28 GMT Message-Id: <202306121222.35CCMSje048059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 750a1522f6ac - stable/13 - libc: move declaration of 'char **environ' to common private header 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 750a1522f6acf9bb51eed67d350f9f730b647ad5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=750a1522f6acf9bb51eed67d350f9f730b647ad5 commit 750a1522f6acf9bb51eed67d350f9f730b647ad5 Author: Konstantin Belousov AuthorDate: 2022-11-06 04:08:36 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 12:19:38 +0000 libc: move declaration of 'char **environ' to common private header (cherry picked from commit 0c6f0c0db75ea5a1e89a68a163fc555bdd7d00f5) --- lib/libc/csu/ignore_init.c | 2 -- lib/libc/gen/auxv.c | 1 - lib/libc/gen/exec.c | 2 -- lib/libc/gen/popen.c | 2 -- lib/libc/gen/posix_spawn.c | 2 -- lib/libc/gen/tls.c | 2 -- lib/libc/include/libc_private.h | 2 ++ lib/libc/stdlib/getenv.c | 3 +-- 8 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/libc/csu/ignore_init.c b/lib/libc/csu/ignore_init.c index 60c45d7e735f..346409e3f370 100644 --- a/lib/libc/csu/ignore_init.c +++ b/lib/libc/csu/ignore_init.c @@ -117,8 +117,6 @@ handle_static_init(int argc, char **argv, char **env) } } -extern char **environ; - static void handle_argv(int argc, char *argv[], char **env) { diff --git a/lib/libc/gen/auxv.c b/lib/libc/gen/auxv.c index 2f043f8814cf..29b3d6929144 100644 --- a/lib/libc/gen/auxv.c +++ b/lib/libc/gen/auxv.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; extern int _DYNAMIC; #pragma weak _DYNAMIC diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index 2c703bb4e73e..f1d69e147719 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; - static const char execvPe_err_preamble[] = "execvP: "; static const char execvPe_err_trailer[] = ": path too long\n"; diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index c5373077f3ae..f0b1a61c2803 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -53,8 +53,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; - struct pid { SLIST_ENTRY(pid) next; FILE *fp; diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index 909db9a60a02..7dc0ade5b309 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -extern char **environ; - struct __posix_spawnattr { short sa_flags; pid_t sa_pgroup; diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index d75b883b68db..74b2ae562c99 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -401,8 +401,6 @@ __libc_free_tls(void *tcb __unused, size_t tcbsize __unused, #endif /* PIC */ -extern char **environ; - void _init_tls(void) { diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 5fa7a6da1198..991624557118 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -39,6 +39,8 @@ #include #include +extern char **environ; + /* * The kernel doesn't expose PID_MAX to the user space. Save it here * to allow to run a newer world on a pre-1400079 kernel. diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 4c71801b242f..a413e8d7d93f 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" - +#include "libc_private.h" static const char CorruptEnvFindMsg[] = "environment corrupt; unable to find "; static const char CorruptEnvValueMsg[] = @@ -56,7 +56,6 @@ static const char CorruptEnvValueMsg[] = * intEnviron: Internally-built environ. Exposed via environ during * (re)builds of the environment. */ -extern char **environ; static char **origEnviron; static char **intEnviron = NULL; static int environSize = 0; From nobody Mon Jun 12 12:22:29 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 4QfrRT6rvdz4d9j1; Mon, 12 Jun 2023 12:22:29 +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 4QfrRT5Xsqz3qtK; Mon, 12 Jun 2023 12:22:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572549; 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=7H4XTOEqyrLfYKqxABSuXUlsBFjqeI3aBKRhB9w3trY=; b=bK9UX0N1S73vu1LK8qJyqVk0H5E7X1tF4Ncz7Iu84puBkd2X2r/NbpH1tCau+/7DbCLRsi yzJRnyf7QKYBHt/Ms8L3tMKPzMI4Haz8gQmBBcWL6R9tV0OiYbmEVZ84a9fTs7ug5slzCE siTVj4wqpi9CxarZnhUB4KaiA/FJY4hgrhZVz4YZOHQ5ZJU9G1I9M+yxlTnxgynjm1tsWC 3nP4YnWa7WRULDQYQUr5uWp0RzMS/lKea1CnKJdTP5D3aIj80e/cTfFE2J5BpDLLVh4V5J JesKC/BnbRpIoUK1fcNsQVrpx6IJKbcdVQ6YJm0JzrCcKAnbwbB5tTEwQDy5cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572549; 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=7H4XTOEqyrLfYKqxABSuXUlsBFjqeI3aBKRhB9w3trY=; b=OT8mAjLbjep5VxWfPjk4lf1vduzbR5fqeh95U0llb7R4BNPSHTA/8kVSmF2o8X+HncYK1U D/2sqQY58RHt8P98xIrtIltWKKRewLsp6B1YxeKkQd+W1CsV1IsTf2HakGZq6t3I+1ksk4 ROmWZa4sKbHo+fZpCElJfm9xye6Ay1Oh/prHjiPoMRv25sfm+4U2zP3cJyNFHKfzs5OA4V UVCbmpAOtS1f52ANMxf8SsuZLyeufR31pQTRfymGOGnV/sRP2XlbDdJseXWRYds26Ruoij 0rYlf6wn5NOZovFq0aAXniOaxBttOknEAvmC+1c9N8EorGMoPgQEHIj6PbDSlg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572549; a=rsa-sha256; cv=none; b=TAv8I8DmvwbEBmBde0cnj8okHUrBkprqev8b8sJKnIJVLWsAP7V3vsQ5+fWsYFBZDnp3tE zBhgJtw0EfoN2PkEggp1DWLfEdH7HWPzF9VX+vgx6yOXYMFMKGXlffmYg9e1f+K1hIK6WR LhqaOopJ0uuSSLTjgaSHgeZXUOnDQPAKyBHnYwd+7paqUQ4dEud3ULbPVglJdoFfFtH1j8 nF7qrT6i72gZ6eZ+XadsberL4qPxcVQjCRMBcx7GlZuFfJLbOurKj9HNcQj99oVBuPN01d xcdb325t79iUWiiUfC0q/PsnxcFRV7DLIH3UbYg1R/Swx+5u9afWX6uwasDPbQ== 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 4QfrRT4fptzg30; Mon, 12 Jun 2023 12:22:29 +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 35CCMTYn048079; Mon, 12 Jun 2023 12:22:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMTK9048078; Mon, 12 Jun 2023 12:22:29 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:29 GMT Message-Id: <202306121222.35CCMTK9048078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c604aa6c6b3f - stable/13 - libc/csu: rename ignore_init.c to libc_start1.c 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c604aa6c6b3f8877709c9d11a455428ba646a6e5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c604aa6c6b3f8877709c9d11a455428ba646a6e5 commit c604aa6c6b3f8877709c9d11a455428ba646a6e5 Author: Konstantin Belousov AuthorDate: 2023-03-11 22:56:46 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 12:19:38 +0000 libc/csu: rename ignore_init.c to libc_start1.c (cherry picked from commit c5c9d980c4b0ca3866cb2ad67ec3f7111f5c4285) --- lib/libc/csu/Makefile.inc | 2 +- lib/libc/csu/{ignore_init.c => libc_start1.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/csu/Makefile.inc b/lib/libc/csu/Makefile.inc index 453303bea608..666744f27c8b 100644 --- a/lib/libc/csu/Makefile.inc +++ b/lib/libc/csu/Makefile.inc @@ -4,7 +4,7 @@ .include "${LIBC_SRCTOP}/csu/${LIBC_ARCH}/Makefile.inc" SRCS+= \ - ignore_init.c + libc_start1.c CFLAGS+= -I${LIBC_SRCTOP}/csu/${LIBC_ARCH} SYM_MAPS+=${LIBC_SRCTOP}/csu/Symbol.map diff --git a/lib/libc/csu/ignore_init.c b/lib/libc/csu/libc_start1.c similarity index 100% rename from lib/libc/csu/ignore_init.c rename to lib/libc/csu/libc_start1.c From nobody Mon Jun 12 12:22:30 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 4QfrRW0JCrz4d9dK; Mon, 12 Jun 2023 12:22:31 +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 4QfrRV6l8xz3qln; Mon, 12 Jun 2023 12:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572550; 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=2OeOxxkFobcIq9A+Qm7QFCjB8MlP02whlXZXL1oI44c=; b=nhjpi6Wr5+c31xiaaJjL7ae8Il78Z+Pki31VizSdbMfW/SnaV1g43TB4Z/Nkay79/WKBwx bQ4Csg6U96TH88uFw1utHqU5kMxRj3JHw86Kl+Qqsmt8/YhzDMXyaLq8+i9/4yr7kdaueI 0bUGPE8pDGReTYWsv1KERzVTjGrNvtjiBvKyPwXlrbtMKwPGtBk1sD2a+mY7SqLoowGj3R kvninTLrxGqr+61u2o4C71r0xD9cyLL9Qz2KxN16wZKylnYK7MCraTzdVRQycmY4lAqn6O MopiYZ41vrttY9nvk0jWSRWN3ShDglVxeqUXVrZEnmv87D4vYh0oW59Qntw2Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572550; 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=2OeOxxkFobcIq9A+Qm7QFCjB8MlP02whlXZXL1oI44c=; b=Y1wrkeiWqM7yOX6P1WeuHD+AVGZr2IxEi91hZy7b2msL/7hsYJFGMJV3tDtajrhJdSSnco e/4LMGYcUw2jK/hOQIKcOXf7GIRHJpzWt1JWafhrN7LDKA3wd8Smz+T41CsBFgLYOquSpw 7i7r15fPL2NyfcaT4Z/Fs3FJ8GjhKWRENGjUILauaoSeLtbkdLZ1vc/CgeNbHHA0Lx4K1P GyBXHFacrz8oHpq2iK75Vjcfus1jvMtSWupPOn3sOrlLuz/bMiCEEN7loQed/UmE3SZAZi I/eofdoL/c8sQbx85++eWwSbNFJGpwTBlMKDoBwVdNyjAV5oLOWHbBFNa22LZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572550; a=rsa-sha256; cv=none; b=XlPD+wDJAFpU3YqbDpJo2HR1KONSprVRqYyVxzFRxP4f7MpyPNPsE5quNmTGR1a4OReHF6 qPqv1nGAZneb24gJSBMqYKJv7zQreBAAfjvTpXubCcch0qN97OILI6MVoq2EtkFysBKMl5 t63CXkjWCwstcFL3nZuwYJt1CBjzH2ObCOu8Go79rNN5++eYHZ67ka9BZMRnM29D6cy9tJ GjPFGAlNEY4dj37Vez6Y3/fN/bS8P0kT8JOSs2qg23YejhfcCenTgKyejbtLlX7b0F0Ozz jn81yUohH4oVAh52foPo9Di2I9OcMmDE/V/E4yuZiOPqAeZipbQFfguVv5ss3w== 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 4QfrRV5c0mzflN; Mon, 12 Jun 2023 12:22:30 +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 35CCMUuM048098; Mon, 12 Jun 2023 12:22:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMUTo048097; Mon, 12 Jun 2023 12:22:30 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:30 GMT Message-Id: <202306121222.35CCMUTo048097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 928fcfec0950 - stable/13 - libc/csu: add powerpcspe 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 928fcfec09502d18b7177d905532baf244b1dc56 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=928fcfec09502d18b7177d905532baf244b1dc56 commit 928fcfec09502d18b7177d905532baf244b1dc56 Author: Konstantin Belousov AuthorDate: 2023-03-12 09:59:16 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 12:19:38 +0000 libc/csu: add powerpcspe (cherry picked from commit 94e3409e2d02ce3e4817d1a94051dc798e520745) --- lib/libc/csu/powerpcspe/Makefile.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libc/csu/powerpcspe/Makefile.inc b/lib/libc/csu/powerpcspe/Makefile.inc new file mode 100644 index 000000000000..2534e6579f38 --- /dev/null +++ b/lib/libc/csu/powerpcspe/Makefile.inc @@ -0,0 +1,4 @@ +# + +CFLAGS+= -DCRT_IRELOC_SUPPRESS \ + -DINIT_IRELOCS="" From nobody Mon Jun 12 12:22:31 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 4QfrRX1Vjwz4d9rV; Mon, 12 Jun 2023 12:22:32 +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 4QfrRX07FDz3qyy; Mon, 12 Jun 2023 12:22:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572552; 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=xcJsnTZxZTSx2x0tAq1s13rNDzgkZmlDZAjTMtpUpM4=; b=kUITJ4r6C37vZqINIPZ5ipmM31LsBwAIpXUwOfiE7EkK3oda9+yylkkNvtNEoJ8bBRnkBf jBHCzlH6PyLtJ+OrCvRW3u1Jy0F1RWDUDkx9TuPdBdYRG/JvxI1+shNitUPpys7VpzaRcO bsV4fVoUg6/hYTYs6VfTe2mVItgqg9g5p+AUEapQl83lg3NyhXTjRHvpY3T08MSK8y2ucl 30LIMjbi97rXlRammKPrU4ldRbNYR4FmbnqNPyVCVwy202Vym9IsEc8klwnQhK71RorYNH 6RtQ6USP4gXNzDFHyxIjwyKw+IC5SSmW6dBpXxTfu5e54qFZs61KkmVnOd3MmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686572552; 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=xcJsnTZxZTSx2x0tAq1s13rNDzgkZmlDZAjTMtpUpM4=; b=A0yLTASLkihF1cM6DbN9KCJDoZ4rAxlqxhjn0Oh0WzbbNMOlGP6XTOdkuGlbP/+1D3QiKx 37XAXmWQ1egOONFtCC3eoN3vg03XlJIfUI6vFPk3zfbMHUUaeztj/LUrvBvt+Zi9hkZYh9 5veTrCPAymySpSW1E1JpfM4xyovys1DAdyBmv+UpbldgRR/DWgGH+CDHrqUY1GuX6KHDWJ ey+Q/O7zyRmusScjUSs9xhukousKp93iA2o+hUxTLUqQiLajT9qB+uTIZFUzzaHQPGMd8Z THWj+x8ctZbnj12jZjjprVpSV+maP14VesQ48TP7KJoH115WSUzATGfdIwETnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686572552; a=rsa-sha256; cv=none; b=gcKa5bkMyRGKZ3KOh+2isOgUe1HQXHapOjtvExRdzfVJQ9+XZWsoMQxW3lE5SIVrLZTkRw ppIRm8DlFMWWbc1FhcsCr9FNpxGn6TRTyIKNmQyw5BuMj95QDvN0PfKPL97N2i4TOVU3Sa xrZHoJD2tA0cFgu0N0pTsV9pzVZ1C2012h50b9ldpTvZIiOJv4mE/ciVAlh8VbZiht5L9f xt4iqWVztEMSd89+egDZwLQhGvJVF1cUxyVj3ufTBB1gUxg2OyXhbGyg3ZFN6Ax7/e30hl u0WwMClRNs29wjNfX6l6YgCifUrIvl4/SHyhgyjffIvGbSxcGTyrF4qbjFjLZQ== 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 4QfrRW6HYTzg32; Mon, 12 Jun 2023 12:22:31 +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 35CCMVfx048117; Mon, 12 Jun 2023 12:22:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CCMVI8048116; Mon, 12 Jun 2023 12:22:31 GMT (envelope-from git) Date: Mon, 12 Jun 2023 12:22:31 GMT Message-Id: <202306121222.35CCMVI8048116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c10e56732217 - stable/13 - lib/csu: do not compile the body of handle_static_init() for PIC build at all 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c10e567322179989c611b4f488b754108d174d5c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c10e567322179989c611b4f488b754108d174d5c commit c10e567322179989c611b4f488b754108d174d5c Author: Konstantin Belousov AuthorDate: 2023-03-12 01:45:37 +0000 Commit: Konstantin Belousov CommitDate: 2023-06-12 12:19:38 +0000 lib/csu: do not compile the body of handle_static_init() for PIC build at all (cherry picked from commit c383f4857f1696c4beb782db36323f46f0c4f6de) --- lib/libc/csu/libc_start1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libc/csu/libc_start1.c b/lib/libc/csu/libc_start1.c index 346409e3f370..d6a973bf0fe0 100644 --- a/lib/libc/csu/libc_start1.c +++ b/lib/libc/csu/libc_start1.c @@ -94,6 +94,7 @@ finalizer(void) static void handle_static_init(int argc, char **argv, char **env) { +#ifndef PIC void (*fn)(int, char **, char **); size_t array_size, n; @@ -115,6 +116,7 @@ handle_static_init(int argc, char **argv, char **env) if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1) fn(argc, argv, env); } +#endif } static void From nobody Mon Jun 12 13:50:17 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 4QftNp0v3Rz4cGqm; Mon, 12 Jun 2023 13:50:18 +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 4QftNp061zz47H4; Mon, 12 Jun 2023 13:50:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577818; 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=NSlHTHteVhqogsO+sBl93U7r2IDiojflRO4OFCdU+yw=; b=HtNj6S5T3TiXEdur/SuTaoNJ8vI3v/j5iBi2Gk+6dslJcfFwE2zWxQNiVfMHBp5NlLWTNA 1f6ixL14FKehXtvtxlyAHMmwp1rqW9KTD62qpjlP/I/FBgnH/WKF+6bdEiFUo4AwDzC8r4 TQGet9WB2F+X6qEidzdTtyJ3HR1B1RmuT3SSX43UUyDnIg3/AHXpOUwXim0XGK43tQDCgh 2+k9jY5vLgNEItCH/23dpfa+Qqcu4CkbDINg28qW8tSjyKu3+ZXVtlGUooQqXFXPih6xpY Rbguuo6b2BAK/TEn4uyUPTfy4ThZSbzFNt44lRgX6Z5s5BLe/JIwH+AxsmvMWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577818; 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=NSlHTHteVhqogsO+sBl93U7r2IDiojflRO4OFCdU+yw=; b=YqI9lREUpEMDG1EJsilKilE9NzM7dWHcL6qhZiVgjmExSgLRpvYz9D9k08bvR4jpZyTBSx 62h5j5/Tt9zCQPYFNq2uTQF7DX5Ip8BQG/E4xOdbriw2pU8ky0hbyI+ZsldLocDWEFE9/b Yk2xLh9gBURYoeOMsOkOPFaMXwYiQGc5rT1wOgOvhyMItM5SE8l4p1dgH7NHMfqlglYhcS bfKFujQoBBMRQmMhA+/76qGliDFgwietPwfhaoXw5jAleoUF0m6zVErKw81GD3dYDiGyve 7tiu0WiT+wUhXloa1Pb5LJjfYL/2fwJ8psqzWWhL97LS3weDPbA62w+lJZSs6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577818; a=rsa-sha256; cv=none; b=vV4oQCBbbD+TWGEaNiJuiwx2cAIa0pbRCzeYfL+ulnE+UsuH0ddoXl6z/Gw5PsC784Juv7 2IPEaFdLDsIPYYOIbQ4eA8Vlj2vx6pq76CYV0OhLw6cV0YYxVQjbduQuR3PiMzOa3VmEa5 U0KO3OT6zfDigqCl29qbSkb8EwX7N4DZy5IecTvufE7xtn9Ewrc6ERcVfmaCc0qlYIi5Fx nZEjnoPHD+3mm4XGcQPzhJBvUqq3aeEVyPLdoKxVoxGAX8fT2i0rmS3d8zJuVsDhqpqk5l Aqu1cVQMcdv3iS9fQZQaSx8A5A1RxsTZfySB5yQaTCEqpwRje5QJdUTj1uaXkw== 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 4QftNn69xmzhj8; Mon, 12 Jun 2023 13:50:17 +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 35CDoHN1089284; Mon, 12 Jun 2023 13:50:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoHx0089283; Mon, 12 Jun 2023 13:50:17 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:17 GMT Message-Id: <202306121350.35CDoHx0089283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: be12b4f1fbf6 - stable/13 - riscv: Rework CPU identification (first part) 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: be12b4f1fbf69d14a13cc1839c27a96afb2dda9b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=be12b4f1fbf69d14a13cc1839c27a96afb2dda9b commit be12b4f1fbf69d14a13cc1839c27a96afb2dda9b Author: Mitchell Horne AuthorDate: 2023-05-22 23:48:41 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: Rework CPU identification (first part) Make better use of the RISC-V identification CSRs: mvendorid, marchid, and mimpid. This code was written before these registers were well-specified, or even available to the kernel. It currently fails to recognize any CPU or platform. Per the privileged specification, mvendorid contains the JEDEC vendor ID, or zero. The marchid register denotes the CPU microarchitecture. This is either one of the globally allocated open-source implementation IDs, or the field has a custom encoding. Therefore, for known vendors (SiFive) we can also maintain a list of known marchid values. If we can not give a name to the CPU but marchid is non-zero, then just print its value in the report. The mimpid (implementation ID) could be used in the future to more uniquely identify the micro-architecture, but it really remains to be seen how it gets used. For now we just print its value. Thank you to Danjel Qyteza who submitted an early version of this change to me, although it has been almost entirely rewritten. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39809 (cherry picked from commit 88b4d124efc5a2d45660551fe0750acc0be6d3cd) --- sys/riscv/include/cpu.h | 45 +++++++++------- sys/riscv/riscv/identcpu.c | 128 ++++++++++++++++++++++++++------------------- 2 files changed, 101 insertions(+), 72 deletions(-) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index ee7b1111af56..b33e34d350fb 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -52,27 +52,36 @@ #ifdef _KERNEL /* - * 0x0000 CPU ID unimplemented - * 0x0001 UC Berkeley Rocket repo - * 0x0002­0x7FFE Reserved for open-source repos - * 0x7FFF Reserved for extension - * 0x8000 Reserved for anonymous source - * 0x8001­0xFFFE Reserved for proprietary implementations - * 0xFFFF Reserved for extension + * Core manufacturer IDs, as reported by the mvendorid CSR. */ +#define MVENDORID_UNIMPL 0x0 +#define MVENDORID_SIFIVE 0x489 +#define MVENDORID_THEAD 0x5b7 -#define CPU_IMPL_SHIFT 0 -#define CPU_IMPL_MASK (0xffff << CPU_IMPL_SHIFT) -#define CPU_IMPL(mimpid) ((mimpid & CPU_IMPL_MASK) >> CPU_IMPL_SHIFT) -#define CPU_IMPL_UNIMPLEMEN 0x0 -#define CPU_IMPL_UCB_ROCKET 0x1 +/* + * Micro-architecture ID register, marchid. + * + * IDs for open-source implementations are allocated globally. Commercial IDs + * will have the most-significant bit set. + */ +#define MARCHID_UNIMPL 0x0 +#define MARCHID_MSB (1ul << (XLEN - 1)) +#define MARCHID_OPENSOURCE(v) (v) +#define MARCHID_COMMERCIAL(v) (MARCHID_MSB | (v)) +#define MARCHID_IS_OPENSOURCE(m) (((m) & MARCHID_MSB) == 0) + +/* + * Open-source marchid values. + * + * https://github.com/riscv/riscv-isa-manual/blob/master/marchid.md + */ +#define MARCHID_UCB_ROCKET MARCHID_OPENSOURCE(1) +#define MARCHID_UCB_BOOM MARCHID_OPENSOURCE(2) +#define MARCHID_UCB_SPIKE MARCHID_OPENSOURCE(5) +#define MARCHID_UCAM_RVBS MARCHID_OPENSOURCE(10) -#define CPU_PART_SHIFT 62 -#define CPU_PART_MASK (0x3ul << CPU_PART_SHIFT) -#define CPU_PART(misa) ((misa & CPU_PART_MASK) >> CPU_PART_SHIFT) -#define CPU_PART_RV32 0x1 -#define CPU_PART_RV64 0x2 -#define CPU_PART_RV128 0x3 +/* SiFive marchid values */ +#define MARCHID_SIFIVE_U7 MARCHID_COMMERCIAL(7) extern char btext[]; extern char etext[]; diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 4c151eb47939..5ffa038513ae 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -67,42 +67,47 @@ register_t marchid; /* The architecture ID */ register_t mimpid; /* The implementation ID */ struct cpu_desc { - u_int cpu_impl; - u_int cpu_part_num; - const char *cpu_impl_name; - const char *cpu_part_name; + const char *cpu_mvendor_name; + const char *cpu_march_name; }; struct cpu_desc cpu_desc[MAXCPU]; -struct cpu_parts { - u_int part_id; - const char *part_name; +/* + * Micro-architecture tables. + */ +struct marchid_entry { + register_t march_id; + const char *march_name; }; -#define CPU_PART_NONE { -1, "Unknown Processor" } -struct cpu_implementers { - u_int impl_id; - const char *impl_name; +#define MARCHID_END { -1ul, NULL } + +/* Open-source RISC-V architecture IDs; globally allocated. */ +static const struct marchid_entry global_marchids[] = { + { MARCHID_UCB_ROCKET, "UC Berkeley Rocket" }, + { MARCHID_UCB_BOOM, "UC Berkeley Boom" }, + { MARCHID_UCB_SPIKE, "UC Berkeley Spike" }, + { MARCHID_UCAM_RVBS, "University of Cambridge RVBS" }, + MARCHID_END }; -#define CPU_IMPLEMENTER_NONE { 0, "Unknown Implementer" } -/* - * CPU base - */ -static const struct cpu_parts cpu_parts_std[] = { - { CPU_PART_RV32, "RV32" }, - { CPU_PART_RV64, "RV64" }, - { CPU_PART_RV128, "RV128" }, - CPU_PART_NONE, +static const struct marchid_entry sifive_marchids[] = { + { MARCHID_SIFIVE_U7, "6/7/P200/X200-Series Processor" }, + MARCHID_END }; /* - * Implementers table. + * Known CPU vendor/manufacturer table. */ -const struct cpu_implementers cpu_implementers[] = { - { CPU_IMPL_UCB_ROCKET, "UC Berkeley Rocket" }, - CPU_IMPLEMENTER_NONE, +static const struct { + register_t mvendor_id; + const char *mvendor_name; + const struct marchid_entry *marchid_table; +} mvendor_ids[] = { + { MVENDORID_UNIMPL, "Unspecified", NULL }, + { MVENDORID_SIFIVE, "SiFive", sifive_marchids }, + { MVENDORID_THEAD, "T-Head", NULL }, }; /* @@ -321,48 +326,63 @@ fill_elf_hwcap(void *dummy __unused) SYSINIT(identcpu, SI_SUB_CPU, SI_ORDER_ANY, fill_elf_hwcap, NULL); #endif -void -identify_cpu(void) +static void +identify_cpu_ids(struct cpu_desc *desc) { - const struct cpu_parts *cpu_partsp; - uint32_t part_id; - uint32_t impl_id; - uint64_t misa; - u_int cpu; - size_t i; - - cpu_partsp = NULL; + const struct marchid_entry *table = NULL; + int i; - /* TODO: can we get misa somewhere ? */ - misa = 0; + desc->cpu_mvendor_name = "Unknown"; + desc->cpu_march_name = "Unknown"; - cpu = PCPU_GET(cpuid); - - impl_id = CPU_IMPL(mimpid); - for (i = 0; i < nitems(cpu_implementers); i++) { - if (impl_id == cpu_implementers[i].impl_id || - cpu_implementers[i].impl_id == 0) { - cpu_desc[cpu].cpu_impl = impl_id; - cpu_desc[cpu].cpu_impl_name = cpu_implementers[i].impl_name; - cpu_partsp = cpu_parts_std; + /* + * Search for a recognized vendor, and possibly obtain the secondary + * table for marchid lookup. + */ + for (i = 0; i < nitems(mvendor_ids); i++) { + if (mvendorid == mvendor_ids[i].mvendor_id) { + desc->cpu_mvendor_name = mvendor_ids[i].mvendor_name; + table = mvendor_ids[i].marchid_table; break; } } - part_id = CPU_PART(misa); - for (i = 0; &cpu_partsp[i] != NULL; i++) { - if (part_id == cpu_partsp[i].part_id || - cpu_partsp[i].part_id == -1) { - cpu_desc[cpu].cpu_part_num = part_id; - cpu_desc[cpu].cpu_part_name = cpu_partsp[i].part_name; + if (marchid == MARCHID_UNIMPL) { + desc->cpu_march_name = "Unspecified"; + return; + } + + if (MARCHID_IS_OPENSOURCE(marchid)) { + table = global_marchids; + } else if (table == NULL) + return; + + for (i = 0; table[i].march_name != NULL; i++) { + if (marchid == table[i].march_id) { + desc->cpu_march_name = table[i].march_name; break; } } +} + +void +identify_cpu(void) +{ + struct cpu_desc *desc; + u_int cpu, hart; + + cpu = PCPU_GET(cpuid); + hart = PCPU_GET(hart); + desc = &cpu_desc[cpu]; + + identify_cpu_ids(desc); /* Print details for boot CPU or if we want verbose output */ if (cpu == 0 || bootverbose) { - printf("CPU(%d): %s %s\n", cpu, - cpu_desc[cpu].cpu_impl_name, - cpu_desc[cpu].cpu_part_name); + /* Summary line. */ + printf("CPU %-3u: Vendor=%s Core=%s (Hart %u)\n", cpu, + desc->cpu_mvendor_name, desc->cpu_march_name, hart); + + printf(" marchid=%#lx, mimpid=%#lx\n", marchid, mimpid); } } From nobody Mon Jun 12 13:50:18 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 4QftNq2brVz4cGnk; Mon, 12 Jun 2023 13:50:19 +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 4QftNq1n8vz47H9; Mon, 12 Jun 2023 13:50:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577819; 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=HlGAMYHCm/GC1J6brUGQePJeedQhmyMHAJl46zQgsdk=; b=I7Fhn/R8GRMCMsGG/wtUh6QFjvPVGa3UpG12P2eZ4reTQYT9UgNcN6qAP6MZCwZGd9Ggov bC6Fk3I6j/4FCPxiPT4MqT/oND5cHOSLRmUHH+DXCgR0L4Dg6L8epOb8K34/VoZjm/5bAJ 22CmzMqx+plEuh6SbUknwX1L0qAX5DVu1NOpr1H6u4RqpdXXTQya4j45IPDhjHJASzWl9a 809l+Mv/k+KoUaXV1bZGTgQ1XyC5N0za2xAKX2TGNDGD0AnXCmr72wacXT5aEmGNbfd6S/ PMqCg2am2VmczQPRM/DelQCulbrCtr5ESLFZzvra3M+fLoHmf57Tar1symv5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577819; 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=HlGAMYHCm/GC1J6brUGQePJeedQhmyMHAJl46zQgsdk=; b=Ujre9VK2BttqN5zsomaUu7CIbjoRnYIraO+lkxIQaveCwxvLVKygKLijsY8hkmdyFryJm/ ejUzMC9nRU9aJ4sgQIt9x6gxuTQW6dstLq46wiy8cn8RYpaVUqO34Q2clWSIWAXr6OX+u5 uUmwny3a/3vnQ3rGRi3Zkqom2UzRO2BOecQl5SiTJmQMXXGwaWtaaAWIw3lfcpCtDlNPMS KHz19R9r1gdKcIk92LoqDHrgDUqaMn4b7c63CAbqxMHFnin21mHkU3NRWDiEG4RmNMS7Jm qjoGgSi6VIPlJ63QU4AA05byNNtUwYX8eVstncqdSL0muzwW/Pnu/Jn689AUtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577819; a=rsa-sha256; cv=none; b=hg9an84ErWYQhUvJH+5CiGtw0KmD1waCryu09+3xEiW/WuuK9rBL2FHguXBbxMXmqNHV6l exscShXxKejM+0d9Cri4fMDbm/VwvdddbYfqPpc2hlYZ1/esl/kaTvwmqkOFJo9ueSURl4 dvXU3t6YWs2B2dJS6VSbTskqvKoGaF3XKOCY+6nAKXUo8UZv/jgaG1ANXozdPr9UY3RCB1 516gRirHNLqiVMEvv5ZmJdwiFio1fWv2bTIaaKc012gkVad+8t0VCSA/jpUOTConf3qQnE k2b/v8sHRHgCMm8SGOOSN+xgCishzQmzLmNt6mosTQI9icj7Ymhkc9RDu2doYA== 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 4QftNp6vMDzhHx; Mon, 12 Jun 2023 13:50:18 +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 35CDoIaP089303; Mon, 12 Jun 2023 13:50:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoIqF089302; Mon, 12 Jun 2023 13:50:18 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:18 GMT Message-Id: <202306121350.35CDoIqF089302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: bcb838d17a9b - stable/13 - riscv: Call identify_cpu() earlier for CPU 0 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bcb838d17a9bfdb156791ce30c64c1b18da188ef Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bcb838d17a9bfdb156791ce30c64c1b18da188ef commit bcb838d17a9bfdb156791ce30c64c1b18da188ef Author: Mitchell Horne AuthorDate: 2023-05-22 23:50:09 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: Call identify_cpu() earlier for CPU 0 It is advantageous to have knowledge of ISA features as early as possible. For example, the presence of newer virtual memory extensions may be useful to pmap_bootstrap(). To achieve this, split out the printf() parts of identify_cpu() into a separate function, printcpuinfo(). This latter function will be called later in boot after the console has been initialized. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39810 (cherry picked from commit b0d45b023e8c9af50312c7b56c4be9c39657afcb) --- sys/riscv/include/cpu.h | 1 + sys/riscv/riscv/identcpu.c | 10 ++++++++-- sys/riscv/riscv/machdep.c | 7 ++++++- sys/riscv/riscv/mp_machdep.c | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index b33e34d350fb..64e93e984a9b 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -90,6 +90,7 @@ void cpu_halt(void) __dead2; void cpu_reset(void) __dead2; void fork_trampoline(void); void identify_cpu(void); +void printcpuinfo(void); static __inline uint64_t get_cyclecount(void) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 5ffa038513ae..eedddb266fe7 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -367,6 +367,14 @@ identify_cpu_ids(struct cpu_desc *desc) void identify_cpu(void) +{ + struct cpu_desc *desc = &cpu_desc[PCPU_GET(cpuid)]; + + identify_cpu_ids(desc); +} + +void +printcpuinfo(void) { struct cpu_desc *desc; u_int cpu, hart; @@ -375,8 +383,6 @@ identify_cpu(void) hart = PCPU_GET(hart); desc = &cpu_desc[cpu]; - identify_cpu_ids(desc); - /* Print details for boot CPU or if we want verbose output */ if (cpu == 0 || bootverbose) { /* Summary line. */ diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index 6a910ad6dc1e..d9883e23ce90 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -131,7 +131,7 @@ cpu_startup(void *dummy) { sbi_print_version(); - identify_cpu(); + printcpuinfo(); printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem), ptoa((uintmax_t)realmem) / (1024 * 1024)); @@ -539,6 +539,11 @@ initriscv(struct riscv_bootparams *rvbp) physmem_hardware_regions(mem_regions, mem_regions_sz); #endif + /* + * Identify CPU/ISA features. + */ + identify_cpu(); + /* Do basic tuning, hz etc */ init_param1(); diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index 3fb86c5f4c28..dffadd628c46 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -256,6 +256,7 @@ init_secondary(uint64_t hart) * runtime chip identification. */ identify_cpu(); + printcpuinfo(); /* Enable software interrupts */ riscv_unmask_ipi(); From nobody Mon Jun 12 13:50:20 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 4QftNr2Wwhz4cGjR; Mon, 12 Jun 2023 13:50:20 +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 4QftNr1hXhz47Kv; Mon, 12 Jun 2023 13:50:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577820; 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=UauvMBVXCY75n70CFmFfi7ybhV8xSc7FF1h0mcUj4Dg=; b=DPxfoomzjBMwgYQ5L6GZ75dOGth0PV0YpZhmA+UNBrGgu/IvgpGNLxT5oDakWpAsO9HZvA cGcr2CInkaAgq1nmBgS9f6L4X1iyakDFD25WLpSAF4GVe3YELAz7tbcdhOKGLhxSf3X5L2 S+Tuafas+Y2DiUvuR7gXcYAaI8mCjbqGfbfegJyeQdws8fKWw+QuUcV5Ga4zdWyKfgv/MJ WRQpB3EY0pCHOHCiBRZyHLtzkX7slfqsGPoSO/tgPVzzOS53Jwj/yn/I46JQJjA7JAgeUD aUPptsGLFV3yXo47116yOl2+WKLAqu3vGXWZgBPBdEX1ctBx9GU/t4r6tOIQAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577820; 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=UauvMBVXCY75n70CFmFfi7ybhV8xSc7FF1h0mcUj4Dg=; b=ZlspPEu96QS7GaOfdi0z48FQUkagsYUoTGgQ17/viJFS3fEDA9wimt+A+rBcyF/5oHk/ne Ql9DC8uD8+H7Zm1zraEYxKDds38B1O2FUbBrSf11Sv1ExmuSeAsHi3t12zin1G28mCnDJe BEBLs9XC/8kk/cX5K5h1dzCDQ/kI37ASYg/Wzxelhq5hn230vO4ZhM7YiMYNYREqJcWRg4 pCC9WcVH+dl0cDu23ClGta9geg+j5gl70k7tGhLPtsffwGVETxw4QW6dB58KBGAnwExZZ7 pacnwN+IIpsQ92IvFoGNK64gjRXsiwkPhIKX7RZlUpqEhBUV48tGwInOWbdN9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577820; a=rsa-sha256; cv=none; b=QFNc1CqDwhmVGE8VzoSKKxWEN21OUBLnDLNAOm4661uPs9J0br56s/GIay8eiks5jdKFZE XTckWQdH4nrGh0SAgEMWCt6C72IhgmVrS/H0vFBLppSdStooBMh3ypUlDZQTs7j3cLrj3O ujQqm8xB/vtMLEsqH40M6PsQhCOGazp40kGMttjl0lKEh93Dea56fhHuHMFEjCf6gULrUx S5o3XTCXSFEZiIDuQxbacVO0kdV+azljVDI3NpxZxZrHkZjkgAvWUzaVLxlyEsrpi6REKA jWmvgE2BYrgJ+jjswlxoOtmYU3qEMeCE8TAHtyBoDGr8g7d5HZYGIsfXjJ47iw== 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 4QftNr0jxFzhwv; Mon, 12 Jun 2023 13:50:20 +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 35CDoKPB089328; Mon, 12 Jun 2023 13:50:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoKOi089327; Mon, 12 Jun 2023 13:50:20 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:20 GMT Message-Id: <202306121350.35CDoKOi089327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: efb86ba7d3b8 - stable/13 - riscv: Rework CPU identification (second part) 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: efb86ba7d3b830cd349195dc237311b9f67a9c2e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=efb86ba7d3b830cd349195dc237311b9f67a9c2e commit efb86ba7d3b830cd349195dc237311b9f67a9c2e Author: Mitchell Horne AuthorDate: 2023-05-22 23:51:44 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: Rework CPU identification (second part) Modify when and how we perform parsing and reporting. Most notably, everything now executes on CPU 0. The de-facto standard way to enumerate CPU features (ISA extensions) on RISC-V is by parsing each CPU's ISA string. We currently obtain this information from the device tree, and in the future will be able to pull it from ACPI tables. Eliminate the SYSINIT from identcpu.c. We still need to walk the /cpus list in the device tree, but now do this one CPU at a time, as a step in the identify_cpu() procedure. This is slightly less error prone, and allows us to parse ISA features for CPU 0 much earlier. Make use of the SMP hooks cpu_mp_start() and cpu_mp_announce() to identify and print secondary CPU info, respectively. This causes secondary processor identification to be printed much earlier in boot; everything is done by SI_SUB_CPU, SI_ORDER_THIRD. Adjust some other printf() calls so that we get enough useful info to debug under bootverbose. Reviewed by: markj (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39811 (cherry picked from commit b37dc0903332c4e3b593f1c92df986e8d367d697) --- sys/riscv/include/cpu.h | 4 +- sys/riscv/riscv/identcpu.c | 127 ++++++++++++++++++++++++++++--------------- sys/riscv/riscv/machdep.c | 4 +- sys/riscv/riscv/mp_machdep.c | 32 ++++++++--- 4 files changed, 111 insertions(+), 56 deletions(-) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index 64e93e984a9b..b7d83aa0f25d 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -89,8 +89,8 @@ extern char etext[]; void cpu_halt(void) __dead2; void cpu_reset(void) __dead2; void fork_trampoline(void); -void identify_cpu(void); -void printcpuinfo(void); +void identify_cpu(u_int cpu); +void printcpuinfo(u_int cpu); static __inline uint64_t get_cyclecount(void) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index eedddb266fe7..8ae3ab8478f3 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef FDT #include @@ -69,6 +68,7 @@ register_t mimpid; /* The implementation ID */ struct cpu_desc { const char *cpu_mvendor_name; const char *cpu_march_name; + u_int isa_extensions; /* Single-letter extensions. */ }; struct cpu_desc cpu_desc[MAXCPU]; @@ -128,7 +128,7 @@ static const struct { #define ISA_PREFIX_LEN (sizeof(ISA_PREFIX) - 1) static __inline int -parse_ext_s(char *isa, int idx, int len) +parse_ext_s(struct cpu_desc *desc __unused, char *isa, int idx, int len) { /* * Proceed to the next multi-letter extension or the end of the @@ -144,7 +144,7 @@ parse_ext_s(char *isa, int idx, int len) } static __inline int -parse_ext_x(char *isa, int idx, int len) +parse_ext_x(struct cpu_desc *desc __unused, char *isa, int idx, int len) { /* * Proceed to the next multi-letter extension or the end of the @@ -158,7 +158,7 @@ parse_ext_x(char *isa, int idx, int len) } static __inline int -parse_ext_z(char *isa, int idx, int len) +parse_ext_z(struct cpu_desc *desc __unused, char *isa, int idx, int len) { /* * Proceed to the next multi-letter extension or the end of the @@ -196,13 +196,17 @@ parse_ext_version(char *isa, int idx, u_int *majorp __unused, /* * Parse the ISA string, building up the set of HWCAP bits as they are found. */ -static void -parse_riscv_isa(char *isa, int len, u_long *hwcapp) +static int +parse_riscv_isa(struct cpu_desc *desc, char *isa, int len) { - u_long hwcap; int i; - hwcap = 0; + /* Check the string prefix. */ + if (strncmp(isa, ISA_PREFIX, ISA_PREFIX_LEN) != 0) { + printf("%s: Unrecognized ISA string: %s\n", __func__, isa); + return (-1); + } + i = ISA_PREFIX_LEN; while (i < len) { switch(isa[i]) { @@ -214,11 +218,11 @@ parse_riscv_isa(char *isa, int len, u_long *hwcapp) #endif case 'i': case 'm': - hwcap |= HWCAP_ISA_BIT(isa[i]); + desc->isa_extensions |= HWCAP_ISA_BIT(isa[i]); i++; break; case 'g': - hwcap |= HWCAP_ISA_G; + desc->isa_extensions |= HWCAP_ISA_G; i++; break; case 's': @@ -236,20 +240,20 @@ parse_riscv_isa(char *isa, int len, u_long *hwcapp) /* * Supervisor-level extension namespace. */ - i = parse_ext_s(isa, i, len); + i = parse_ext_s(desc, isa, i, len); break; case 'x': /* * Custom extension namespace. For now, we ignore * these. */ - i = parse_ext_x(isa, i, len); + i = parse_ext_x(desc, isa, i, len); break; case 'z': /* * Multi-letter standard extension namespace. */ - i = parse_ext_z(isa, i, len); + i = parse_ext_z(desc, isa, i, len); break; case '_': i++; @@ -263,48 +267,46 @@ parse_riscv_isa(char *isa, int len, u_long *hwcapp) i = parse_ext_version(isa, i, NULL, NULL); } - if (hwcapp != NULL) - *hwcapp = hwcap; + return (0); } #ifdef FDT static void -fill_elf_hwcap(void *dummy __unused) +identify_cpu_features_fdt(u_int cpu, struct cpu_desc *desc) { char isa[1024]; - u_long hwcap; phandle_t node; ssize_t len; + pcell_t reg; + u_int hart; node = OF_finddevice("/cpus"); if (node == -1) { - if (bootverbose) - printf("fill_elf_hwcap: Can't find cpus node\n"); + printf("%s: could not find /cpus node in FDT\n", __func__); return; } + hart = pcpu_find(cpu)->pc_hart; + /* - * Iterate through the CPUs and examine their ISA string. While we - * could assign elf_hwcap to be whatever the boot CPU supports, to - * handle the (unusual) case of running a system with hetergeneous - * ISAs, keep only the extension bits that are common to all harts. + * Locate our current CPU's node in the device-tree, and parse its + * contents to detect supported CPU/ISA features and extensions. */ for (node = OF_child(node); node > 0; node = OF_peer(node)) { /* Skip any non-CPU nodes, such as cpu-map. */ if (!ofw_bus_node_is_compatible(node, "riscv")) continue; + /* Find this CPU */ + if (OF_getencprop(node, "reg", ®, sizeof(reg)) <= 0 || + reg != hart) + continue; + len = OF_getprop(node, "riscv,isa", isa, sizeof(isa)); KASSERT(len <= sizeof(isa), ("ISA string truncated")); if (len == -1) { - if (bootverbose) - printf("fill_elf_hwcap: " - "Can't find riscv,isa property\n"); - return; - } else if (strncmp(isa, ISA_PREFIX, ISA_PREFIX_LEN) != 0) { - if (bootverbose) - printf("fill_elf_hwcap: " - "Unsupported ISA string: %s\n", isa); + printf("%s: could not find 'riscv,isa' property " + "for CPU %d, hart %u\n", __func__, cpu, hart); return; } @@ -314,17 +316,50 @@ fill_elf_hwcap(void *dummy __unused) */ for (int i = 0; i < len; i++) isa[i] = tolower(isa[i]); - parse_riscv_isa(isa, len, &hwcap); + if (parse_riscv_isa(desc, isa, len) != 0) + return; - if (elf_hwcap != 0) - elf_hwcap &= hwcap; - else - elf_hwcap = hwcap; + /* We are done. */ + break; + } + if (node <= 0) { + printf("%s: could not find FDT node for CPU %u, hart %u\n", + __func__, cpu, hart); } } +#endif -SYSINIT(identcpu, SI_SUB_CPU, SI_ORDER_ANY, fill_elf_hwcap, NULL); +static void +identify_cpu_features(u_int cpu, struct cpu_desc *desc) +{ +#ifdef FDT + identify_cpu_features_fdt(cpu, desc); #endif +} + +/* + * Update kernel/user global state based on the feature parsing results, stored + * in desc. + * + * We keep only the subset of values common to all CPUs. + */ +static void +update_global_capabilities(u_int cpu, struct cpu_desc *desc) +{ +#define UPDATE_CAP(t, v) \ + do { \ + if (cpu == 0) { \ + (t) = (v); \ + } else { \ + (t) &= (v); \ + } \ + } while (0) + + /* Update the capabilities exposed to userspace via AT_HWCAP. */ + UPDATE_CAP(elf_hwcap, (u_long)desc->isa_extensions); + +#undef UPDATE_CAP +} static void identify_cpu_ids(struct cpu_desc *desc) @@ -366,22 +401,28 @@ identify_cpu_ids(struct cpu_desc *desc) } void -identify_cpu(void) +identify_cpu(u_int cpu) { - struct cpu_desc *desc = &cpu_desc[PCPU_GET(cpuid)]; + struct cpu_desc *desc = &cpu_desc[cpu]; identify_cpu_ids(desc); + identify_cpu_features(cpu, desc); + + update_global_capabilities(cpu, desc); } void -printcpuinfo(void) +printcpuinfo(u_int cpu) { struct cpu_desc *desc; - u_int cpu, hart; + u_int hart; - cpu = PCPU_GET(cpuid); - hart = PCPU_GET(hart); desc = &cpu_desc[cpu]; + hart = pcpu_find(cpu)->pc_hart; + + /* XXX: check this here so we are guaranteed to have console output. */ + KASSERT(desc->isa_extensions != 0, + ("Empty extension set for CPU %u, did parsing fail?", cpu)); /* Print details for boot CPU or if we want verbose output */ if (cpu == 0 || bootverbose) { diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index d9883e23ce90..cc526b9af9ec 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -131,7 +131,7 @@ cpu_startup(void *dummy) { sbi_print_version(); - printcpuinfo(); + printcpuinfo(0); printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem), ptoa((uintmax_t)realmem) / (1024 * 1024)); @@ -542,7 +542,7 @@ initriscv(struct riscv_bootparams *rvbp) /* * Identify CPU/ISA features. */ - identify_cpu(); + identify_cpu(0); /* Do basic tuning, hz etc */ init_param1(); diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index dffadd628c46..9cb2d558d195 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -250,14 +250,6 @@ init_secondary(uint64_t hart) pcpup->pc_curthread = pcpup->pc_idlethread; schedinit_ap(); - /* - * Identify current CPU. This is necessary to setup - * affinity registers and to provide support for - * runtime chip identification. - */ - identify_cpu(); - printcpuinfo(); - /* Enable software interrupts */ riscv_unmask_ipi(); @@ -286,6 +278,9 @@ init_secondary(uint64_t hart) mtx_unlock_spin(&ap_boot_mtx); + if (bootverbose) + printf("Secondary CPU %u fully online\n", cpuid); + /* Enter the scheduler */ sched_throw(NULL); @@ -497,7 +492,8 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) naps = atomic_load_int(&aps_started); bootstack = (char *)bootstacks[cpuid] + MP_BOOTSTACK_SIZE; - printf("Starting CPU %u (hart %lx)\n", cpuid, hart); + if (bootverbose) + printf("Starting CPU %u (hart %lx)\n", cpuid, hart); atomic_store_32(&__riscv_boot_ap[hart], 1); /* Wait for the AP to switch to its boot stack. */ @@ -515,6 +511,7 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) void cpu_mp_start(void) { + u_int cpu; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); @@ -530,12 +527,29 @@ cpu_mp_start(void) case CPUS_UNKNOWN: break; } + + CPU_FOREACH(cpu) { + /* Already identified. */ + if (cpu == 0) + continue; + + identify_cpu(cpu); + } } /* Introduce rest of cores to the world */ void cpu_mp_announce(void) { + u_int cpu; + + CPU_FOREACH(cpu) { + /* Already announced. */ + if (cpu == 0) + continue; + + printcpuinfo(cpu); + } } void From nobody Mon Jun 12 13:50:21 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 4QftNs3crqz4cGt0; Mon, 12 Jun 2023 13:50:21 +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 4QftNs31smz47Y5; Mon, 12 Jun 2023 13:50:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577821; 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=2xdAsbHCYEwkzUtSs5esgzI6ez5mQpAfrApcFTHHnqY=; b=IPue5zEhL0u5cx2I7bB1GyRqpYvxrXq5xIgGRYPyFDkkrk352MI1hurlrtCF9E5psjEmyQ Bofo0/rMptmrhPdAOTSVLUPuTGX1w/KJDGYiY/nJvJGuuG+j546GRWOwtvHOfdZ68XHJMQ NbEPwGA+OQEOJAiaQePQj+EC1RJQGKr+uk10VtcjsxOO5wen+HmhjF43l1ksy+CSdTx/Oi n3VmYMqqUBEwnYYJc3trq42875R4SMfW0vsJjA1bMKJCH8x/804F6pgBaVYMWeMSLWonkR bDNIldXerVdErQRkaVwQeaeZ97ELydlPp+/TuUo7qYTw9pBocggKtsjGuwLkGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577821; 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=2xdAsbHCYEwkzUtSs5esgzI6ez5mQpAfrApcFTHHnqY=; b=Gm7ZgBFXrPZYlsBHCRgqUxOdSElBy+1X8pFs3GUHg/sm0CT7B71JBlREUbMyZUBv2VqPeq Euoilsg7mugs3FnB6xkG6JYi07Tr0yGl/PHH3gt+OsSwi18sB4lBF6IuZxICdUNDeByiMX z1j3DCjBXV8+uDTqWiPv1qAjam5RLRs6yZ1SOuP82mcC3tjIrWUqyFU+KgA9vWgByPdMTk PeNynkE2nlJvBcMH1Iw+8ylV+Td8M5ehbh8/ZwgT7nnzClKDSjJwOc6ZebDC6XNsUK3GB3 L25wWs3X7DKxL5WxmvsCtKgxIqH8Q4u+Se0LlT/v0QX5pGinlVRZ5GrV/hGEAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577821; a=rsa-sha256; cv=none; b=bANbrpsy697Vsnbwh3fpoLkw5KDBoa37eC12FuudbPVLqRwQJu3P4BTMYt2dN+5dk3hI7o ukaGSeECZ//aQeS6gyrGFkY1zVJL+ECv60CrbESeasW4u+CtpGoozTGEbOMXQjriTK6H7E YGRLWj1K+9IJ0PdT7qHI1VLJAEiRn9S81BjCfcx5QFZMZsiltHhOlU5w4SudFuvsPH4DA0 QVmQpSvwJyIyP9KV4AggNzz9NujwrtSF1k0/4ywKkOgkU+3a27TP1ZKWLwvDzyKlbQJ8ff M/D7vgFwW5kHf+zWR/X6y2rlS3Z5m4fwvtwlc9VKVJ0ISEWnqPEThQK1tQu+OA== 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 4QftNs1dZYzhj9; Mon, 12 Jun 2023 13:50:21 +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 35CDoLpO089365; Mon, 12 Jun 2023 13:50:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoLXA089364; Mon, 12 Jun 2023 13:50:21 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:21 GMT Message-Id: <202306121350.35CDoLXA089364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: db5bd5ba6bfb - stable/13 - riscv: Print ISA extensions 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: db5bd5ba6bfbd3de408efc0daee0d8ed06e84004 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=db5bd5ba6bfbd3de408efc0daee0d8ed06e84004 commit db5bd5ba6bfbd3de408efc0daee0d8ed06e84004 Author: Mitchell Horne AuthorDate: 2023-05-22 23:52:28 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: Print ISA extensions Report the CPU's single-letter ISA extensions in printcpuinfo(). Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39813 (cherry picked from commit 78a3420c20e075ca8c44a4670ab5ca5afe6bbdf5) --- sys/riscv/riscv/identcpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 8ae3ab8478f3..36f7e4a4940a 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -431,5 +431,12 @@ printcpuinfo(u_int cpu) desc->cpu_mvendor_name, desc->cpu_march_name, hart); printf(" marchid=%#lx, mimpid=%#lx\n", marchid, mimpid); + printf(" ISA: %#b\n", desc->isa_extensions, + "\020" + "\01Atomic" + "\03Compressed" + "\04Double" + "\06Float" + "\15Mult/Div"); } } From nobody Mon Jun 12 13:50:22 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 4QftNt4HgRz4cGcx; Mon, 12 Jun 2023 13:50:22 +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 4QftNt3Xzvz47fP; Mon, 12 Jun 2023 13:50:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577822; 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=2aEYWYhEcX89Os3RwPwqb0lUXclFlW1nKmpId7hQfwY=; b=elGqYQZ/p5Obkdb9kOYsSs7n6RFHuPEk3ifsMZg4vCCBiwDYaWzpE6hLaieNDMcYvq2Cc7 IuqS+8DLW3+f/cVy+CmmNMJGy9CkquFi6Z7iuW1RMAnbMGyX4+wBdwWQ6njCpo/XeITIOh UR+CO4fz6eIdhoS+8sPV6vQzrDpylyGWy2ElRTrjWorw6nRqdeSmZSFabCBmBCu9XT+R7+ uYheQSnJ2h+3NTPhkbzDr0FJ3YeMUGNIDSho7fW28NczDy5OhKtT388UxbE9hqjWKJ073H ZQIGB39cG7V+7XQR7cD/fEZUKn/HghBnr83cdt8PgdLpIFKnXuZYFDcXfA0zyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577822; 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=2aEYWYhEcX89Os3RwPwqb0lUXclFlW1nKmpId7hQfwY=; b=bnOSFtRWxEeEeN0l2HETxOQTgo4JUBE528XiwfgH8NKGRrVcD4IZWAaIPkf0addyakJ0kb AEUKwHvzuHpVpPs8rWayYPRTiwJKDDsb4SfVyHwatf/E3RF88e/kcJlgfzoA5GbTBLMX4f +jbVGpCSwyIdhDxiZMy2yl/FJSkxu3F2I7ij+ks9dGfltTvkU67zGS63ChtHTmh2tsv/8/ DSdFsHcQewKoWC8a56oCbMTcHmnktc9UytkHEo4JitodWpbccnfFv6hAbkLIIvDgvatHQz 2CGFW/HEN9m8zvgWFtf9O1+XVwkbPbPMSG1LwFQ0OBw3vN0/SBtQJB8EP/FddQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577822; a=rsa-sha256; cv=none; b=vRW/Fm6kFTSF08rgZCoLyCyQxp2KkINrQt0yPUiXQY20ZV4xD675W36o8Rl7rbSFoaQTmY 7+ek2fAq+Rno2TpB3wOK9XltHdjTOo6EwlRfp+pDVUsr0eD2e+x7j48UCZ/4ybU4WtbVQp yWszonxjP915chvsHMQ6vCE+iXgY2o1Q1IrIgRhp9FXvbubvCiIRQmce5dp5tFfdS1rXYS jqOC67gK2+XOjwVYq9zmrEUXPEVY9N7kwn2Crumq1KjjmMi+wzmdMRSZ2pgwg8u5yhiNIJ WtIOhnfSXz2EOC22J7ZkgAhfZd4txtmswnErepU7mHm19KFeVzxm0yo3h8+s5w== 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 4QftNt2Zgzzhww; Mon, 12 Jun 2023 13:50:22 +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 35CDoMHC089389; Mon, 12 Jun 2023 13:50:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoMFL089388; Mon, 12 Jun 2023 13:50:22 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:22 GMT Message-Id: <202306121350.35CDoMFL089388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c48ea7b4953e - stable/13 - riscv: MMU detection 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c48ea7b4953e574905ef2351f421cb33d41fa9c2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c48ea7b4953e574905ef2351f421cb33d41fa9c2 commit c48ea7b4953e574905ef2351f421cb33d41fa9c2 Author: Mitchell Horne AuthorDate: 2023-05-22 23:53:43 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: MMU detection Detect and report the supported MMU for each CPU. Export the capabilities to the rest of the kernel and use it in pmap_bootstrap() to check for Sv48 support. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39814 (cherry picked from commit 7245ffd10eda4ff604840350943d762f70657983) --- sys/riscv/include/cpu.h | 8 ++++++++ sys/riscv/include/md_var.h | 1 + sys/riscv/riscv/identcpu.c | 30 ++++++++++++++++++++++++++++++ sys/riscv/riscv/pmap.c | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index b7d83aa0f25d..d99142bc3c93 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -83,6 +83,14 @@ /* SiFive marchid values */ #define MARCHID_SIFIVE_U7 MARCHID_COMMERCIAL(7) +/* + * MMU virtual-addressing modes. Support for each level implies the previous, + * so Sv48-enabled systems MUST support Sv39, etc. + */ +#define MMU_SV39 0x1 /* 3-level paging */ +#define MMU_SV48 0x2 /* 4-level paging */ +#define MMU_SV57 0x4 /* 5-level paging */ + extern char btext[]; extern char etext[]; diff --git a/sys/riscv/include/md_var.h b/sys/riscv/include/md_var.h index 890f569782a3..687ab9a3a77e 100644 --- a/sys/riscv/include/md_var.h +++ b/sys/riscv/include/md_var.h @@ -40,6 +40,7 @@ extern u_long elf_hwcap; extern register_t mvendorid; extern register_t marchid; extern register_t mimpid; +extern u_int mmu_caps; struct dumperinfo; struct minidumpstate; diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 36f7e4a4940a..e1a34983abf7 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -65,10 +65,13 @@ register_t mvendorid; /* The CPU's JEDEC vendor ID */ register_t marchid; /* The architecture ID */ register_t mimpid; /* The implementation ID */ +u_int mmu_caps; + struct cpu_desc { const char *cpu_mvendor_name; const char *cpu_march_name; u_int isa_extensions; /* Single-letter extensions. */ + u_int mmu_caps; }; struct cpu_desc cpu_desc[MAXCPU]; @@ -271,6 +274,20 @@ parse_riscv_isa(struct cpu_desc *desc, char *isa, int len) } #ifdef FDT +static void +parse_mmu_fdt(struct cpu_desc *desc, phandle_t node) +{ + char mmu[16]; + + desc->mmu_caps |= MMU_SV39; + if (OF_getprop(node, "mmu-type", mmu, sizeof(mmu)) > 0) { + if (strcmp(mmu, "riscv,sv48") == 0) + desc->mmu_caps |= MMU_SV48; + else if (strcmp(mmu, "riscv,sv57") == 0) + desc->mmu_caps |= MMU_SV48 | MMU_SV57; + } +} + static void identify_cpu_features_fdt(u_int cpu, struct cpu_desc *desc) { @@ -319,6 +336,9 @@ identify_cpu_features_fdt(u_int cpu, struct cpu_desc *desc) if (parse_riscv_isa(desc, isa, len) != 0) return; + /* Check MMU features. */ + parse_mmu_fdt(desc, node); + /* We are done. */ break; } @@ -358,6 +378,11 @@ update_global_capabilities(u_int cpu, struct cpu_desc *desc) /* Update the capabilities exposed to userspace via AT_HWCAP. */ UPDATE_CAP(elf_hwcap, (u_long)desc->isa_extensions); + /* + * MMU capabilities, e.g. Sv48. + */ + UPDATE_CAP(mmu_caps, desc->mmu_caps); + #undef UPDATE_CAP } @@ -431,6 +456,11 @@ printcpuinfo(u_int cpu) desc->cpu_mvendor_name, desc->cpu_march_name, hart); printf(" marchid=%#lx, mimpid=%#lx\n", marchid, mimpid); + printf(" MMU: %#b\n", desc->mmu_caps, + "\020" + "\01Sv39" + "\02Sv48" + "\03Sv57"); printf(" ISA: %#b\n", desc->isa_extensions, "\020" "\01Atomic" diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index a6029f5d642d..19071639def1 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -713,7 +713,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen) mode = 0; TUNABLE_INT_FETCH("vm.pmap.mode", &mode); - if (mode == PMAP_MODE_SV48) { + if (mode == PMAP_MODE_SV48 && (mmu_caps & MMU_SV48) != 0) { /* * Enable SV48 mode: allocate an L0 page and set SV48 mode in * SATP. If the implementation does not provide SV48 mode, From nobody Mon Jun 12 13:50:23 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 4QftNw1tx8z4cGd3; Mon, 12 Jun 2023 13:50: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 4QftNv5FjTz47cS; Mon, 12 Jun 2023 13:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577823; 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=TFQtxsmmNVGc984kezxTct+c5IQKqvjJS+46fEJnVUU=; b=GUFn2kbD1h1cj5EsKm0NeX7cjFRnTpiHeRbx2XQp5bO6NdwCnhatYC2AuTb+pBcc3qAg2F FTTx9HwbgHKZI8wS/Jajmlytn90DxQ37O9fdj5z3C0DY0jIndL575QT8ZePKN0M8ZkP531 sLasXfNsexcna5b0og136bEWIZck72UrUExVu40Q6o7DvJEkRLzqAlPEc+FnfjtJaENMaK nQDvJJ/h5dVmyZdqEFJ7Ppvj1iYBkNapGUbKp1Qajw8+b7tpbE+RqJ4XZ/A/6DqVXDRscY eJ57J0FnCd2MHilrrci92jaya0wmNFF6akmmzEQjxSto0AtxtOQwOIpB7AzMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577823; 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=TFQtxsmmNVGc984kezxTct+c5IQKqvjJS+46fEJnVUU=; b=abwBGcNDO8eBWyGI1EC5znSfK6r3SUBLtKpFn9ONIAxsRS4nApkwmeB+zNfqEnBIIseEnk rH010XXPqcuaCMamvLG9tDA4TN/znhx4EDf563i8BE98knykHs/JZMj7RweXlesla5Wkks zOFlZGxtbob1ni/kEIYRdHZI+RGvP8giZjZO66G5UQpPGHebNVJsCLJFzgn+1UftSv6Uvd 9pKRusPyJ0rfF6f8IHoFQiDdTUqjMR+ojaM0+BKfAVez8VTEONNw+ODw+QhOUDtuEhL49A TNa2oLUJnDM63c1E/FQ7RRaMeqNN/kdocB6+EMEKBD7WMhUy72RNGfQdMqVFmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577823; a=rsa-sha256; cv=none; b=DthCeimXGzXrOf2Mr62If2N5bWv7Nt4hzJH4QkmsxhL8z+nQlvyjp+g8MZ4WLSyg0EFmrR JRgWl0Oy68h7yRvwmSDoF0QUA6U4o0eqPFCAR8n7rAf20f1lBMAIQmgTmQYqz3+pR56v7T vrU22WiSHoE9LPUMMy/DOUv5GGmRdrvdO2cyV+jP1UtZjz/VSxK22tNYfGBej4Genw4icG REJQrDCmqHK5gvH9k2XPc2KaDygUw45rszUzoZPBw7Ew9+dlJ67njXiW3mliic4DmRfeWZ ICDSn2nXsgiS/u5vtV9ec8aSStz0UD0ktIPTJQN7k5iYWe2xEIud+C+0GsScGA== 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 4QftNv3FPlzhjB; Mon, 12 Jun 2023 13:50:23 +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 35CDoNfX089410; Mon, 12 Jun 2023 13:50:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoN1Y089409; Mon, 12 Jun 2023 13:50:23 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:23 GMT Message-Id: <202306121350.35CDoN1Y089409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: ad1ed7742f0e - stable/13 - riscv: Print less CPU info 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ad1ed7742f0e5a5059d5acac2901f74b3df7685e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ad1ed7742f0e5a5059d5acac2901f74b3df7685e commit ad1ed7742f0e5a5059d5acac2901f74b3df7685e Author: Mitchell Horne AuthorDate: 2023-05-22 23:54:36 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: Print less CPU info Change the reporting strategy to more closely follow what arm64 implements: - Always print the one-line CPU summary when a core comes online - Only print the additional fields (e.g. ISA) when they differ from the CPU before it In the common case of identical CPUs this results in informative but non-repetitive output. For example, in QEMU: CPU 0 : Vendor=Unspecified Core=Unknown (Hart 0) marchid=0x80032, mimpid=0x80032 MMU: 0x7 ISA: 0x112d real memory = 8589934592 (8192 MB) avail memory = 8332300288 (7946 MB) FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs CPU 1 : Vendor=Unspecified Core=Unknown (Hart 1) CPU 2 : Vendor=Unspecified Core=Unknown (Hart 2) CPU 3 : Vendor=Unspecified Core=Unknown (Hart 3) Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40024 (cherry picked from commit 940e6d36de1ef010f731e290c9b2b08535fff424) --- sys/riscv/riscv/identcpu.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index e1a34983abf7..dafab6530024 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -449,18 +449,30 @@ printcpuinfo(u_int cpu) KASSERT(desc->isa_extensions != 0, ("Empty extension set for CPU %u, did parsing fail?", cpu)); - /* Print details for boot CPU or if we want verbose output */ - if (cpu == 0 || bootverbose) { - /* Summary line. */ - printf("CPU %-3u: Vendor=%s Core=%s (Hart %u)\n", cpu, - desc->cpu_mvendor_name, desc->cpu_march_name, hart); + /* + * Suppress the output of some fields in the common case of identical + * CPU features. + */ +#define SHOULD_PRINT(_field) \ + (cpu == 0 || desc[0]._field != desc[-1]._field) + /* Always print summary line. */ + printf("CPU %-3u: Vendor=%s Core=%s (Hart %u)\n", cpu, + desc->cpu_mvendor_name, desc->cpu_march_name, hart); + + /* These values are global. */ + if (cpu == 0) printf(" marchid=%#lx, mimpid=%#lx\n", marchid, mimpid); + + if (SHOULD_PRINT(mmu_caps)) { printf(" MMU: %#b\n", desc->mmu_caps, "\020" "\01Sv39" "\02Sv48" "\03Sv57"); + } + + if (SHOULD_PRINT(isa_extensions)) { printf(" ISA: %#b\n", desc->isa_extensions, "\020" "\01Atomic" @@ -469,4 +481,6 @@ printcpuinfo(u_int cpu) "\06Float" "\15Mult/Div"); } + +#undef SHOULD_PRINT } From nobody Mon Jun 12 13:50:24 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 4QftNx0V47z4cGlJ; Mon, 12 Jun 2023 13:50:25 +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 4QftNw5G7Cz47ct; Mon, 12 Jun 2023 13:50:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577824; 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=Bih89TTzTL1Dex8Z8+1+oPVP3uDT7Gl46hGRgJArKww=; b=dHoiNutGImsUJr7vOdysza1+oJ4E3eAGfX0O+hPs3XifnEFoN4GtZPJkq4lNgubuH7yX79 ZwACmzrYeYsl3nqfkLviSVg9QpTEcupqZR/nFKkxCx6/SAfYHJOvr6anwHTgo3UNHnCSRK GSWv23vbxe2YRVj2MZGipjfwUmdm4prFJEksNrlUFPpbKQ2FxRlhgPjtQXRyWVuhz4GfNM zTFrpriFglEKH+Qy1Eoqjbx6TR7f1/LSCAwltmSVY/Z0O7VNQJ7F230VQBFgNhyWHjS5Wl ihtLNsGdUz5x0lwyXCV99GTmvwLUtfSkYQK5nwh6aDGXGthzKC1MSXL+q6M3aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577824; 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=Bih89TTzTL1Dex8Z8+1+oPVP3uDT7Gl46hGRgJArKww=; b=S6s4RMa2nKNdJktG0TNYfKwSOmcWmNpp+G26Axno6mmQNhla1plNy23w3tAE9OyVGFIVsK 4wUvSJDmrTZ+omXY2l7jFPLSQSBKp8zvfiqYDr+Qg37+fYKACM/roU8JbE3aaGt7ZctxHl hVbNllFw2yYMNubs5u6PvNjRL3xcHUJszBcrR7pENsbyGDrfkn1cx3Iqo1hQiwJxYGXV51 ogffNJArN5BHHvjLKIvGhDQoYOZ2Cwpmn+Yszy7tWbaQ5lB9DWoSXwJNDxyvydetVF7rg2 BLuEOQiB4/U78GUbESIPG2K9t5C7yYW8spEiVPHNWrjOKZElkJnZ6PlmnBgnpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577824; a=rsa-sha256; cv=none; b=TZSnYtTA74raNoqFGxbKLzEpJIalpgQCpoQ/TEkpYhxK45+K+4TyWGWbwgVS3uu8BZ8MZb 1AdHgdak2AdrpxYplziXSLVWustiDZpIpSArV9O52RnTB6YDFeECM+PKEHN5bjwaJdyncF VdV/vdcN24QfuSwE0LTBX0+LChhMZmYVQjCHnb//xvLge/esxyRkDf2zI4FQ6+jOl3QScA fuOwE8Fcyo1GUraJpUiIa5kptrA64cHADTqqc9cHulc0MfbzZjWMG/JmVfwDa0R6NNVVl9 USnEjyYeE1CJtW/sPPSCIUVg/pghzc3p+kKeIK4BEH7NSbAAa9Q/ogjGcuewFA== 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 4QftNw4BTNzj2s; Mon, 12 Jun 2023 13:50: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 35CDoOUC089429; Mon, 12 Jun 2023 13:50:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoOFU089428; Mon, 12 Jun 2023 13:50:24 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:24 GMT Message-Id: <202306121350.35CDoOFU089428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 3c236686822b - stable/13 - riscv: S-mode extension parsing 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c236686822bdf60a322e69f2a6ce0249f2eb8dc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3c236686822bdf60a322e69f2a6ce0249f2eb8dc commit 3c236686822bdf60a322e69f2a6ce0249f2eb8dc Author: Mitchell Horne AuthorDate: 2023-05-25 17:07:26 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +0000 riscv: S-mode extension parsing There are now several Supervisor-mode extensions that have entered the 'ratified' status, so begin parsing and reporting a few of these. Recognize the following extensions: - Sstc: stimecmp/vstimecmp CSR - Svnapot: NAPOT* translation contiguity - Svpbmt: page-based memory types - Svinval: fine-grained TLB invalidation instructions - Sscofpmf: performance counter overflow *i.e. "naturally aligned power-of-2" page granularity For now, provide globals for Sstc and Sscofpmf, as we will make use of these in the near future. Plus, update the copyright statement after my recent work on this file. Reviewed by: jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40240 (cherry picked from commit 8bebb786820f634d47522711b8cd56a66db3785d) --- sys/riscv/include/md_var.h | 4 ++++ sys/riscv/riscv/identcpu.c | 53 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/sys/riscv/include/md_var.h b/sys/riscv/include/md_var.h index 687ab9a3a77e..9951c838a2e6 100644 --- a/sys/riscv/include/md_var.h +++ b/sys/riscv/include/md_var.h @@ -42,6 +42,10 @@ extern register_t marchid; extern register_t mimpid; extern u_int mmu_caps; +/* Supervisor-mode extension support */ +extern bool has_sstc; +extern bool has_sscofpmf; + struct dumperinfo; struct minidumpstate; diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index dafab6530024..a9a2542f70b6 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -1,6 +1,10 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2015-2016 Ruslan Bukin * All rights reserved. + * Copyright (c) 2022 Mitchell Horne + * Copyright (c) 2023 The FreeBSD Foundation * * Portions of this software were developed by SRI International and the * University of Cambridge Computer Laboratory under DARPA/AFRL contract @@ -10,6 +14,9 @@ * Computer Laboratory as part of the CTSRD Project, with support from the * UK Higher Education Innovation Fund (HEIF). * + * Portions of this software were developed by Mitchell Horne + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -67,11 +74,21 @@ register_t mimpid; /* The implementation ID */ u_int mmu_caps; +/* Supervisor-mode extension support. */ +bool __read_frequently has_sstc; +bool __read_frequently has_sscofpmf; + struct cpu_desc { const char *cpu_mvendor_name; const char *cpu_march_name; u_int isa_extensions; /* Single-letter extensions. */ u_int mmu_caps; + u_int smode_extensions; +#define SV_SSTC (1 << 0) +#define SV_SVNAPOT (1 << 1) +#define SV_SVPBMT (1 << 2) +#define SV_SVINVAL (1 << 3) +#define SV_SSCOFPMF (1 << 4) }; struct cpu_desc cpu_desc[MAXCPU]; @@ -131,13 +148,29 @@ static const struct { #define ISA_PREFIX_LEN (sizeof(ISA_PREFIX) - 1) static __inline int -parse_ext_s(struct cpu_desc *desc __unused, char *isa, int idx, int len) +parse_ext_s(struct cpu_desc *desc, char *isa, int idx, int len) { +#define CHECK_S_EXT(str, flag) \ + do { \ + if (strncmp(&isa[idx], (str), \ + MIN(strlen(str), len - idx)) == 0) { \ + desc->smode_extensions |= flag; \ + return (idx + strlen(str)); \ + } \ + } while (0) + + /* Check for known/supported extensions. */ + CHECK_S_EXT("sstc", SV_SSTC); + CHECK_S_EXT("svnapot", SV_SVNAPOT); + CHECK_S_EXT("svpbmt", SV_SVPBMT); + CHECK_S_EXT("svinval", SV_SVINVAL); + CHECK_S_EXT("sscofpmf", SV_SSCOFPMF); + +#undef CHECK_S_EXT + /* * Proceed to the next multi-letter extension or the end of the * string. - * - * TODO: parse these once we gain support */ while (isa[idx] != '_' && idx < len) { idx++; @@ -383,6 +416,10 @@ update_global_capabilities(u_int cpu, struct cpu_desc *desc) */ UPDATE_CAP(mmu_caps, desc->mmu_caps); + /* Supervisor-mode extension support. */ + UPDATE_CAP(has_sstc, (desc->smode_extensions & SV_SSTC) != 0); + UPDATE_CAP(has_sscofpmf, (desc->smode_extensions & SV_SSCOFPMF) != 0); + #undef UPDATE_CAP } @@ -482,5 +519,15 @@ printcpuinfo(u_int cpu) "\15Mult/Div"); } + if (SHOULD_PRINT(smode_extensions)) { + printf(" S-mode Extensions: %#b\n", desc->smode_extensions, + "\020" + "\01Sstc" + "\02Svnapot" + "\03Svpbmt" + "\04Svinval" + "\05Sscofpmf"); + } + #undef SHOULD_PRINT } From nobody Mon Jun 12 13:50:25 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 4QftNy0gBPz4cGgL; Mon, 12 Jun 2023 13:50:26 +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 4QftNx73Fjz47dP; Mon, 12 Jun 2023 13:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577826; 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=54H/QY6PTpFGIEqvBjZZ1QyXqeL9G8Hb1Y/v14l2uR0=; b=BwHWB2TPraCScftAWb33LJ2S8cl4QQcMTpfeUyerHcE8+NB7DY54gpWsEqDED3xByRjEJg d0TUs8Oqn7fJC4auIiZVIw+Z/IFhKN/Oh2tGVrDxV2kGg8aGXfROwXigB9iPZ8IZrxe7CY iOxZdowl6uwzmWGkmafaQdUs6NfajovBIbp2UnrFKG/b5cMFNCLQx8arAeo0SIHLdAN9wx j3f7I4Op5RDid7aUDM/9HgOJFJ4O467afkch/wfOAr6OsQ3cYLnx5NiHn1/R1hYJY4zjRY o49qbZKSvbhG69zZnNmR2YXRGTcxMUcFk8q+xHknNUT52EWk3rtfES/lJA3fhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577826; 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=54H/QY6PTpFGIEqvBjZZ1QyXqeL9G8Hb1Y/v14l2uR0=; b=KjGYIHQ+7+pEhPSeAkLvAmXt6BhlFQlvGOF0arf1uVHJUhaQin0HngI56/x9DPbDIcZ5ON dtSN6em6Uqmr5R0Zyn8qY166kO2t4I5hDW306bPSNuGgNL/skgfA4yAX+3LgFaCCiYEQ/h Sd/fvl6TlOE0WVjTSMLWHhXHRhxWTqQ8txng4Hktn2I3CrRuAYLFasnRn8dfI9x68JVENt iyx3Q/Y8bD3vjJ5eiZXA/0CnEPwpMXVlskJTs/9b9Id6V+XcWLcFvioiZmYCEfGib00fI0 NBLKrjjSx1eIsoasBZP/O35QVoUPfnesPb96FdENXHckTB60R9xcn5NG9dxSgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577826; a=rsa-sha256; cv=none; b=UZIhWCFtucjpvA4MmPCzV5OqOwbnT+POL9VdV5FFOxEBomQIHjhdIAFHDtvseYQl8xc+La 7khiQOmF1neeRI+LJ/UANW3VcsE2Afr7bOpVwcfoCaOMvHE7PFjIxvvJb9jBNYwdc9C387 d/2CmtmnyKJsclWkQ0t+vfKKZ0TpFCGzq/DybjZbuEiaggC3Tir8oVrT5oxw2lwKcrMGTB Xay/I4pOHm8eqwJqhdVyNvX/vrb7PbFOO6MS35FTiC+CTeCzBT8v3ewTXG1xaH819zda+3 SMTIiQs6MQt6ad3GNCdrI3xBZ58iemTsqtk2yRBVkPZSK3sTVak1GKqX3qdTdg== 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 4QftNx5L2yzj2t; Mon, 12 Jun 2023 13:50:25 +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 35CDoPqu089448; Mon, 12 Jun 2023 13:50:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoPhk089447; Mon, 12 Jun 2023 13:50:25 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:25 GMT Message-Id: <202306121350.35CDoPhk089447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 9834e0f2767a - stable/13 - riscv timer: use stimecmp CSR when available 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9834e0f2767a27d237e6820ecd67b24e65323ece Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9834e0f2767a27d237e6820ecd67b24e65323ece commit 9834e0f2767a27d237e6820ecd67b24e65323ece Author: Mitchell Horne AuthorDate: 2023-05-25 17:07:49 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:55 +0000 riscv timer: use stimecmp CSR when available The Sstc extension defines a new stimecmp CSR, allowing supervisor software to set the timer, rather than just read it. When supported, using this avoids the frequent trips through the SBI every time the CPU's timer expires. Reviewed by: jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40241 (cherry picked from commit cadaabcc720bb20d6d604c4792acb29072d2882d) --- sys/riscv/riscv/timer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index 9c333b42059e..1df8fb246309 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -84,6 +85,16 @@ get_timecount(void) return (rdtime()); } +static inline void +set_timecmp(uint64_t timecmp) +{ + + if (has_sstc) + csr_write(stimecmp, timecmp); + else + sbi_set_timer(timecmp); +} + static u_int riscv_timer_tc_get_timecount(struct timecounter *tc __unused) { @@ -107,7 +118,7 @@ riscv_timer_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period) if (first != 0) { counts = ((uint32_t)et->et_frequency * first) >> 32; - sbi_set_timer(get_timecount() + counts); + set_timecmp(get_timecount() + counts); csr_set(sie, SIE_STIE); return (0); From nobody Tue Jun 13 21:29:23 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 4QghX36DL0z4cb7G; Tue, 13 Jun 2023 21:29:23 +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 4QghX35Ghcz421x; Tue, 13 Jun 2023 21:29:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686691763; 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=moRFRcD3+WMqA7PEKREHO7zf9D/rU+DFm+E5oPpqmpg=; b=VTcTnWcEAousyVC0C8L8dOTkPQmNTOksdCunhM0Q6eS0Cyhq4vzOhd4N8QqgJd5drJy/qM bWrh1IcDEM2C+rPlObs8gamA2M16FJlMdMMCuwNY1EW424ax4OnM5XM/24JeU3yR2hws4t NWV4UUNMXAlf3cXNoaQQiRq2MjbFJHNhbi9suEDi+WpqeYoAmTUuB/1k9YsR3PJ3F7g5VI piKbG7XBiYL6am2z8JL8scTdo182sWGigIONy/xRScy6nquQAcbZvDDjbnKOim1Jn+6alB uDhPoU/5L0ATtV4ppTTKTAIQpE8nCW6DTWHUIyFBwsdpUqXdkIJUgfnWxK5asg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686691763; 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=moRFRcD3+WMqA7PEKREHO7zf9D/rU+DFm+E5oPpqmpg=; b=XJi1XJmHrEzrBUm17baljJ1dQnR4PK3/FU2UkIcaPIq1ITe1RQTLXWGQNwCT1krZdchZ91 JeZcqfFimSKq3z80ZWNh+stk77zrUa/WuN0XZ7wU3I+RmWDAQ2OYuKliYKURgGhiLSKSqk dlPyw/hEiZC6+mdYy9LWnSq9veHmVDehEHfoooLpItmdGgaxSvi8N9V5ozRtTrYu7MiBax W63YGotcwK4TgC2MIl+Oo7fDOnjX6PeTNN07ATk8wCwN9tN8JoGoAaaheKcASiapK9Vv6j DW+/Z8hXXYWZ2Wc9CLFJAyNTq5zkWjSle8B4dCg4YxiUuRgLi7fLPC7AVMXxzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686691763; a=rsa-sha256; cv=none; b=N8SsM11z1p9MLy0fVkmrLqlMZgOuinoE07cpmcvmX7Mhc3Vfa4TJkzA2H2cKbeninwbQAn /OOV/9nTUzChNgOwrTMfQsKxu9q1C4rJNcDN+ooUAvqNx88HpvJyf/JoF3MCn1nOZ1TENy kLYmh28VAKMM3LIqiCpfocTIreNaL+joi6ly8g9UuxUCrWd00REFNp58GF2f5Z7FiiowAA 8Eeqr/hE14/cSuuQgvimdZ8KBid+JLB4JYKhddo4UWFb1joeNuWL7M6vX3N7zIulGAe8Gf 1nObspy3ep/c3EREvmp2zQmIh4U107qbg7kutvtyyGRmJMd0jncrPxYiLQOknA== 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 4QghX32wvpzdVT; Tue, 13 Jun 2023 21:29:23 +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 35DLTNaO018620; Tue, 13 Jun 2023 21:29:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35DLTNuw018619; Tue, 13 Jun 2023 21:29:23 GMT (envelope-from git) Date: Tue, 13 Jun 2023 21:29:23 GMT Message-Id: <202306132129.35DLTNuw018619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: f122e552354e - stable/13 - Allow a comma-separated list in login class capabilities, by adding a version of strcspn that allows quoting. 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f122e552354e84f18b82d11e40c6f8f214ed8abc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f122e552354e84f18b82d11e40c6f8f214ed8abc commit f122e552354e84f18b82d11e40c6f8f214ed8abc Author: Sean Eric Fagan AuthorDate: 2023-01-14 18:37:31 +0000 Commit: Ed Maste CommitDate: 2023-06-13 21:28:54 +0000 Allow a comma-separated list in login class capabilities, by adding a version of strcspn that allows quoting. PR: 236204 Differential Revision: https://reviews.freebsd.org/D25368 (cherry picked from commit f32db406504ece1b28f43dc816736e081fe22826) --- lib/libutil/login_cap.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/lib/libutil/login_cap.c b/lib/libutil/login_cap.c index cea7630698af..ffefb865ed5e 100644 --- a/lib/libutil/login_cap.c +++ b/lib/libutil/login_cap.c @@ -94,6 +94,101 @@ allocarray(size_t sz) } +/* + * This is a variant of strcspn, which checks for quoted + * strings. That is,: + * strcspn_quote("how 'now, brown' cow", ",", NULL); + * will return the index for the nul, rather than the comma, because + * the string is quoted. It does not handle escaped characters + * at this time. + */ +static size_t +strcspn_quote(const char *str, const char *exclude, int *is_quoted) +{ + size_t indx = 0; + char quote = 0; + + if (str == NULL) + return 0; + + if (is_quoted) + *is_quoted = 0; + + for (indx = 0; str[indx] != 0; indx++) { + if (quote && str[indx] == quote) { + if (is_quoted) + *is_quoted = 1; + quote = 0; + continue; + } + if (quote == 0 && + (str[indx] == '\'' || str[indx] == '"')) { + quote = str[indx]; + continue; + } + if (quote == 0 && + strchr(exclude, str[indx]) != NULL) + return indx; + } + return indx; +} + +/* + * Remove quotes from the given string. + * It's a very simplistic approach: the first + * single or double quote it finds, it looks for + * the next one, and if it finds it, moves the + * entire string backwards in two chunks + * (first quote + 1 to first quote, length + * rest of string, and then second quote + 1 + * to second quote, length rest of the string). + */ +static void +remove_quotes(char *str) +{ + static const char *quote_chars = "'\""; + char qc = 0; + int found = 0; + + do { + char *loc = NULL; + + found = 0; + /* + * If qc is 0, then we haven't found + * a quote yet, so do a strcspn search. + */ + if (qc == 0) { + size_t indx; + indx = strcspn(str, quote_chars); + if (str[indx] == '\0') + return; /* We're done */ + loc = str + indx; + qc = str[indx]; + } else { + /* + * We've found a quote character, + * so use strchr to find the next one. + */ + loc = strchr(str, qc); + if (loc == NULL) + return; + qc = 0; + } + if (loc) { + /* + * This gives us the location of the + * quoted character. We need to move + * the entire string down, from loc+1 + * to loc. + */ + size_t len = strlen(loc + 1) + 1; + memmove(loc, loc + 1, len); + found = 1; + } + } while (found != 0); +} + /* * arrayize() * Turn a simple string separated by any of @@ -112,7 +207,7 @@ arrayize(const char *str, const char *chars, int *size) /* count the sub-strings */ for (i = 0, cptr = str; *cptr; i++) { - int count = strcspn(cptr, chars); + int count = strcspn_quote(cptr, chars, NULL); cptr += count; if (*cptr) ++cptr; @@ -126,11 +221,21 @@ arrayize(const char *str, const char *chars, int *size) /* now split the string */ i = 0; while (*ptr) { - int count = strcspn(ptr, chars); + int quoted = 0; + int count = strcspn_quote(ptr, chars, "ed); + char *base = ptr; res[i++] = ptr; ptr += count; if (*ptr) *ptr++ = '\0'; + /* + * If the string contains a quoted element, we + * need to remove the quotes. + */ + if (quoted) { + remove_quotes(base); + } + } res[i] = NULL; } From nobody Wed Jun 14 12:41:30 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 4Qh4mW23vSz4dXNx; Wed, 14 Jun 2023 12:41:31 +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 4Qh4mW1SGLz3ndd; Wed, 14 Jun 2023 12:41:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686746491; 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=xZBO8OzCeULhrRzMQLyp4c3vQzQR6bJ6Sdpf34cOJlU=; b=gHujkhGGmRHz4nSE2saLLycHmNBsS2JwzNsSXoGyXuX1u/qBpT+DARnwFyXWEnAXZyzP80 xU8H7zvnR+2mxkYt2vnKJnpPZK5cKjOiLplNHXgmf31S7kY65l6j+Ov01Lzpk9oAvFBiJ1 Cd+VagVnPB8t0chKVC6LorzHMyf3ex1+/Dd6Bq3a0EuEUOAIHVpA80+dwNjdtOhEIIr+Cb dwocLlVVIJee1kQunDjjduPWe7dWWxRbHBjivNGow4K2neqyQ/b9vy63KjMt0oHuaMCHtO tDzfaZndjzoQc++VYRC4wv+vC87IP9Mfustg2036f+yXdYARKRl5TzhUfPLvmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686746491; 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=xZBO8OzCeULhrRzMQLyp4c3vQzQR6bJ6Sdpf34cOJlU=; b=qcTjzXbYfQ4DeK4HBi5eunT8Ymz0ELpyXp6jHbccse9IcavFs6B0y+/N1BSv2Nzb7WVOPD AfrhCy1/KFw+mhXJeSNBncP40LKk9a6XrIMkm21pC4vR7mn8XDaWURXGnKosf9xDp7z9CV haZFGeCsG340uEFdaDCdNZeigMDHVPQAh73S1vzuzkOcwt/x0CDfP7G6JdJJMyG2N6RLXH ZihmPcNNnMcseoaXoRnFwJ31HuseNzSoh0zj8AJ5NwoN3oDyqvjWawVtOTpmtVG5/h0MhW CgoLdDGJ3a0WH9FtCDQTlR95bzk7lZeEZe43jkSWn5kbj0XJsmIOm0rP+Fp3KA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686746491; a=rsa-sha256; cv=none; b=wcHLUkdV9lMgTsvwPlOakOxw+tem7S4YNYo0JO9D+YsoruEG31teWk3T35YJoAwN3mH8xZ kxCejMZa3COeurPSaiC3huKWL82n3DqEs+nuD79L9OlGTybA80pvChchBXUw/1HMdHwWYz ZE0ilCNaC1yPDTy+PslDaQ+nbuhPYGJIv85Mp+Q5I+JZ4e3l2IgHRqPMSKQun1xZFwqaR1 Xf+R50qyKU+RfReMM/Icv4MLb8x3zcbVKtb82jkP/dZa8eTRcWladOvZ7UT0sU4uT1qfBZ TIttFLJs7YSz9wkhnzSpSyze+Z47n8b4/yIVE9JSJzk/ObxCXNKLgOLOBK5ZiQ== 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 4Qh4mW0Vv2z13qX; Wed, 14 Jun 2023 12:41:31 +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 35ECfUdi026290; Wed, 14 Jun 2023 12:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35ECfUjj026289; Wed, 14 Jun 2023 12:41:30 GMT (envelope-from git) Date: Wed, 14 Jun 2023 12:41:30 GMT Message-Id: <202306141241.35ECfUjj026289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 9feaa109e4ae - stable/13 - local-unbound-setup: Disable the libc subscriber. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9feaa109e4ae28903ca9247ed6cbf721bc580150 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=9feaa109e4ae28903ca9247ed6cbf721bc580150 commit 9feaa109e4ae28903ca9247ed6cbf721bc580150 Author: Dag-Erling Smørgrav AuthorDate: 2023-03-24 20:45:24 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-14 12:40:39 +0000 local-unbound-setup: Disable the libc subscriber. This is the correct way to prevent resolvconf from updating resolv.conf. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D39262 (cherry picked from commit 9b20ab1e1ef7d3de672ec20a62f26a605db8d3d0) --- usr.sbin/unbound/setup/local-unbound-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/unbound/setup/local-unbound-setup.sh b/usr.sbin/unbound/setup/local-unbound-setup.sh index dc0768a672a6..f725b566b650 100755 --- a/usr.sbin/unbound/setup/local-unbound-setup.sh +++ b/usr.sbin/unbound/setup/local-unbound-setup.sh @@ -195,7 +195,7 @@ do_not_edit() { gen_resolvconf_conf() { local style="$1" do_not_edit - echo "resolv_conf=\"/dev/null\" # prevent updating ${resolv_conf}" + echo "libc=\"NO\"" if [ "${style}" = "dynamic" ] ; then echo "unbound_conf=\"${forward_conf}\"" echo "unbound_pid=\"${pidfile}\"" From nobody Wed Jun 14 13:26:28 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 4Qh5mP35CCz4dhXg; Wed, 14 Jun 2023 13:26:29 +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 4Qh5mP2DkSz3tF9; Wed, 14 Jun 2023 13:26:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749189; 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=1pPl4Cu3rE+7GUrvxAUmHeYmpYiYKmhXJqo9rL6VsM0=; b=X0J9lmSSU1fRrjgxetieHLM2I4R17JFyL1E8HaAVw3BGOYC0ncuLPMMUrZakg8jriefJ/6 jpakKMWxnGZ/1IgEKs3pdhqct26ijSy7cnZJXN1ubEtwJqcKCQqwICQeoZPhThDqGcutlF CNdxcDaevcpJRZ6OsbEZh/L4yiG2pBW1CHYb4rtNtSfjZ428AWKVFY1IAZwjbtvL7zIe6T DN5Hl3QvpdbemTwfYDkllzqnCuTXKfKsacBMxjkKoEW3KBk1QJa3ks2XfX7MPf178Oi8X3 bRM4Za4FL4bOPhGDBm0zC7XgtIiymj9lCHiDbusQnedVHaLzIHnnqVZdnf2mvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749189; 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=1pPl4Cu3rE+7GUrvxAUmHeYmpYiYKmhXJqo9rL6VsM0=; b=DULTszDUVwmwm/4/+UiVDqOADKdR7loD5KRlD2Aa/iFnn+94c3bjz8TyrumGvXsQg6RfpI O//dUJ61z+Es/JnFI6T73cIcsXD1ngnEB+2z5qek/0rlNTry52Cf+NVQ/7LsimCYKUJhcR lj255ak60zIjptva0LsgF4Py1MA0ekktzylOXBrpTmNOKt17l/oaoxW3eeWue9P0ZXFtnW TUAdcEKmAg+DoU4JG5CIvcbDQhNR8N8MXwWyBYgydD9WfuFbGGVmNbf9ujJGv8P7ky40wM uANS/BG7YL4p7+cf1/Sm7TLh07UaIWLnAWjgQgeihvKcE166aD8A0CSKqUCuBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686749189; a=rsa-sha256; cv=none; b=I2IL4sJE8bq41Qq7ovikN6tdF7fGWYmQtP0FBxCwu3/gOk50MZuXk0F62w2hEwcOvhV5oF oQsLB7a5fJS+wzjDGUmwazytzmZpYQaVAZ0FA22e2P1fbS03111LinrtSNJ0SYqFwd5acw YQHXEubu47HMtaJ2gF9m3PwMvwWxJ9sQPLw7VThPXtVPsGYUqrMJbtO9BJPOyISskBnH08 Jv5n53uHEB30rPEkPBqiGMXbK806f3HQ7uDvhlwr37MjTj/KBWKqEVhPwsyKB9t7aEzaqq 9LUGKVgA7bpdBbhrc+qIX3tyqti9Y4rOXLryfYuHdmXhsGwL1fyBwNj0MNCjFw== 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 4Qh5mP16MXz1568; Wed, 14 Jun 2023 13:26:29 +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 35EDQSgE099445; Wed, 14 Jun 2023 13:26:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EDQS7O099444; Wed, 14 Jun 2023 13:26:28 GMT (envelope-from git) Date: Wed, 14 Jun 2023 13:26:28 GMT Message-Id: <202306141326.35EDQS7O099444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: cfb53f983f14 - stable/13 - ncal: Error out if writing to stdout failed. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cfb53f983f147a9c8388154a256c8b47be470f1b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=cfb53f983f147a9c8388154a256c8b47be470f1b commit cfb53f983f147a9c8388154a256c8b47be470f1b Author: Dag-Erling Smørgrav AuthorDate: 2023-05-04 17:26:54 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-14 12:42:28 +0000 ncal: Error out if writing to stdout failed. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans, imp Differential Revision: https://reviews.freebsd.org/D39958 (cherry picked from commit 5903d9c00b75f17f09404d1001ee5aaae7603a61) --- usr.bin/ncal/ncal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c index 641c59f71e10..35266c225bce 100644 --- a/usr.bin/ncal/ncal.c +++ b/usr.bin/ncal/ncal.c @@ -497,6 +497,8 @@ main(int argc, char *argv[]) monthrangeb(y, m, flag_julian_day, before, after); else monthranger(y, m, flag_julian_day, before, after); + if (ferror(stdout) != 0 || fflush(stdout) != 0) + err(1, "stdout"); return (0); } From nobody Wed Jun 14 13:26:30 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 4Qh5mQ3XmKz4dhZV; Wed, 14 Jun 2023 13:26:30 +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 4Qh5mQ2nDWz3tH2; Wed, 14 Jun 2023 13:26:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749190; 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=8NjkV6yaQbjQ8U6RopOxxicF/RkF5o3Qud9PAy7KHHU=; b=gh1+nnY8Xm5YLSh+4iNNbg8sDeKxA1KLvQlQc4Mmb7TM0Qabxbf7Pvzp8OPIRsGeMEDAeM kpPVYeNYXxi3Yz1GkgNlz+zUn5CkXfPsN5ktHbr0PVt7P7P7qlcdTVE53RMVn3noPTyqJh ABhKT/9MDcEaIVJbUMrMxcriEpjyqUt5kehx9UYTQj19QPGf3fiH1DSdde8WPKLEdf7XFo uFZnUmoq88AOPkAnqnXEmyvXx4NR6L8UpYO/TXv9uDYHwp7UOTfD2alnNTJ9KcXrNDxY9C MzZrt6DaJQ1C4oSjDNlSI/ieFEjY942nBBT26aQgRjrvg4zEDH56KgMobWaJZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749190; 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=8NjkV6yaQbjQ8U6RopOxxicF/RkF5o3Qud9PAy7KHHU=; b=L5R6yqWDjIWFq9KdMf8cbACXVyYFf6tZndaCmPL239fE0+YRnppBLt9JRyGY/5aHF8WrhQ cdpaCR1iHkzJ7Nb1tZhWjSqvxS4Qi0lv62eRU/Z6vG7+LMFF1qqSvEvmeQCWOjx7KgX5bD L7tOV/PsbnhdoNC3GrZvOekGA85IwgYvJBgpbrZQ5jnrguueXvF8L7UTVxGiR8wFsbyzWj LcgTkAYejS0knazlKVm47u9GHK6M3TKBbURc16MliPZunI74HzFNqVVc/MAmMSFjMePlKD S4CTkSV+3foEgN54vVbLFBr2Tx65oaNpjkxN7GtVVDKSioV1wKPXgCq49ru5nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686749190; a=rsa-sha256; cv=none; b=kDUKioak41fgyKN8t1fg+3LYmiffYYExpDXlun/E4i1yjHOTv/3jOR9JYlaDACuUKURPoI di/+z+4UgPkOucF8LCa1Sr1d8fi/+q3eaDNGRw1tBhS9S16PC9tYWSuhYR+5Z6JkiCPWyl R5w1ZTQLN0+rAF4Xpjpe1i+QdBJuBP68bx8/9SdONJHScvTtU6ByYdh2299jhd9yk/ZucV BP/+N4OBwmkd8A89cxbMzg7oGc8YYgWS6wWtYe0OYcU7OQmc0Ghp+HQLRprH76AwG3KRcP yJoyN2m7ukdSRrv0evEWnwtH+2ERcVDqNjFElLBwEEw3J8bB7vHDIg2nLjeNEw== 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 4Qh5mQ10tDz1569; Wed, 14 Jun 2023 13:26:30 +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 35EDQUq6099477; Wed, 14 Jun 2023 13:26:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EDQUN7099476; Wed, 14 Jun 2023 13:26:30 GMT (envelope-from git) Date: Wed, 14 Jun 2023 13:26:30 GMT Message-Id: <202306141326.35EDQUN7099476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: cfa209265a30 - stable/13 - tsort: Error out if writing to stdout failed. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cfa209265a30952ffc5c58d7d63439a6f61d3f49 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=cfa209265a30952ffc5c58d7d63439a6f61d3f49 commit cfa209265a30952ffc5c58d7d63439a6f61d3f49 Author: Dag-Erling Smørgrav AuthorDate: 2023-05-04 17:26:59 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-14 12:48:52 +0000 tsort: Error out if writing to stdout failed. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans, imp Differential Revision: https://reviews.freebsd.org/D39959 (cherry picked from commit cb46f47c7969b619d1b2547d06a75ad5b375eda9) tsort: Replace bcopy() with memcpy(). Also fix an indentation error I introduced in the previous commit. Fixes: cb46f47c7969 MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D40042 (cherry picked from commit b55bc49e8694d9226a82041ff23ad61a5c7a6a76) tsort: Add unit tests. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D40043 (cherry picked from commit 09aee570980b7eca6e3c902a66f6db129b8c7376) --- etc/mtree/BSD.tests.dist | 2 ++ usr.bin/tsort/Makefile | 5 +++ usr.bin/tsort/tests/Makefile | 6 ++++ usr.bin/tsort/tests/tsort_test.sh | 66 +++++++++++++++++++++++++++++++++++++++ usr.bin/tsort/tsort.c | 6 ++-- 5 files changed, 83 insertions(+), 2 deletions(-) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 1b2c94f42a6b..eb62812bfcd8 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -1096,6 +1096,8 @@ .. truncate .. + tsort + .. units .. uudecode diff --git a/usr.bin/tsort/Makefile b/usr.bin/tsort/Makefile index b0d353e4d8f7..c0933dac2de1 100644 --- a/usr.bin/tsort/Makefile +++ b/usr.bin/tsort/Makefile @@ -1,6 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 6/9/93 # $FreeBSD$ +.include + PROG= tsort +HAS_TESTS= +SUBDIR.${MK_TESTS}= tests + .include diff --git a/usr.bin/tsort/tests/Makefile b/usr.bin/tsort/tests/Makefile new file mode 100644 index 000000000000..ab16c2842dd0 --- /dev/null +++ b/usr.bin/tsort/tests/Makefile @@ -0,0 +1,6 @@ +PACKAGE= tests + +ATF_TESTS_SH= tsort_test +BINDIR= ${TESTSDIR} + +.include diff --git a/usr.bin/tsort/tests/tsort_test.sh b/usr.bin/tsort/tests/tsort_test.sh new file mode 100755 index 000000000000..88d4efaf2b9f --- /dev/null +++ b/usr.bin/tsort/tests/tsort_test.sh @@ -0,0 +1,66 @@ +# +# Copyright (c) 2023 Klara, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause +# + +atf_test_case basic +basic_head() +{ + atf_set "descr" "Sort a basic graph" +} +basic_body() +{ + cat >input <output <input <output<get)(db, &key, &data, 0)) { case 0: - bcopy(data.data, &n, sizeof(n)); + memcpy(&n, data.data, sizeof(n)); return (n); case 1: break; @@ -266,7 +268,7 @@ get_node(char *name) n->n_arcs = NULL; n->n_refcnt = 0; n->n_flags = 0; - bcopy(name, n->n_name, key.size); + memcpy(n->n_name, name, key.size); /* Add to linked list. */ if ((n->n_next = graph) != NULL) From nobody Wed Jun 14 13:26:31 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 4Qh5mR3VBpz4dhcS; Wed, 14 Jun 2023 13:26:31 +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 4Qh5mR3202z3tfM; Wed, 14 Jun 2023 13:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749191; 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=1sPleCOo3zIcFyCPrYnEDkWkr+WXqcU5TE0QSAI818M=; b=i1s33D3oYoiIIBTSdtgnLvFSYHhSwRwM8JG0h+Y63g5Tdi7L2B7I7ygTDDG3pONSpwh8ZG oSlc7NJRvajjbEx9GSVbNajqI2hfQFlJQjNNKwS59N9l4gLVd7MxZQDtLHAGyv+4lTllQD ZYUuJW1Jm0dK/Ln3kUGLx/3TJfT3QDX5hUR9nTp9pQ3ePXu4FokzBLmndsrINjMNwtvZ61 Sp7htlathg8cS1hiqi7t0+j7QZ0DfeoadvdPhdEXa9fqOq88xBdAb43A0IPtEq7/Y039oD byUaZwhAOkIicGV30wnQNey9FQrvDXME0ElQFGAVUOAFFkLD6FlsPLGuXyKcwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749191; 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=1sPleCOo3zIcFyCPrYnEDkWkr+WXqcU5TE0QSAI818M=; b=pGVbcmIbditsM1KXnnTG3ad09PLcMfgoc0kPUkW/hCMiLlMyaQCpGHDeLWB1POstS3PcBC SaRVNGSHBhJvvZtvDtUj+ouaEh+NgunpgivizqrJKW1klyt/rdYJ0sCKWiK/WVDUrnnzxg KqBQcoNHtyHenw3UDW14Th6tFElp18j9aZx48ERS7MKRrMc/tOWkT5pPRAvXsaXfWeTXBS bLvUS/TEy/XnM/6kiT+mpZj3UkFcH63WOPp5DihGOvy8S3LXvm+v8tbpv/rLk2y8Rpw+72 uX3iFGE4iHMmn72MQbDpV8mrlAu+yZ04/6gM3yfaCaSuD2eByT3OmWGnTkuctA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686749191; a=rsa-sha256; cv=none; b=TLOq/yuAhjT7aCUld0bEPSm2GroR7KmG8zVeUkhWxLrk5PqpvJmgJ6vJelqwYQjqFwZqEX Tbq/DR3N6iPXdOvYNyjmYW3VzyvxGPJ+J1ji4gR8AMy3xRVRSek2Ef9GnR2GH5EpEsfDSM c77o+iEQXVDKH2yFvRw12aFv1299Y49d/ZDZQJzZ/vd/Pzyu2F8VWt8oyK6MZ8eUM6dgj2 LOq1a/K1keEMDZj6zOo88bd1Y3m2FUDNHTNQwYJCCbxXgIhtyE8tbkn+Ii1JzrxWRC5quv oJIdlLlkm2NwGJ8kbb2xfWrUGHuycpmd5XqH5oZdMxAjGa1Gb2ukLjbsx/IbRA== 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 4Qh5mR1zjzz154Y; Wed, 14 Jun 2023 13:26:31 +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 35EDQV30099501; Wed, 14 Jun 2023 13:26:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EDQVwa099500; Wed, 14 Jun 2023 13:26:31 GMT (envelope-from git) Date: Wed, 14 Jun 2023 13:26:31 GMT Message-Id: <202306141326.35EDQVwa099500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 06520254ed83 - stable/13 - ctags: Support writing to stdout instead of a file. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 06520254ed83c12fe176e719ef130be6c924bb6b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=06520254ed83c12fe176e719ef130be6c924bb6b commit 06520254ed83c12fe176e719ef130be6c924bb6b Author: Dag-Erling Smørgrav AuthorDate: 2023-05-25 11:55:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-14 12:48:54 +0000 ctags: Support writing to stdout instead of a file. * Understand "-" to mean stdout as per convention. * Check that the output is a regular file and ignore -u if not, otherwise we might try to rm /dev/stdout. * As a bonus, if -u was specified but the output file does not exist, proceed as if -u had not been specified instead of erroring out. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: cracauer, debdrup Differential Revision: https://reviews.freebsd.org/D40237 (cherry picked from commit 430d064ba5b0cb2e91a26af34c15df48d290e417) ctags: Recognize __attribute__ in function declarations. MFC after: 1 week Obtained from: NetBSD Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40264 (cherry picked from commit 9f35eb8f96a55aac92fc0c7d08f4b6ab0ae9bc39) ctags: Don't undercount lines when handling // comments. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40374 (cherry picked from commit 7ba6119e22b54c2104b1948f0e8a4157d4112958) --- usr.bin/ctags/C.c | 35 +++++++++++++++++++++++++++++++++-- usr.bin/ctags/ctags.1 | 16 +++++++++++++--- usr.bin/ctags/ctags.c | 23 +++++++++++++++++++++-- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/usr.bin/ctags/C.c b/usr.bin/ctags/C.c index aca50c67226b..e36b60de4a55 100644 --- a/usr.bin/ctags/C.c +++ b/usr.bin/ctags/C.c @@ -39,6 +39,7 @@ static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94"; __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -261,6 +262,9 @@ func_entry(void) { int c; /* current character */ int level = 0; /* for matching '()' */ + static char attribute[] = "__attribute__"; + char maybe_attribute[sizeof attribute + 1], + *anext; /* * Find the end of the assumed function declaration. @@ -298,10 +302,37 @@ fnd: * is a token character if it's a function and a non-token * character if it's a declaration. Comments don't count... */ - for (;;) { + for (anext = maybe_attribute;;) { while (GETC(!=, EOF) && iswhite(c)) if (c == '\n') SETLINE; + if (c == EOF) + return NO; + /* + * Recognize the gnu __attribute__ extension, which would + * otherwise make the heuristic test DTWT + */ + if (anext == maybe_attribute) { + if (intoken(c)) { + *anext++ = c; + continue; + } + } else { + if (intoken(c)) { + if (anext - maybe_attribute + < (ptrdiff_t)(sizeof attribute - 1)) + *anext++ = c; + else break; + continue; + } else { + *anext++ = '\0'; + if (strcmp(maybe_attribute, attribute) == 0) { + (void)ungetc(c, inf); + return NO; + } + break; + } + } if (intoken(c) || c == '{') break; if (c == '/' && (GETC(==, '*') || c == '/')) @@ -452,9 +483,9 @@ skip_comment(int t) /* t is comment character */ return; break; case '\n': + SETLINE; if (t == '/') return; - SETLINE; /*FALLTHROUGH*/ default: star = NO; diff --git a/usr.bin/ctags/ctags.1 b/usr.bin/ctags/ctags.1 index 9b68f669202e..40c502b3ecdd 100644 --- a/usr.bin/ctags/ctags.1 +++ b/usr.bin/ctags/ctags.1 @@ -28,7 +28,7 @@ .\" @(#)ctags.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd May 23, 2023 .Dt CTAGS 1 .Os .Sh NAME @@ -93,16 +93,26 @@ Place the tag descriptions in a file called .Ar tagsfile . The default behaviour is to place them in a file called .Pa tags . +If +.Ar tagsfile +is +.Dq - , +the tags will be written to standard output instead. .It Fl u Update the specified files in the .Pa tags file, that is, all references to them are deleted, and the new values are appended to the file. -(Beware: this option is implemented in a way which is rather +This is ignored if the tags file does not exist or is not a regular +file (e.g. +.Fl f Ns - +was used to write to standard output). +.Pp +Beware: this option is implemented in a way which is rather slow; it is usually faster to simply rebuild the .Pa tags -file.) +file. .It Fl v An index of the form expected by .Xr vgrind 1 diff --git a/usr.bin/ctags/ctags.c b/usr.bin/ctags/ctags.c index 3e933f033b3f..7bdf5922a634 100644 --- a/usr.bin/ctags/ctags.c +++ b/usr.bin/ctags/ctags.c @@ -42,11 +42,14 @@ static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95"; #endif #include +__FBSDID("$FreeBSD$"); + #include +#include #include -__FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -143,6 +146,9 @@ main(int argc, char **argv) if (!argc) usage(); + if (strcmp(outfile, "-") == 0) + outfile = "/dev/stdout"; + if (!xflag) setlocale(LC_COLLATE, "C"); @@ -164,11 +170,23 @@ main(int argc, char **argv) put_entries(head); else { if (uflag) { + struct stat sb; FILE *oldf; regex_t *regx; - if ((oldf = fopen(outfile, "r")) == NULL) + if ((oldf = fopen(outfile, "r")) == NULL) { + if (errno == ENOENT) { + uflag = 0; + goto udone; + } err(1, "opening %s", outfile); + } + if (fstat(fileno(oldf), &sb) != 0 || + !S_ISREG(sb.st_mode)) { + fclose(oldf); + uflag = 0; + goto udone; + } if (unlink(outfile)) err(1, "unlinking %s", outfile); if ((outf = fopen(outfile, "w")) == NULL) @@ -198,6 +216,7 @@ nextline: fclose(outf); ++aflag; } +udone: if (!(outf = fopen(outfile, aflag ? "a" : "w"))) err(1, "%s", outfile); put_entries(head); From nobody Wed Jun 14 13:26:32 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 4Qh5mS6v4Mz4dhDM; Wed, 14 Jun 2023 13:26:32 +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 4Qh5mS3qTDz3tqW; Wed, 14 Jun 2023 13:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749192; 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=bjdvYMw19Oyr5NsmF30JVFt4r8Dn4Dx80fhQhWwAFSg=; b=BT6IbhUD3Sp8X/k+xyywKaifgQD9X2fa4T83AGcvfwCKijCu8mp00VQRhFGbL1NNWOhSTm +7GQ5idM8+w5wxMmc0xbOwYTVLGWKnEYJz+qYu6mX6FaWtShw78uS7SpSPBHp2BQ+9biuA LQ7Ii8Hn6VUxcVhTIE7Br3hhayM0u0VdauZJzii/2+dR+HM5rTO9Q8nyaO05wWlandIKTw mCMrDoCytmjtIIUc80Ewt1U0NpsDKrE8ShBrd6KwvIGXmXhjy7W0FRHO9Cb7flpUlt76Dl CWJGxW4Yu0wEf2h5TZd+0OFIeC7bPMkSc3nc65nIsqleMLA35VwePGCsi58eQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749192; 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=bjdvYMw19Oyr5NsmF30JVFt4r8Dn4Dx80fhQhWwAFSg=; b=Zapq82LYmQBba65PyuX6osmA1c/117xKO3/F7dVMGHdN3kkEcfhPP6gJr81SqcU1zRmQlt b6hCDIpa5Pe34ecxQOng+l8OdoOjqYqyB89UZeEMHAP85FuZwyJbYuJwEQdE7J8oQkzEuJ l0beZZKcPoyEsLHqCzNXwMogqB0v+KGjZpEk7iugCqJ3TTNrAbm1XFWzDwQ9IiJN/UzIvJ Ucfg/agbV7AkeMX92FoAqx44R6K1FFPJiI9KRBMdUOshNVXFxvE4VfQGu7qFB8eiysz6h9 SNDDSl3juJHBbUfsKdMtN3rfb6ibVehQ2vf2sxDsZq9haWYW3+TbMfQfRnCMsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686749192; a=rsa-sha256; cv=none; b=M2269JhdP4qG1zfBbt07KqUlaaVBc0udADoPNTo9gFm7oUHtNhpA+Z83HzpNE4cBLxOC04 /FOXppDW95KdIOCTorBPQ7vakdOaoVzz7U7+c6Mcc1um3hFwdO14XIMJLBH5NBWj0melpo SNwq1KHThAYNLE8VFRZTN3BLp022HvwXJMYsl8m0QZZvNBUWJts46Y/GMC6Ct/yfKAMtq8 b6KWWuSnW3NRoKFff9cPRul5ITqApV9xg2OyY131RWwpkRA2whJgmfIpViKG55m5BsnKDR AA1wtxiK6LDupAxqRXDW2ZtnmQ2fGPvvxIQHY5DyT8GSwbCEQA7xeLb7xn0PAQ== 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 4Qh5mS2cw7z15K0; Wed, 14 Jun 2023 13:26:32 +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 35EDQWIk099525; Wed, 14 Jun 2023 13:26:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EDQWrO099524; Wed, 14 Jun 2023 13:26:32 GMT (envelope-from git) Date: Wed, 14 Jun 2023 13:26:32 GMT Message-Id: <202306141326.35EDQWrO099524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: bc47005a648b - stable/13 - xargs: terminate if line replacement cannot be constructed 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bc47005a648b1b326cfd852c039a9b01854c5796 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=bc47005a648b1b326cfd852c039a9b01854c5796 commit bc47005a648b1b326cfd852c039a9b01854c5796 Author: Tom Jones AuthorDate: 2022-07-05 15:03:51 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-06-14 12:48:55 +0000 xargs: terminate if line replacement cannot be constructed If the line with replacement cannot be constructed xargs should terminate as documented in the man page We encounter this error, but gnu/xargs doesn't because they have a much larger limit for created outputs (~10000 lines). Reviewed by: oshogbo Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35574 (cherry picked from commit f058359ba5e08c555d7e6f192217f890b83cd46c) xargs: fix description of strnsubst return value Reported by: oshogbo Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35574 (cherry picked from commit 1e692b938e37a9b43a43ace2739eb6b97379cac0) xargs: improve foundeof check for -E 4aeb63826e0f got it almost correct (we can't use strcmp() here as current argument isn't guaranteed to be NUL-terminated), but we also need to check that current argument length is equal to that of eofstr. PR: 270867 Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D39583 (cherry picked from commit 21ef48af5c0f4ed85a5f42855b5a8d58b5431103) xargs: Fix typo in error message. MFC after: 1 week Sponsored by: Klara, Inc. (cherry picked from commit 6d777389e19d3bebde515e88e8405de45d8af7bd) xargs: Consistently use strtonum() to parse arguments. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40425 (cherry picked from commit fbc445addf9183d180bb8b488281617bb19d9242) --- usr.bin/xargs/strnsubst.c | 15 ++++++++++----- usr.bin/xargs/xargs.c | 44 +++++++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/usr.bin/xargs/strnsubst.c b/usr.bin/xargs/strnsubst.c index d826d33c0967..4a2ecd5aa9a8 100644 --- a/usr.bin/xargs/strnsubst.c +++ b/usr.bin/xargs/strnsubst.c @@ -12,11 +12,12 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include -void strnsubst(char **, const char *, const char *, size_t); +bool strnsubst(char **, const char *, const char *, size_t); /* * Replaces str with a string consisting of str with match replaced with @@ -26,16 +27,19 @@ void strnsubst(char **, const char *, const char *, size_t); * str as well as the new contents are handled in an appropriate manner. * If replstr is NULL, then that internally is changed to a nil-string, so * that we can still pretend to do somewhat meaningful substitution. - * No value is returned. + * + * Returns true if truncation was needed to do the replacement, false if + * truncation was not required. */ -void +bool strnsubst(char **str, const char *match, const char *replstr, size_t maxsize) { char *s1, *s2, *this; + bool error = false; s1 = *str; if (s1 == NULL) - return; + return false; /* * If maxsize is 0 then set it to the length of s1, because we have * to duplicate s1. XXX we maybe should double-check whether the match @@ -67,6 +71,7 @@ strnsubst(char **str, const char *match, const char *replstr, size_t maxsize) if ((strlen(s2) + strlen(s1) + strlen(replstr) - strlen(match) + 1) > maxsize) { strlcat(s2, s1, maxsize); + error = true; goto done; } strncat(s2, s1, (uintptr_t)this - (uintptr_t)s1); @@ -76,7 +81,7 @@ strnsubst(char **str, const char *match, const char *replstr, size_t maxsize) strcat(s2, s1); done: *str = s2; - return; + return error; } #ifdef TEST diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 6520d43dae50..e832cbb35a31 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -73,7 +74,7 @@ static void prerun(int, char *[]); static int prompt(void); static void run(char **); static void usage(void); -void strnsubst(char **, const char *, const char *, size_t); +bool strnsubst(char **, const char *, const char *, size_t); static pid_t xwait(int block, int *status); static void xexit(const char *, const int); static void waitchildren(const char *, int); @@ -90,6 +91,7 @@ static char echo[] = _PATH_ECHO; static char **av, **bxp, **ep, **endxp, **xp; static char *argp, *bbp, *ebp, *inpline, *p, *replstr; static const char *eofstr; +static long eoflen; static int count, insingle, indouble, oflag, pflag, tflag, Rflag, rval, zflag; static int cnt, Iflag, jfound, Lflag, Sflag, wasquoted, xflag; static int curprocs, maxprocs; @@ -122,12 +124,12 @@ main(int argc, char *argv[]) int ch, Jflag, nargs, nflag, nline; size_t linelen; struct rlimit rl; - char *endptr; const char *errstr; inpline = replstr = NULL; ep = environ; eofstr = ""; + eoflen = 0; Jflag = nflag = 0; (void)setlocale(LC_ALL, ""); @@ -158,6 +160,7 @@ main(int argc, char *argv[]) switch (ch) { case 'E': eofstr = optarg; + eoflen = strlen(eofstr); break; case 'I': Jflag = 0; @@ -171,23 +174,23 @@ main(int argc, char *argv[]) replstr = optarg; break; case 'L': - Lflag = strtonum(optarg, 0, INT_MAX, &errstr); + Lflag = (int)strtonum(optarg, 0, INT_MAX, &errstr); if (errstr) - errx(1, "-L %s: %s", optarg, errstr); + errx(1, "-%c %s: %s", ch, optarg, errstr); break; case 'n': nflag = 1; - nargs = strtonum(optarg, 1, INT_MAX, &errstr); + nargs = (int)strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) - errx(1, "-n %s: %s", optarg, errstr); + errx(1, "-%c %s: %s", ch, optarg, errstr); break; case 'o': oflag = 1; break; case 'P': - maxprocs = strtonum(optarg, 0, INT_MAX, &errstr); + maxprocs = (int)strtonum(optarg, 0, INT_MAX, &errstr); if (errstr) - errx(1, "-P %s: %s", optarg, errstr); + errx(1, "-%c %s: %s", ch, optarg, errstr); if (getrlimit(RLIMIT_NPROC, &rl) != 0) errx(1, "getrlimit failed"); if (maxprocs == 0 || maxprocs > rl.rlim_cur) @@ -197,22 +200,22 @@ main(int argc, char *argv[]) pflag = 1; break; case 'R': - Rflag = strtol(optarg, &endptr, 10); - if (*endptr != '\0') - errx(1, "replacements must be a number"); + Rflag = (int)strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(1, "-%c %s: %s", ch, optarg, errstr); break; case 'r': /* GNU compatibility */ break; case 'S': - Sflag = strtoul(optarg, &endptr, 10); - if (*endptr != '\0') - errx(1, "replsize must be a number"); + Sflag = (int)strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(1, "-%c %s: %s", ch, optarg, errstr); break; case 's': - nline = strtonum(optarg, 0, INT_MAX, &errstr); + nline = (int)strtonum(optarg, 0, INT_MAX, &errstr); if (errstr) - errx(1, "-s %s: %s", optarg, errstr); + errx(1, "-%c %s: %s", ch, optarg, errstr); break; case 't': tflag = 1; @@ -347,8 +350,8 @@ arg1: if (insingle || indouble) { xexit(*av, 1); } arg2: - foundeof = *eofstr != '\0' && - strncmp(argp, eofstr, p - argp) == 0; + foundeof = eoflen != 0 && p - argp == eoflen && + strncmp(argp, eofstr, eoflen) == 0; /* Do not make empty args unless they are quoted */ if ((argp != p || wasquoted) && !foundeof) { @@ -521,7 +524,10 @@ prerun(int argc, char *argv[]) while (--argc) { *tmp = *avj++; if (repls && strstr(*tmp, replstr) != NULL) { - strnsubst(tmp++, replstr, inpline, (size_t)Sflag); + if (strnsubst(tmp++, replstr, inpline, (size_t)Sflag)) { + warnx("command line cannot be assembled, too long"); + xexit(*argv, 1); + } if (repls > 0) repls--; } else { From nobody Wed Jun 14 13:39:04 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 4Qh62w68Cxz4djD1; Wed, 14 Jun 2023 13:39:04 +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 4Qh62w59s0z3wlB; Wed, 14 Jun 2023 13:39:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749944; 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=7/UCm2XPztLB4Rp1FNpxzxgYNQyQm4NfJ9+ruHzOHck=; b=bQFUA/95rkgu4764jZgtgot5pDZJ+48nM/FlPsAuK5fc+Bt9s2X9oy7HE1LXaRqT3nHvUD QZWLv/SJeVxx9mEqxhnEy4PSu/WkPqOhM2ij8MZRpwouWMFe9vBhAvKCtpCTIkYoZAAyJW Lrhp5xDi02VclExugcYNZ5PW/3kv0wm26JvggzeFL1gJ7r0iSHla7ZKgbdK6HORBVNA1jW QqX5nasEYdPQtQ9yfeFA7FItNIUCaZVoIWcY3SzUcf1ns7ZsVOTT47V7YRVjFVIFRG34rA CyOQYKlxFeanRdmQIB7EDoEMYxPkxXCoZl9iBqeLAzAsFF8lQDOrhNhvI7xq5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686749944; 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=7/UCm2XPztLB4Rp1FNpxzxgYNQyQm4NfJ9+ruHzOHck=; b=wfMpSPQh3aisybbYsRNRjjcCyY+qZ3+/NQXjKbBA84U5UvsliaClr2J8DSAwlW/YpUnfOx Syg+ycmp7PVFTiDjtspjueTQX/XDFvLRGKjXp/3UvdJv6evaV1m0dqNTGk+onoKPYBXS6q RZyxjwVpyP8pNSUUvPd2WLrIwrPLALPsgZj6sXaWY8Do66ro65oRb/rOCVL/PSOysPbLEV qoHFtW0nHFwYdP/tHaT2XhIgGAZbqyx2UED40FewPLAjf6NU5DFtW2SiRDXXK+sKjJJuT9 oW8XSNmsdTytMIIpTesx7dAuo+lTLO2XhgqPvdfx3uvGL51hoVB/k9rQlhOLhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686749944; a=rsa-sha256; cv=none; b=YcpnDC/QjP5V0QYh2sAU2vhLpBtPMnn05finu23EHrdGPbdjvw2D2lweRAdeDMdXdcLXxu MEsQNdnuFRuDd4Ckoq1C92eh3IsU5qzOh7Vh62/3xvcpqb/qxSDxpP/zvH/KUS/hW5cIfk L7WG1fYZ9jXW9jUQN5IfJJlnoESGz0lFvXUQhSQFgTL0Exj7loSiqNXmv8EdF2ynDUG8np fjDcIHRWYSqmdDCauoUcL4gTACPxX52SDdDCRqRL/Asp5XpciGh1SEdb62ArXo9EIcFuUi UDb26wl3V/Wvgl/5iFLr/xjMhXzWgMNm45gD9KODY10uEgqLXOuC/SL1x04L4g== 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 4Qh62w4DlJz15T6; Wed, 14 Jun 2023 13:39:04 +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 35EDd4UF015950; Wed, 14 Jun 2023 13:39:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EDd450015949; Wed, 14 Jun 2023 13:39:04 GMT (envelope-from git) Date: Wed, 14 Jun 2023 13:39:04 GMT Message-Id: <202306141339.35EDd450015949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: ba129c571660 - stable/12 - Allow a comma-separated list in login class capabilities, by adding a version of strcspn that allows quoting. 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba129c57166057690be0e146aefd8b3636eced7d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ba129c57166057690be0e146aefd8b3636eced7d commit ba129c57166057690be0e146aefd8b3636eced7d Author: Sean Eric Fagan AuthorDate: 2023-01-14 18:37:31 +0000 Commit: Ed Maste CommitDate: 2023-06-14 13:38:26 +0000 Allow a comma-separated list in login class capabilities, by adding a version of strcspn that allows quoting. PR: 236204 Differential Revision: https://reviews.freebsd.org/D25368 (cherry picked from commit f32db406504ece1b28f43dc816736e081fe22826) (cherry picked from commit f122e552354e84f18b82d11e40c6f8f214ed8abc) --- lib/libutil/login_cap.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/lib/libutil/login_cap.c b/lib/libutil/login_cap.c index cea7630698af..ffefb865ed5e 100644 --- a/lib/libutil/login_cap.c +++ b/lib/libutil/login_cap.c @@ -94,6 +94,101 @@ allocarray(size_t sz) } +/* + * This is a variant of strcspn, which checks for quoted + * strings. That is,: + * strcspn_quote("how 'now, brown' cow", ",", NULL); + * will return the index for the nul, rather than the comma, because + * the string is quoted. It does not handle escaped characters + * at this time. + */ +static size_t +strcspn_quote(const char *str, const char *exclude, int *is_quoted) +{ + size_t indx = 0; + char quote = 0; + + if (str == NULL) + return 0; + + if (is_quoted) + *is_quoted = 0; + + for (indx = 0; str[indx] != 0; indx++) { + if (quote && str[indx] == quote) { + if (is_quoted) + *is_quoted = 1; + quote = 0; + continue; + } + if (quote == 0 && + (str[indx] == '\'' || str[indx] == '"')) { + quote = str[indx]; + continue; + } + if (quote == 0 && + strchr(exclude, str[indx]) != NULL) + return indx; + } + return indx; +} + +/* + * Remove quotes from the given string. + * It's a very simplistic approach: the first + * single or double quote it finds, it looks for + * the next one, and if it finds it, moves the + * entire string backwards in two chunks + * (first quote + 1 to first quote, length + * rest of string, and then second quote + 1 + * to second quote, length rest of the string). + */ +static void +remove_quotes(char *str) +{ + static const char *quote_chars = "'\""; + char qc = 0; + int found = 0; + + do { + char *loc = NULL; + + found = 0; + /* + * If qc is 0, then we haven't found + * a quote yet, so do a strcspn search. + */ + if (qc == 0) { + size_t indx; + indx = strcspn(str, quote_chars); + if (str[indx] == '\0') + return; /* We're done */ + loc = str + indx; + qc = str[indx]; + } else { + /* + * We've found a quote character, + * so use strchr to find the next one. + */ + loc = strchr(str, qc); + if (loc == NULL) + return; + qc = 0; + } + if (loc) { + /* + * This gives us the location of the + * quoted character. We need to move + * the entire string down, from loc+1 + * to loc. + */ + size_t len = strlen(loc + 1) + 1; + memmove(loc, loc + 1, len); + found = 1; + } + } while (found != 0); +} + /* * arrayize() * Turn a simple string separated by any of @@ -112,7 +207,7 @@ arrayize(const char *str, const char *chars, int *size) /* count the sub-strings */ for (i = 0, cptr = str; *cptr; i++) { - int count = strcspn(cptr, chars); + int count = strcspn_quote(cptr, chars, NULL); cptr += count; if (*cptr) ++cptr; @@ -126,11 +221,21 @@ arrayize(const char *str, const char *chars, int *size) /* now split the string */ i = 0; while (*ptr) { - int count = strcspn(ptr, chars); + int quoted = 0; + int count = strcspn_quote(ptr, chars, "ed); + char *base = ptr; res[i++] = ptr; ptr += count; if (*ptr) *ptr++ = '\0'; + /* + * If the string contains a quoted element, we + * need to remove the quotes. + */ + if (quoted) { + remove_quotes(base); + } + } res[i] = NULL; } From nobody Wed Jun 14 16:55:41 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 4QhBPp1pnLz4dJSW; Wed, 14 Jun 2023 16:55:42 +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 4QhBPp1LWVz3FMN; Wed, 14 Jun 2023 16:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686761742; 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=sH8iin7wP8XX8OTqRwBrW0tNACkpCedh2KHIP8Aq8rk=; b=JthnsF/82LA4gXcYrfwH4l53+rIOc4CcIkn6wdafmVBCkRGLNqqL00F7lrY/iQLA2TVUQe tUlVEqxF5+txNhseykVtyq7B8Gro4eyxGlbreI0K+l2qjR0hQLrtdIMl6acuzQjY4Z1rVh EHFQEtWQVcD9JUMKX4FRBDp/OID4wEBNQxitfFFgqxKpLA6G0Tzi9vQCxxdGB9T2/TK9xj k55nH91c94mnGf3ShBoqp2xUtEZhp1zSX7ci8FJvvpTiVzoQD/gBjCuORXFAxnSTHp4rPs wtbsyfwrbXZupfusWokfrQSDe9ykKIfYQbRqaj1yMMypR438UlhDTINGYslTEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686761742; 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=sH8iin7wP8XX8OTqRwBrW0tNACkpCedh2KHIP8Aq8rk=; b=nrteUC1d/Mdq0EnreWlCW55zE9uPKwzrUmv60MPsylxVsBD9y4uuUCtdF3UxVT4Xv66CiT d3Gz4pDFD6hH7m77o2f4jEEIFsaiQIzlqIWaaR1zuRGfN4hacA09ttkR7JvFwt+17AR6EI 5sPnN5vnAv4XdrO+mnVr7BqlzZcQgRLqIFTGLUkXTkWzwKBuwAlptcRmaUE4b83KXumivu 0U6/jc0KFAPR2DhvhxR3S0iDLgOQzNj0m2SmC9b46uE09ziGaae+p8el1SbR1IC+uJ3CL9 WDurlHWQ3IjBnqGovhYbkb23m2q4zQUEdcXAz5G4bXLZwcp86BfE3bB+P7b1Gw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686761742; a=rsa-sha256; cv=none; b=Nyo5ed48q6PV5PCg12xF5NikUWRH4c7pI96aBmOmIYhOnA+tJQvucjtiaZ9Bl/lZ6GsCHn 3G7MtTtjBNQMpPqYuJr9inE9nySiYnzN1yKSD5vYNfhH7NsKzvVADQ0Q3ieF+W2DUEapug re4yxImkUrVOKNuQe8EsS6vphHkENrAn98kZqTZjs6+Mm8w004aVbHHOKIJG0FRshg98VM GtUjjJWgcJxm0S6nW5hoPPGcel+E8dc5TRPrbYml8bRcLhd/RY6Yk7tZxpSOsu1DIGQxAL STPaS6rHwO1WbEQo5sjtyX15Id1hWbLLw4oiRhMa4Jus1WqcznC2+nzj4XGRsA== 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 4QhBPp0PzBz19xD; Wed, 14 Jun 2023 16:55:42 +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 35EGtfS6044644; Wed, 14 Jun 2023 16:55:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35EGtf2F044643; Wed, 14 Jun 2023 16:55:41 GMT (envelope-from git) Date: Wed, 14 Jun 2023 16:55:41 GMT Message-Id: <202306141655.35EGtf2F044643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 894492f5bf4e - stable/13 - linuxkpi: #ifdef guard fpu_kern(9) usage 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 894492f5bf4e74f49a927f4c584779aeed983cc7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=894492f5bf4e74f49a927f4c584779aeed983cc7 commit 894492f5bf4e74f49a927f4c584779aeed983cc7 Author: Mitchell Horne AuthorDate: 2023-06-12 13:51:16 +0000 Commit: Mitchell Horne CommitDate: 2023-06-14 16:54:52 +0000 linuxkpi: #ifdef guard fpu_kern(9) usage The recent revert of 8ca78eb03fd4 removed the guards around these calls. As a result, LINT builds for architectures which do not implement this API on the branch are failing -- armv7, powerpc, powerpc64, riscv. This is a direct commit to stable/13. Fixes: fa6603d4a725 (Revert "LinuxKPI: Make FPU sections thread-safe...") Differential Revision: https://reviews.freebsd.org/D40497 --- sys/compat/linuxkpi/common/src/linux_fpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_fpu.c b/sys/compat/linuxkpi/common/src/linux_fpu.c index 976e55e68ca1..2f05ef94d5ac 100644 --- a/sys/compat/linuxkpi/common/src/linux_fpu.c +++ b/sys/compat/linuxkpi/common/src/linux_fpu.c @@ -30,6 +30,7 @@ #include #include +#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) #include struct fpu_kern_ctx *__lkpi_fpu_ctx; @@ -48,3 +49,4 @@ linux_fpu_uninit(void *arg __unused) fpu_kern_free_ctx(__lkpi_fpu_ctx); } SYSUNINIT(linux_fpu, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_fpu_uninit, NULL); +#endif From nobody Thu Jun 15 05:20:08 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 4QhVwn1V1Pz4dlGG; Thu, 15 Jun 2023 05:20:09 +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 4QhVwm6DxSz3mSx; Thu, 15 Jun 2023 05:20:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686806408; 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=gU89UJ3zYLeVQd85RZ27LxZcCoRcHljfKvdMxk29xgs=; b=uwxNan+YzPTs+baT6rv8DRpJ7mlKBaYeX+cJyYGNqwdR71J/IsjDH7nyc6DNb1iMp7ZnaR RSficGVS6XnEf+OevwDLFCD4H5V7LWoDi3O4juU9yYRJ1i8azFeAwPJz+HVlBNW70PIL1s 7DjpO5ukEtL7hfTEeLv/zSqi0YXypj/v+nMi653Nh6SzmZIEmBPVS/5f96qXFDuVQkRjqK 7wstVjECpnlZQtmHUOD41p2MC0sE0iuPr4vPZu9BU8EJD+SF9RujkTcm3AYzh7gLJBHtZ5 n20MajZSd8VIRshjGA+bAiIN6dKAjoZyvV/xFPXozdFR103nWMhlIGfQpy/CRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686806408; 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=gU89UJ3zYLeVQd85RZ27LxZcCoRcHljfKvdMxk29xgs=; b=J3UMFSXrbBhMK+8nlWE0K6rf4xt9HLaWdZd5a02H2/1njgrfRjScekBuP5opIb7hMZGIPu 3jISHsfORTziPx/zUbbcRN35TpH1QmDSpc/FjDTvf8vv+wZ1wukHDYjrvNzuDOyEwxvmwO AiQAikMuHISz6QZnzjZMfvE7dwjzbzh7570mGRcNa8KbIFRijApE+8czQLJyNQHNz2ZM0E G9+JdEWYPASODbVkAAGOBalrngKZt4b3wH8GesYuSLObpMZq3IgqGmOJL4Otu3qCcs60Ek C5lbSrZDqTd3vds3Oo0jZjXkOHqE/MDydMrXCFGeHoEnAer9CZQN75/ShWupFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686806408; a=rsa-sha256; cv=none; b=W1JIoHwo8l6XjPSBz5jqy18jXUJEVO4X9BtlskfksxMeks6F9EDWDoBU/InMvEBWau4YPk QbOK2h++h8nkZ7EbQ562ua4GdlwPvwm213exX8GhuT7KdtyCNmUJ9pnrDdwpPP/x4vDJrS K46TmyE3CSJma9skjfEyXppPifIp6Y8VKoLhkozz7+m/pqQcPn73L6v2M/u84h79Jfx6GA LcIF1vLDP/zzn1Xnlzga+TonXLxOaIfCtkyKuHLTjrinezNIiWeUs01wA9I9V8ZWnUMbQE bM9mm4wuw1VLveRRfvFfAT9/gMLgd4F5w9hXbtH32UG+ulEQ1059ZRNvD7M8/Q== 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 4QhVwm5BLvzY14; Thu, 15 Jun 2023 05:20:08 +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 35F5K8Wt069358; Thu, 15 Jun 2023 05:20:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35F5K8qr069356; Thu, 15 Jun 2023 05:20:08 GMT (envelope-from git) Date: Thu, 15 Jun 2023 05:20:08 GMT Message-Id: <202306150520.35F5K8qr069356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marko Zec Subject: git: fc17cf76153d - stable/13 - Back out fb31ad53c471e01ba473b2fb038c0cff6253654b, which was committed in error directly to stable/13 instead to main. 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: zec X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fc17cf76153da89ebdcd5d967c83f3b4d2dac0de Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=fc17cf76153da89ebdcd5d967c83f3b4d2dac0de commit fc17cf76153da89ebdcd5d967c83f3b4d2dac0de Author: Marko Zec AuthorDate: 2023-06-15 05:18:23 +0000 Commit: Marko Zec CommitDate: 2023-06-15 05:18:23 +0000 Back out fb31ad53c471e01ba473b2fb038c0cff6253654b, which was committed in error directly to stable/13 instead to main. --- sbin/route/route.8 | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/sbin/route/route.8 b/sbin/route/route.8 index 25aaf8087343..afcf55ab44c7 100644 --- a/sbin/route/route.8 +++ b/sbin/route/route.8 @@ -28,7 +28,7 @@ .\" @(#)route.8 8.3 (Berkeley) 3/19/94 .\" $FreeBSD$ .\" -.Dd May 27, 2023 +.Dd March 14, 2023 .Dt ROUTE 8 .Os .Sh NAME @@ -439,9 +439,7 @@ Lockless immutable radix, re-created on every rtable change, tailored for a small FIB with <1000 routes. .It dpdk_lpm DPDK DIR24-8-based lookups, lockless datastructure, optimized -for large FIBs. -DIR24-8 relies on a large flat lookup table (64 MB with IPv4) which is -directly indexed by the more significant portion of the lookup key. +for a large FIB. In order to use the dpdk_lpm algorithm one or both of the following kernel modules must be loaded via .Xr loader.conf 5 : @@ -451,16 +449,6 @@ DPDK implementation for IPv4. .It dpdk_lpm6.ko DPDK implementation for IPv6. .El -.It dxr -IPv4 only, lockless, compressed lookup structure -(below 2.5 Bytes per IPv4 prefix for large BGP FIBs) -which easily fits into modern CPU cache hierarchies, -lookup throughput scales linearly with CPU cores. -Loadable as a kernel module at runtime or via -.Xr loader.conf 5 : -.Bl -tag -width fib_dxr.ko -compact -.It fib_dxr.ko -.El .El .Pp The algorithms are selected automatically based on the size of the routing From nobody Thu Jun 15 14:42:35 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 4QhlPl57K0z4dFR2; Thu, 15 Jun 2023 14:42:35 +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 4QhlPl4Qhmz3kk7; Thu, 15 Jun 2023 14:42:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686840155; 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=BPBBwPFY2iL0RJ/Pbr6N/Yt+hkEhdYH+mLvBU1KpB+k=; b=rFsyMwKkc4irQtDT9TmBsAMgYnCC8KPmuMrm0q6fjBr2xQbH3OuJEyO1y7qysfSlxPNq0a G1/s7/MuYuxfE4PqvOaq3KCVutmVBVTGCpjwx6PrP6CZPt2ldgETu4KCSEVUQtbLkV4Nnu x4f6lyCzE/D50YJYXQUltLXAW5pgctDLOu6UXFGgPtRQM/u3K+5mEi9OFDtNX/BpmxSzSx gakZ/tfMYuLNhBB35uu2JmpuptMYGwnm2oJnrIT6JKuFWrcTrRv66sCWCFsVZQKSB656C3 Veh4gouznxX8bjBk4rq3bggYtVXb90nBn+Gifl9CJYvDLo9+Z0etVqq5QSDt9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686840155; 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=BPBBwPFY2iL0RJ/Pbr6N/Yt+hkEhdYH+mLvBU1KpB+k=; b=sseiehph781kupGNRNv9mix+bDMrjU5Mq/lE37B0qx+FsRPhHhOQKR/yUWiG1X1qlPJHbZ 2L8cvFZ6ddOUrPmlVx40JDsOMVdVZ/cxB+2W39JAhk8ou/+GKR9ww63kFNCeu2o1nTsVhQ 0tQAKzF4AEYytqNSubM9o9DPcnDet8XfLGe5kwReJJqEUW5f7Y5PELAOF5YCrzMV8WpQ1k hxb+C8ohB7VrjHRbxYKVSx0yRyGmlAOhPe+8+JitBz9mY8MBt+gmsYMufYanHuBL6qNgE3 VH37+szYY2bKHEylSvA3Xlc2p+4TIqcEZJi9L1KfZlJP3vWGnfvkTQCwhbJEGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686840155; a=rsa-sha256; cv=none; b=rYge+tPNWg6HLTp7ETf+LHnyjPOagdJzbOjIwM5II4XmfPQOqtmdag6+iZrFdO3NsVXtXo E7AtWfCXV4Vz88OCzng8TZEecj657bTddOYPmmPvEHtuVt0OJAMGHRTakpr2MOg57U6SIi 8NMWxMxWFh20xkaaTFF8yITOtXVzkA+bdwruH/NNycXByEbFeP9tDLnzFpHz1y7oXKE1ZH pxlKNLLPhCdcLWJt9q036wAWp/P8/kCK+ShtE3H8gOdltNzEm30juHvIVaN9tEV8rm218N MPXqCjp2R6W03FU9yhxAEd1ZEUd7LLURAoeC1BJ5N596u/2k861NpX9VTTHL8w== 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 4QhlPl3WKnzq5K; Thu, 15 Jun 2023 14:42:35 +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 35FEgZ7b003289; Thu, 15 Jun 2023 14:42:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35FEgZsN003288; Thu, 15 Jun 2023 14:42:35 GMT (envelope-from git) Date: Thu, 15 Jun 2023 14:42:35 GMT Message-Id: <202306151442.35FEgZsN003288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 498b34f60d2f - stable/13 - libvmmapi: Remove some unneeded includes 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 498b34f60d2f0ab72778c872ab82d7d5ff2664a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=498b34f60d2f0ab72778c872ab82d7d5ff2664a9 commit 498b34f60d2f0ab72778c872ab82d7d5ff2664a9 Author: Mark Johnston AuthorDate: 2023-06-08 19:03:46 +0000 Commit: Mark Johnston CommitDate: 2023-06-15 14:41:56 +0000 libvmmapi: Remove some unneeded includes These are amd64-specific and so can't be used when targetting arm64, but they don't appear to be needed. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 1320520ba488386251a7d02bd90842e031931133) --- lib/libvmmapi/vmmapi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 451d679dbbba..9f69c79561ad 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include #include #include From nobody Thu Jun 15 18:33:58 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 4QhrXk5Nxdz4dxr7; Thu, 15 Jun 2023 18:33:58 +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 4QhrXk4tBQz3LN4; Thu, 15 Jun 2023 18:33:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686854038; 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=knq1QYftQolNgoTk7Z238JwJNX86BhkQ7RSY2s82XFw=; b=dmo0BPtU+h9oUamF749lcZsTjnyI8LFtzBtxW3dAyGIF0KozUTTT5xX8XV6dqeZuzdBQrL qjDGZl/i4V8PcoezR9OVyG9aDb5V1gdAAYb1SXSw8KCr3NJannPQKJzB7+IySUGFZOYa6q tTV/TZZdysCu3BIqEcOxStAGQn5vzAxYxrjYe5P8kWodzt6x7+7dTVraTUQw4GK/JzKK4/ 52Hb+Yeuq1A6Fbmr6gAy9daBOUOKNksAKExS+JbH+AaJgm8FA2KywVWj5dqhqlkEZYw+II pf+GmL3yYjoEKcOrxEGrvTGaD+UGsbRyqhYZSpdXLiC5FFWzOIUMg6cvG9VijA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686854038; 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=knq1QYftQolNgoTk7Z238JwJNX86BhkQ7RSY2s82XFw=; b=VLxX7X29rJAbfxCwKuKVngjWPWBAjASppKP+LWYWVnu4G1HlF1exSg65bpzRoaSu/TR3oJ 3txY7Au/NVM9YxbJj9obMABCD8MoGN35vDKjPtg3AY626BkLd+Mc6WbNiSvzUNWlGYzxBf gaKoGDJdlHWy44Y2b2mHK7r+lThoX9MBrva9G7/TUmuQ3b7k0CrNxaZHekYn1VB33PYZwo bVAwXJdDkdngAXUtc80nnmLrxrz4Ym9/7E55dhV/TPY0nRN6XochXpFU7ctshMNN9+Odjr vMQl0yPFQomYaYZqmh7qvcckAbUYEXwKpWUSC2GY6LMmJnZHJODa3APmrW7viA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686854038; a=rsa-sha256; cv=none; b=FW4lYfY3azUswqhYED1BGweEIhWjkT8Tr9Ys9L7aDhTEq1TauNIyJ266WGTHic0+AlpT2p OskMnbo59TRnbk1cyVfr4KkYDMEzHDPciHtfOXAzwXYrvvtW/ByWEWLq2+3SNWhU2QUY0/ 1FZA/613nmQ85ePt7xE3ciIf63kNk2k71KT0bTHxojVo3ZH7QM12xhWjSSZ88T4YRB9Hvy Bdogm7bDliDtnl5Dog/fzIITsRU79C8UylXOEmb+jN848cSX//wWnu0QqLENcO1wJ2W0BJ 4tfSzkfNxriig+DOwGJ5oQgDU56tfqWnqEvns7HwaRWCgdJlb7Nw/elbtEwlPQ== 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 4QhrXk3yjYzx4n; Thu, 15 Jun 2023 18:33:58 +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 35FIXwgh082212; Thu, 15 Jun 2023 18:33:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35FIXwg4082211; Thu, 15 Jun 2023 18:33:58 GMT (envelope-from git) Date: Thu, 15 Jun 2023 18:33:58 GMT Message-Id: <202306151833.35FIXwg4082211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 9f2e54d1b330 - stable/13 - EC2: Chase awscli package rename 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: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9f2e54d1b330c904734619672c944d8a25265758 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=9f2e54d1b330c904734619672c944d8a25265758 commit 9f2e54d1b330c904734619672c944d8a25265758 Author: Colin Percival AuthorDate: 2023-06-08 04:22:25 +0000 Commit: Colin Percival CommitDate: 2023-06-15 18:33:50 +0000 EC2: Chase awscli package rename MFC after: 1 week (cherry picked from commit 267411d164d4d38a701599e3afe8d9e9261f65dd) --- release/tools/ec2.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf index c5eef404bf3b..d44fe9ff2f27 100644 --- a/release/tools/ec2.conf +++ b/release/tools/ec2.conf @@ -61,7 +61,7 @@ vm_extra_pre_umount() { # The AWS CLI tools are generally useful, and small enough that they # will download quickly; but users will often override this setting # via EC2 user-data. - echo 'firstboot_pkgs_list="awscli"' >> ${DESTDIR}/etc/rc.conf + echo 'firstboot_pkgs_list="devel/py-awscli"' >> ${DESTDIR}/etc/rc.conf # Enable IPv6 on all interfaces, and spawn DHCPv6 via rtsold echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf From nobody Fri Jun 16 13:59:14 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 4QjLPG5gW3z4dxYW; Fri, 16 Jun 2023 13:59:14 +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 4QjLPG3fnYz3tpy; Fri, 16 Jun 2023 13:59:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686923954; 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=E8iGncyFsLs1aQfJIaVRGGZR0biOnx8RGEZAO1ATmyM=; b=pFcAhgulO3Nralosro7X0DKoO3zvB6NZPRMsq94Bb21qmWL2H5l9yBKP9PTq9z61Vx6fKJ Li7u+kS39L9EQa7+UW44nlPHMKGFld04x1/w4Jp+w3tuj8dI+zxwUkjab8rfwuESpUYgCL FS1hUBYsL9B6fWYoGn+u5N/TFjIGXan1LGLgjLMfA8KEc/h5FqHLIqfa0qsesrtREfJmnf mYmRsuEogs1pc6UChInBeyns8OnqZQ35V15C8bdAmNsm85Kmesg5sMJS2jzTPoffJTHjoc StpLb0SfcGOZYtNEfbeMFwZnyE/VmVxB+tYDlU+qsbt+9dJkiaiPOsJJ35XI1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686923954; 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=E8iGncyFsLs1aQfJIaVRGGZR0biOnx8RGEZAO1ATmyM=; b=FbVRdEz2o3mZUYi5KtGP6FXZ8rH/w9SlVaT+FXqhV+zu8dsHLuU1jyULT4Os8QAZhKyT0v zlU8P4+MXKJyJ320Lt7NdILu3YxrCthErzAJPy/VtT278OVpghkOiEgU2w67Sx9b/rkdjy LOS/WX80Y9ubim4wdIduVFvQpquEpX1+52YSxwuCPysP2uOESGGionpuiSs2W99/qy2P/o ZINjXPjmNVkMiQthCs1UgRZ77M+O3CN0vjAKdFlOhmuyuKyAhE8CFb+AQHeGxy3wJaExBa JFvT5nEfBUw9D7DxS+mpZgFUnViJ8U7pSdfo7IdzBRqqdom2viZi7WOgQwaGCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686923954; a=rsa-sha256; cv=none; b=BtDTtKqiFe4JDvWywK5O3XOS23ckUzCTOolT+nSCy3W6TSZjx4CYhEkPFqULHPE7+einY5 2bBSq/WPoTpJPKGe9zFCbPfYzpTN6gRpx62udvSLxqMrmP1p1WnwM8Z4YcAmPpqEgnqUVf olFGrBXggasnWjliwzrETUtJVfHwr/Akjd8bKVzvPLVq5hbCENkaNsc4qzSwSsXZJJ6ksj x0Ovr24gF/yoHueZ4q3EecrDLy5fLCi2GZGlMYTuObDGzD3MNsJxkplK4Zlg/g1G8S26Qo S6FzJchb7V68L6WYmX8T41uEg3LE6gudR1K0DgWQFjEe76LbG2cCvilU2AavKw== 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 4QjLPG2l19zWM3; Fri, 16 Jun 2023 13:59:14 +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 35GDxEn0092700; Fri, 16 Jun 2023 13:59:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35GDxEbI092699; Fri, 16 Jun 2023 13:59:14 GMT (envelope-from git) Date: Fri, 16 Jun 2023 13:59:14 GMT Message-Id: <202306161359.35GDxEbI092699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ded54059fddd - stable/13 - kevent: Make references to filter definitions const 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ded54059fddd6cbe0a2dea7c3f8d35cff5661505 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ded54059fddd6cbe0a2dea7c3f8d35cff5661505 commit ded54059fddd6cbe0a2dea7c3f8d35cff5661505 Author: Mark Johnston AuthorDate: 2023-06-02 17:14:13 +0000 Commit: Mark Johnston CommitDate: 2023-06-16 13:59:00 +0000 kevent: Make references to filter definitions const Follow-up revisions can make individual filter definitions const. No functional change intended. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35842 (cherry picked from commit 67f938c5ff1a4c90fcb9372132c8458ed67aba57) --- sys/kern/kern_event.c | 17 ++++++++--------- sys/sys/event.h | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index f580ed10eb8d..a8aabd276d54 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -108,7 +108,7 @@ static int kqueue_acquire(struct file *fp, struct kqueue **kqp); static void kqueue_release(struct kqueue *kq, int locked); static void kqueue_destroy(struct kqueue *kq); static void kqueue_drain(struct kqueue *kq, struct thread *td); -static int kqueue_expand(struct kqueue *kq, struct filterops *fops, +static int kqueue_expand(struct kqueue *kq, const struct filterops *fops, uintptr_t ident, int mflag); static void kqueue_task(void *arg, int pending); static int kqueue_scan(struct kqueue *kq, int maxevents, @@ -116,7 +116,7 @@ static int kqueue_scan(struct kqueue *kq, int maxevents, const struct timespec *timeout, struct kevent *keva, struct thread *td); static void kqueue_wakeup(struct kqueue *kq); -static struct filterops *kqueue_fo_find(int filt); +static const struct filterops *kqueue_fo_find(int filt); static void kqueue_fo_release(int filt); struct g_kevent_args; static int kern_kevent_generic(struct thread *td, @@ -342,10 +342,9 @@ extern struct filterops fs_filtops; * Table for all system-defined filters. */ static struct mtx filterops_lock; -MTX_SYSINIT(kqueue_filterops, &filterops_lock, "protect sysfilt_ops", - MTX_DEF); +MTX_SYSINIT(kqueue_filterops, &filterops_lock, "protect sysfilt_ops", MTX_DEF); static struct { - struct filterops *for_fop; + const struct filterops *for_fop; int for_nolock; int for_refcnt; } sysfilt_ops[EVFILT_SYSCOUNT] = { @@ -1401,7 +1400,7 @@ kern_kevent_anonymous(struct thread *td, int nevents, } int -kqueue_add_filteropts(int filt, struct filterops *filtops) +kqueue_add_filteropts(int filt, const struct filterops *filtops) { int error; @@ -1449,7 +1448,7 @@ kqueue_del_filteropts(int filt) return error; } -static struct filterops * +static const struct filterops * kqueue_fo_find(int filt) { @@ -1492,7 +1491,7 @@ static int kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td, int mflag) { - struct filterops *fops; + const struct filterops *fops; struct file *fp; struct knote *kn, *tkn; struct knlist *knl; @@ -1818,7 +1817,7 @@ kqueue_schedtask(struct kqueue *kq) * Return 0 on success (or no work necessary), return errno on failure. */ static int -kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident, +kqueue_expand(struct kqueue *kq, const struct filterops *fops, uintptr_t ident, int mflag) { struct klist *list, *tmp_knhash, *to_free; diff --git a/sys/sys/event.h b/sys/sys/event.h index 1141a22b8109..d413428a528a 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -306,7 +306,7 @@ struct knote { struct aioliojob *p_lio; /* LIO job pointer */ void *p_v; /* generic other pointer */ } kn_ptr; - struct filterops *kn_fop; + const struct filterops *kn_fop; #define kn_id kn_kevent.ident #define kn_filter kn_kevent.filter @@ -349,7 +349,7 @@ void knlist_cleardel(struct knlist *knl, struct thread *td, void knote_fdclose(struct thread *p, int fd); int kqfd_register(int fd, struct kevent *kev, struct thread *p, int mflag); -int kqueue_add_filteropts(int filt, struct filterops *filtops); +int kqueue_add_filteropts(int filt, const struct filterops *filtops); int kqueue_del_filteropts(int filt); void kqueue_drain_schedtask(void);