[gentoo-commits] repo/gentoo:master commit in: sys-process/numad/files/, sys-process/numad/

2023-09-24 Thread Georgy Yakovlev
commit: ddd56d6a0ab0ceee1de2ef95c3d88e1d3e780c49
Author: Georgy Yakovlev  gentoo  org>
AuthorDate: Sun Sep 24 20:14:31 2023 +
Commit: Georgy Yakovlev  gentoo  org>
CommitDate: Sun Sep 24 20:42:05 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddd56d6a

sys-process/numad: fix buffer overflow, remove workaround.

Closes: https://bugs.gentoo.org/890985
Signed-off-by: Georgy Yakovlev  gentoo.org>

 .../files/0001-numad_log-fix-buffer-overflow.patch | 25 ++
 ...531-r1.ebuild => numad-0.5_p20180531-r2.ebuild} | 10 -
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/sys-process/numad/files/0001-numad_log-fix-buffer-overflow.patch 
b/sys-process/numad/files/0001-numad_log-fix-buffer-overflow.patch
new file mode 100644
index ..c67d58192169
--- /dev/null
+++ b/sys-process/numad/files/0001-numad_log-fix-buffer-overflow.patch
@@ -0,0 +1,25 @@
+From a9e6f292f4ce9443ee95c77c60dd8da68d0db7e9 Mon Sep 17 00:00:00 2001
+From: Lukas Nykryn 
+Date: Wed, 6 Sep 2023 12:27:47 +0200
+Subject: [PATCH] numad_log: fix buffer overflow
+
+---
+ numad.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/numad.c b/numad.c
+index 4c85486..2923842 100644
+--- a/numad.c
 b/numad.c
+@@ -153,7 +153,7 @@ void numad_log(int level, const char *fmt, ...) {
+ *p++ = ' ';
+ va_list ap;
+ va_start(ap, fmt);
+-vsnprintf(p, BUF_SIZE, fmt, ap);
++vsnprintf(p, BUF_SIZE - strlen(buf) , fmt, ap);
+ va_end(ap);
+ fprintf(log_fs, "%s", buf);
+ fflush(log_fs);
+-- 
+2.39.2
+

diff --git a/sys-process/numad/numad-0.5_p20180531-r1.ebuild 
b/sys-process/numad/numad-0.5_p20180531-r2.ebuild
similarity index 86%
rename from sys-process/numad/numad-0.5_p20180531-r1.ebuild
rename to sys-process/numad/numad-0.5_p20180531-r2.ebuild
index 229cae6f6556..ce503112f43e 100644
--- a/sys-process/numad/numad-0.5_p20180531-r1.ebuild
+++ b/sys-process/numad/numad-0.5_p20180531-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit flag-o-matic linux-info systemd toolchain-funcs
+inherit linux-info systemd toolchain-funcs
 
 if [[ ${PV} ==  ]]; then
EGIT_REPO_URI="https://pagure.io/numad.git;
@@ -31,15 +31,13 @@ PATCHES=(
 
# from debian/ubuntu: https://sources.debian.org/patches/numad
"${FILESDIR}/${PN}-0.5-fix-build-for-no-NR-migrate-pages.patch"
+
+   # from fedora: 
https://src.fedoraproject.org/rpms/numad/c/b9fdb5b1b09611ba164c04cd994e5e9ddf7fb8f4
+   "${FILESDIR}/0001-numad_log-fix-buffer-overflow.patch"
 )
 
 src_configure() {
tc-export AR CC RANLIB
-
-   # FIXME: https://bugs.gentoo.org/890985
-   # temp workaround
-   filter-flags -D_FORTIFY_SOURCE=3
-   append-cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
 }
 
 src_compile() {



[gentoo-commits] repo/gentoo:master commit in: sys-process/numad/files/, sys-process/numad/

2023-01-15 Thread Georgy Yakovlev
commit: 3fb47a688395b40a6cdb5927dce68be79555d62c
Author: Georgy Yakovlev  gentoo  org>
AuthorDate: Sun Jan 15 22:42:19 2023 +
Commit: Georgy Yakovlev  gentoo  org>
CommitDate: Sun Jan 15 22:50:05 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3fb47a68

sys-process/numad: add 0.5_p20180531

add a non-ancient version of numad. We take current stable from Fedora
and add just couple of commits on top, nothing major.
current gentoo versions do not even support cgroupv2 and crash on
startup.

remove conf file. systemd unit no longer reads it, systemd users can use
'systemctl edit numad.service' to override args as needed.
openrc file uses conf.d and never used conf file.

add ppc64le patch where node ids can be sparse.

add temporary F_S=3 workaround until #890985 is solved.

Bug: https://bugs.gentoo.org/890985
Signed-off-by: Georgy Yakovlev  gentoo.org>

 sys-process/numad/Manifest |  1 +
 .../files/numad-0.5-fix-sparse-node-ids.patch  | 53 
 sys-process/numad/numad-0.5_p20180531.ebuild   | 56 ++
 3 files changed, 110 insertions(+)

diff --git a/sys-process/numad/Manifest b/sys-process/numad/Manifest
index 9ca70d36ccab..937bd58cf6f8 100644
--- a/sys-process/numad/Manifest
+++ b/sys-process/numad/Manifest
@@ -1 +1,2 @@
 DIST numad-0.5-334278f.tar.bz2 21007 BLAKE2B 
f226e90e0ad664b0cccd82c060b21cc8b7c4b086220f6eee1cd6e421b32f0efe2be11e66ce749142315f8207e19e635a718a41e5a8dd3ecfda02a96dfbd62798
 SHA512 
1b4a577f0713bae1386f2064fcb2dcbfb9453e23e7617f40cfff4e56d02a8c26a48c8d03f1ac7aa36e4ba168824572377f84bc669d1dabdc1820c2cdc4c57911
+DIST numad-0.5_p20180531.tar.gz 29797 BLAKE2B 
455feba97685b0f0c6dd8ce10227d397b14d51d6fc128805648dd94b627ae61c4889ea4cc17667b9a1953c5122d39972172e05d3e782a313ecedbe7f85bfce41
 SHA512 
36b0387369b7d23b28ad8b4bd8b27089c304efb8357ad9f6693ff3098c56a3a88e39b30f70d35688e6090f4917250fd40d1aaac084a91310450412a05b8d6746

diff --git a/sys-process/numad/files/numad-0.5-fix-sparse-node-ids.patch 
b/sys-process/numad/files/numad-0.5-fix-sparse-node-ids.patch
new file mode 100644
index ..d7d438457826
--- /dev/null
+++ b/sys-process/numad/files/numad-0.5-fix-sparse-node-ids.patch
@@ -0,0 +1,53 @@
+From ab79ec5b6389507b4970d68862abb95d0b2b94c9 Mon Sep 17 00:00:00 2001
+From: Christian Ehrhardt 
+Date: Jun 17 2019 10:37:48 +
+Subject: fix sparse node ids
+
+
+CPU-ids can be sparse due to disabling a subset of CPUs.
+On ppc64le this even will make the node_ids sparse, this is actually pretty
+common on ppc64 when SMT is disabled.
+
+Numad has the assumption of cpu/node-ids always being linear and due to that
+accesses the 'node' array out of bounds. That triggers crashes like the
+following:
+
+  Thread 1 "numad" received signal SIGSEGV, Segmentation fault.
+  #0 0x0fb6cd2779f4 in bind_process_and_migrate_memory (p=0xfb6fc1e0f70)
+at numad.c:998
+  #1 0x0fb6cd27d148 in manage_loads () at numad.c:2225
+  #2 0x0fb6cd2734dc in main (argc=, argv=)
+at numad.c:2654
+
+Instead of directly indexing with node_id we need to detect which array
+element has the matching node_id and use that.
+
+Signed-off-by: Christian Ehrhardt 
+
+---
+
+diff --git a/numad.c b/numad.c
+index a6a7a5d..524bf61 100644
+--- a/numad.c
 b/numad.c
+@@ -995,7 +995,18 @@ int bind_process_and_migrate_memory(process_data_p p) {
+ int node_id = 0;
+ while (nodes) {
+ if (ID_IS_IN_LIST(node_id, p->node_list_p)) {
+-OR_LISTS(cpu_bind_list_p, cpu_bind_list_p, 
node[node_id].cpu_list_p);
++int id = -1;
++for (int node_ix = 0;  (node_ix < num_nodes);  node_ix++) {
++if (node[node_ix].node_id == node_id) {
++id = node_ix;
++break;
++}
++}
++if (id == -1) {
++numad_log(LOG_CRIT, "Node %d is requested, but unknown\n", 
node_id);
++exit(EXIT_FAILURE);
++}
++OR_LISTS(cpu_bind_list_p, cpu_bind_list_p, node[id].cpu_list_p);
+ nodes -= 1;
+ }
+ node_id += 1;
+

diff --git a/sys-process/numad/numad-0.5_p20180531.ebuild 
b/sys-process/numad/numad-0.5_p20180531.ebuild
new file mode 100644
index ..a778299f0ae4
--- /dev/null
+++ b/sys-process/numad/numad-0.5_p20180531.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic linux-info systemd toolchain-funcs
+
+if [[ ${PV} ==  ]]; then
+   EGIT_REPO_URI="https://pagure.io/numad.git;
+   inherit git-r3
+else
+   # sync with fedora (as numad upstream) and add couple of commis.
+   # at time of writing f37 uses 20150602
+   # git archive --format=tar.gz --prefix="${P}/" -o ${P}.tar.gz 
${EGIT_COMMIT}
+   EGIT_COMMIT="d696d6c413c5b47b4bbae79e29ea132e52095af3"
+   

[gentoo-commits] repo/gentoo:master commit in: sys-process/numad/files/, sys-process/numad/

2022-06-19 Thread Sam James
commit: 4e3b9beabb52e2163a358da546e33b4634617fdd
Author: Sam James  gentoo  org>
AuthorDate: Mon Jun 20 03:20:37 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Jun 20 05:03:49 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e3b9bea

sys-process/numad: fix -Wformat-security

Closes: https://bugs.gentoo.org/520308
Signed-off-by: Sam James  gentoo.org>

 .../numad/files/numad-0.5-wformat-security.patch   | 19 
 sys-process/numad/numad-0.5-r4.ebuild  | 53 ++
 2 files changed, 72 insertions(+)

diff --git a/sys-process/numad/files/numad-0.5-wformat-security.patch 
b/sys-process/numad/files/numad-0.5-wformat-security.patch
new file mode 100644
index ..5c0aa2c41f18
--- /dev/null
+++ b/sys-process/numad/files/numad-0.5-wformat-security.patch
@@ -0,0 +1,19 @@
+https://src.fedoraproject.org/rpms/numad/raw/f21/f/0001-Fix-build-with-Werror-format-security.patch
+https://bugs.gentoo.org/520308
+
+From 6ab732334bc765d4b5883ddde0e9891b4813d136 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ville=20Skytt=C3=A4?= 
+Date: Mon, 20 Jan 2014 22:25:58 +0200
+Subject: [PATCH 1/2] Fix build with -Werror=format-security
+
+--- a/numad.c
 b/numad.c
+@@ -154,7 +154,7 @@ void numad_log(int level, const char *fmt, ...) {
+ }
+ char buf[BUF_SIZE];
+ time_t ts = time(NULL);
+-sprintf(buf, ctime());
++sprintf(buf, "%s", ctime());
+ char *p = [strlen(buf) - 1];
+ *p++ = ':';
+ *p++ = ' ';

diff --git a/sys-process/numad/numad-0.5-r4.ebuild 
b/sys-process/numad/numad-0.5-r4.ebuild
new file mode 100644
index ..33f98562b754
--- /dev/null
+++ b/sys-process/numad/numad-0.5-r4.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit linux-info systemd toolchain-funcs
+
+if [[ ${PV} ==  ]]; then
+   EGIT_REPO_URI="https://pagure.io/numad.git;
+   inherit git-r3
+else
+   EGIT_COMMIT="334278ff3d774d105939743436d7378a189e8693"
+   SRC_URI="mirror://gentoo/numad-0.5-${EGIT_COMMIT:0:7}.tar.bz2"
+   KEYWORDS="~amd64 -arm ~arm64 ~ppc64 ~s390 ~x86"
+   S="${WORKDIR}/${PN}-${EGIT_COMMIT:0:7}"
+fi
+
+DESCRIPTION="The NUMA daemon that manages application locality"
+HOMEPAGE="http://fedoraproject.org/wiki/Features/numad;
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+
+CONFIG_CHECK="~NUMA ~CPUSETS"
+
+PATCHES=(
+   "${FILESDIR}/0001-Fix-man-page-directory-creation.patch"
+   "${FILESDIR}/${PN}-0.5-ldlibs.patch"
+   "${FILESDIR}/${PN}-0.5-wformat-security.patch"
+)
+
+src_prepare() {
+   default
+   tc-export CC
+}
+
+src_compile() {
+   emake CFLAGS="${CFLAGS} -std=gnu99"
+}
+
+src_install() {
+   emake prefix="${ED}"/usr install
+
+   newinitd "${FILESDIR}"/numad.initd numad
+   newconfd "${FILESDIR}"/numad.confd numad
+
+   insinto /etc/logrotate.d
+   newins "${FILESDIR}"/numad.logrotated numad
+
+   insinto /etc
+   doins numad.conf
+   systemd_dounit numad.service
+}



[gentoo-commits] repo/gentoo:master commit in: sys-process/numad/files/, sys-process/numad/

2018-12-19 Thread Georgy Yakovlev
commit: fe28d1908e27e8bc4f7e01d673c4bfc7149f855b
Author: Georgy Yakovlev  gentoo  org>
AuthorDate: Sun Dec  2 06:46:43 2018 +
Commit: Georgy Yakovlev  gentoo  org>
CommitDate: Thu Dec 20 01:12:32 2018 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe28d190

sys-process/numad: add service files

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Georgy Yakovlev  gentoo.org>

 sys-process/numad/files/numad.confd  |  6 ++
 sys-process/numad/files/numad.initd  | 14 ++
 sys-process/numad/files/numad.logrotated |  5 +
 sys-process/numad/numad-.ebuild  | 22 +-
 4 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/sys-process/numad/files/numad.confd 
b/sys-process/numad/files/numad.confd
new file mode 100644
index 000..8767c1102c5
--- /dev/null
+++ b/sys-process/numad/files/numad.confd
@@ -0,0 +1,6 @@
+# /etc/conf.d/numad: config file for /etc/init.d/numad
+#
+# Options to pass to the numad daemon.
+# See the numad(8) man page for more info.
+
+#NUMAD_OPTS="-v"

diff --git a/sys-process/numad/files/numad.initd 
b/sys-process/numad/files/numad.initd
new file mode 100755
index 000..afeee892124
--- /dev/null
+++ b/sys-process/numad/files/numad.initd
@@ -0,0 +1,14 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+description="NUMA daemon that manages application locality"
+
+depend() {
+   need localmount
+   use logger
+}
+
+command="/usr/bin/numad"
+command_args="${NUMAD_OPTS}"
+pidfile="/run/${RC_SVCNAME}.pid"

diff --git a/sys-process/numad/files/numad.logrotated 
b/sys-process/numad/files/numad.logrotated
new file mode 100644
index 000..bf17dc3335c
--- /dev/null
+++ b/sys-process/numad/files/numad.logrotated
@@ -0,0 +1,5 @@
+/var/log/numad.log {
+   copytruncate
+   missingok
+   notifempty
+}

diff --git a/sys-process/numad/numad-.ebuild 
b/sys-process/numad/numad-.ebuild
index d292669c500..9b2cc2d66a7 100644
--- a/sys-process/numad/numad-.ebuild
+++ b/sys-process/numad/numad-.ebuild
@@ -1,16 +1,18 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 
-inherit linux-info toolchain-funcs
+inherit linux-info systemd toolchain-funcs
 
 if [[ ${PV} == "" ]]; then
EGIT_REPO_URI="https://pagure.io/numad.git;
inherit git-r3
 else
-   SRC_URI=""
-   KEYWORDS="~amd64 ~x86 -arm -s390"
+   EGIT_COMMIT=""
+   SRC_URI="mirror://gentoo/numad-0.5-${EGIT_COMMIT:0:7}.tar.bz2"
+   KEYWORDS="~amd64 -arm ~arm64 -s390 ~x86"
+   S="${WORKDIR}/${PN}-${EGIT_COMMIT:0:7}"
 fi
 
 DESCRIPTION="The NUMA daemon that manages application locality"
@@ -33,4 +35,14 @@ src_compile() {
 
 src_install() {
emake prefix="${ED}/usr" install
+
+   newinitd "${FILESDIR}/numad.initd" numad
+   newconfd "${FILESDIR}/numad.confd" numad
+
+   insinto /etc/logrotate.d
+   newins "${FILESDIR}/numad.logrotated" numad
+
+   insinto /etc
+   doins numad.conf
+   systemd_dounit numad.service
 }