- Update to version 2.40.4...
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=582
This commit is contained in:
commit
25172ba59e
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
@ -0,0 +1,32 @@
|
||||
From: Xi Ruoyao <xry111@xry111.site>
|
||||
Date: Sun, 31 Mar 2024 00:42:03 +0800
|
||||
Subject: include: Include <unistd.h> in pidfd-utils.h for syscall()
|
||||
Git-repo: https://github.com/util-linux/util-linux.git
|
||||
Git-commit: 10add327c608b11b3d70215048aade4d1797b1fd
|
||||
Patch-mainline: yes
|
||||
References: kernel 6.9
|
||||
|
||||
In Glibc, <sys/syscall.h> only contains SYS_* macros and the syscall()
|
||||
function is in <unistd.h>. So include it.
|
||||
|
||||
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
|
||||
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
||||
---
|
||||
include/pidfd-utils.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
|
||||
index ff0bc4c7..0ee55f3b 100644
|
||||
--- a/include/pidfd-utils.h
|
||||
+++ b/include/pidfd-utils.h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#ifdef HAVE_SYS_SYSCALL_H
|
||||
# include <sys/syscall.h>
|
||||
+# include <unistd.h>
|
||||
|
||||
/*
|
||||
* If the kernel headers are too old to provide the syscall numbers, let's
|
||||
--
|
||||
2.45.0
|
||||
|
319
0002-lsfd-Refactor-the-pidfd-logic-into-lsfd-pidfd.c.patch
Normal file
319
0002-lsfd-Refactor-the-pidfd-logic-into-lsfd-pidfd.c.patch
Normal file
@ -0,0 +1,319 @@
|
||||
From: Xi Ruoyao <xry111@xry111.site>
|
||||
Date: Wed, 3 Apr 2024 15:29:34 +0800
|
||||
Subject: lsfd: Refactor the pidfd logic into lsfd-pidfd.c
|
||||
Git-repo: https://github.com/util-linux/util-linux.git
|
||||
Git-commit: bf6645dc1edef09ad378cc5b9eb2c93861408735
|
||||
Patch-mainline: yes
|
||||
References: kernel 6.9
|
||||
|
||||
We'll reuse these logic for pidfd support on Linux >= 6.9. This should
|
||||
be a no-functional change.
|
||||
|
||||
Besides moving the code, this change also renames anon_pidfd_data to
|
||||
pidfd_data, and removes a redundant nullity check for free (because
|
||||
free(NULL) will just do nothing per the C standard).
|
||||
|
||||
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
|
||||
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
||||
---
|
||||
misc-utils/Makemodule.am | 4 +-
|
||||
misc-utils/lsfd-pidfd.c | 95 ++++++++++++++++++++++++++++++++++++++++
|
||||
misc-utils/lsfd-pidfd.h | 37 ++++++++++++++++
|
||||
misc-utils/lsfd-unkn.c | 71 +++++-------------------------
|
||||
misc-utils/meson.build | 1 +
|
||||
5 files changed, 147 insertions(+), 61 deletions(-)
|
||||
create mode 100644 misc-utils/lsfd-pidfd.c
|
||||
create mode 100644 misc-utils/lsfd-pidfd.h
|
||||
|
||||
diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am
|
||||
index 9edf3d98..7622a5d7 100644
|
||||
--- a/misc-utils/Makemodule.am
|
||||
+++ b/misc-utils/Makemodule.am
|
||||
@@ -298,7 +298,9 @@ lsfd_SOURCES = \
|
||||
misc-utils/lsfd-sock.h \
|
||||
misc-utils/lsfd-sock-xinfo.c \
|
||||
misc-utils/lsfd-unkn.c \
|
||||
- misc-utils/lsfd-fifo.c
|
||||
+ misc-utils/lsfd-fifo.c \
|
||||
+ misc-utils/lsfd-pidfd.h \
|
||||
+ misc-utils/lsfd-pidfd.c
|
||||
lsfd_LDADD = $(LDADD) $(MQ_LIBS) libsmartcols.la libcommon.la
|
||||
lsfd_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
|
||||
endif
|
||||
diff --git a/misc-utils/lsfd-pidfd.c b/misc-utils/lsfd-pidfd.c
|
||||
new file mode 100644
|
||||
index 00000000..430a8028
|
||||
--- /dev/null
|
||||
+++ b/misc-utils/lsfd-pidfd.c
|
||||
@@ -0,0 +1,95 @@
|
||||
+/*
|
||||
+ * lsfd-pidfd.c - handle pidfd (from anon_inode or pidfs)
|
||||
+ *
|
||||
+ * Copyright (C) 2024 Xi Ruoyao <xry111@xry111.site>
|
||||
+ *
|
||||
+ * Refactored and moved out from lsfd-unkn.c (originally authored by
|
||||
+ * Masatake YAMATO <yamato@redhat.com>).
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it would be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "strutils.h"
|
||||
+#include "xalloc.h"
|
||||
+
|
||||
+#include "lsfd.h"
|
||||
+#include "lsfd-pidfd.h"
|
||||
+
|
||||
+int pidfd_handle_fdinfo(struct pidfd_data *data, const char *key,
|
||||
+ const char *value)
|
||||
+{
|
||||
+ if (strcmp(key, "Pid") == 0) {
|
||||
+ uint64_t pid;
|
||||
+ int rc = ul_strtou64(value, &pid, 10);
|
||||
+
|
||||
+ if (rc < 0)
|
||||
+ return 0; /* ignore -- parse failed */
|
||||
+
|
||||
+ data->pid = (pid_t)pid;
|
||||
+ return 1;
|
||||
+ } else if (strcmp(key, "NSpid") == 0) {
|
||||
+ data->nspid = xstrdup(value);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+char *pidfd_get_name(struct pidfd_data *data)
|
||||
+{
|
||||
+ char *str = NULL;
|
||||
+ char *comm = NULL;
|
||||
+ struct proc *proc = get_proc(data->pid);
|
||||
+
|
||||
+ if (proc)
|
||||
+ comm = proc->command;
|
||||
+
|
||||
+ xasprintf(&str, "pid=%d comm=%s nspid=%s",
|
||||
+ data->pid,
|
||||
+ comm ? comm : "",
|
||||
+ data->nspid ? data->nspid : "");
|
||||
+ return str;
|
||||
+}
|
||||
+
|
||||
+bool pidfd_fill_column(struct pidfd_data *data, int column_id, char **str)
|
||||
+{
|
||||
+ switch(column_id) {
|
||||
+ case COL_PIDFD_COMM: {
|
||||
+ struct proc *pidfd_proc = get_proc(data->pid);
|
||||
+ char *pidfd_comm = NULL;
|
||||
+
|
||||
+ if (pidfd_proc)
|
||||
+ pidfd_comm = pidfd_proc->command;
|
||||
+ if (pidfd_comm) {
|
||||
+ *str = xstrdup(pidfd_comm);
|
||||
+ return true;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ case COL_PIDFD_NSPID:
|
||||
+ if (data->nspid) {
|
||||
+ *str = xstrdup(data->nspid);
|
||||
+ return true;
|
||||
+ }
|
||||
+ break;
|
||||
+ case COL_PIDFD_PID:
|
||||
+ xasprintf(str, "%d", (int)data->pid);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/misc-utils/lsfd-pidfd.h b/misc-utils/lsfd-pidfd.h
|
||||
new file mode 100644
|
||||
index 00000000..2f65d3b3
|
||||
--- /dev/null
|
||||
+++ b/misc-utils/lsfd-pidfd.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+/*
|
||||
+ * lsfd-pidfd.h - handle pidfd (from anon_inode or pidfs)
|
||||
+ *
|
||||
+ * Copyright (C) 2024 Xi Ruoyao <xry111@xry111.site>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it would be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+ */
|
||||
+
|
||||
+#include <stdbool.h>
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
+struct pidfd_data {
|
||||
+ pid_t pid;
|
||||
+ char *nspid;
|
||||
+};
|
||||
+
|
||||
+int pidfd_handle_fdinfo(struct pidfd_data *, const char *, const char *);
|
||||
+char *pidfd_get_name(struct pidfd_data *);
|
||||
+bool pidfd_fill_column(struct pidfd_data *, int, char **);
|
||||
+
|
||||
+static inline void __attribute__((nonnull(1)))
|
||||
+pidfd_free(struct pidfd_data *data)
|
||||
+{
|
||||
+ free(data->nspid);
|
||||
+}
|
||||
diff --git a/misc-utils/lsfd-unkn.c b/misc-utils/lsfd-unkn.c
|
||||
index 8f6e9084..8e257f47 100644
|
||||
--- a/misc-utils/lsfd-unkn.c
|
||||
+++ b/misc-utils/lsfd-unkn.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "timeutils.h"
|
||||
|
||||
#include "lsfd.h"
|
||||
+#include "lsfd-pidfd.h"
|
||||
|
||||
#define offsetofend(TYPE, MEMBER) \
|
||||
(offsetof(TYPE, MEMBER) + sizeof_member(TYPE, MEMBER))
|
||||
@@ -183,10 +184,6 @@ static int unkn_handle_fdinfo(struct file *file, const char *key, const char *va
|
||||
/*
|
||||
* pidfd
|
||||
*/
|
||||
-struct anon_pidfd_data {
|
||||
- pid_t pid;
|
||||
- char *nspid;
|
||||
-};
|
||||
|
||||
static bool anon_pidfd_probe(const char *str)
|
||||
{
|
||||
@@ -195,51 +192,28 @@ static bool anon_pidfd_probe(const char *str)
|
||||
|
||||
static char *anon_pidfd_get_name(struct unkn *unkn)
|
||||
{
|
||||
- char *str = NULL;
|
||||
- struct anon_pidfd_data *data = (struct anon_pidfd_data *)unkn->anon_data;
|
||||
+ struct pidfd_data *data = (struct pidfd_data *)unkn->anon_data;
|
||||
|
||||
- char *comm = NULL;
|
||||
- struct proc *proc = get_proc(data->pid);
|
||||
- if (proc)
|
||||
- comm = proc->command;
|
||||
-
|
||||
- xasprintf(&str, "pid=%d comm=%s nspid=%s",
|
||||
- data->pid,
|
||||
- comm? comm: "",
|
||||
- data->nspid? data->nspid: "");
|
||||
- return str;
|
||||
+ return pidfd_get_name(data);
|
||||
}
|
||||
|
||||
static void anon_pidfd_init(struct unkn *unkn)
|
||||
{
|
||||
- unkn->anon_data = xcalloc(1, sizeof(struct anon_pidfd_data));
|
||||
+ unkn->anon_data = xcalloc(1, sizeof(struct pidfd_data));
|
||||
}
|
||||
|
||||
static void anon_pidfd_free(struct unkn *unkn)
|
||||
{
|
||||
- struct anon_pidfd_data *data = (struct anon_pidfd_data *)unkn->anon_data;
|
||||
+ struct pidfd_data *data = (struct pidfd_data *)unkn->anon_data;
|
||||
|
||||
- if (data->nspid)
|
||||
- free(data->nspid);
|
||||
+ pidfd_free(data);
|
||||
free(data);
|
||||
}
|
||||
|
||||
static int anon_pidfd_handle_fdinfo(struct unkn *unkn, const char *key, const char *value)
|
||||
{
|
||||
- if (strcmp(key, "Pid") == 0) {
|
||||
- uint64_t pid;
|
||||
-
|
||||
- int rc = ul_strtou64(value, &pid, 10);
|
||||
- if (rc < 0)
|
||||
- return 0; /* ignore -- parse failed */
|
||||
- ((struct anon_pidfd_data *)unkn->anon_data)->pid = (pid_t)pid;
|
||||
- return 1;
|
||||
- } else if (strcmp(key, "NSpid") == 0) {
|
||||
- ((struct anon_pidfd_data *)unkn->anon_data)->nspid = xstrdup(value);
|
||||
- return 1;
|
||||
-
|
||||
- }
|
||||
- return 0;
|
||||
+ return pidfd_handle_fdinfo((struct pidfd_data *)unkn->anon_data,
|
||||
+ key, value);
|
||||
}
|
||||
|
||||
static bool anon_pidfd_fill_column(struct proc *proc __attribute__((__unused__)),
|
||||
@@ -249,32 +223,9 @@ static bool anon_pidfd_fill_column(struct proc *proc __attribute__((__unused__)
|
||||
size_t column_index __attribute__((__unused__)),
|
||||
char **str)
|
||||
{
|
||||
- struct anon_pidfd_data *data = (struct anon_pidfd_data *)unkn->anon_data;
|
||||
-
|
||||
- switch(column_id) {
|
||||
- case COL_PIDFD_COMM: {
|
||||
- struct proc *pidfd_proc = get_proc(data->pid);
|
||||
- char *pidfd_comm = NULL;
|
||||
- if (pidfd_proc)
|
||||
- pidfd_comm = pidfd_proc->command;
|
||||
- if (pidfd_comm) {
|
||||
- *str = xstrdup(pidfd_comm);
|
||||
- return true;
|
||||
- }
|
||||
- break;
|
||||
- }
|
||||
- case COL_PIDFD_NSPID:
|
||||
- if (data->nspid) {
|
||||
- *str = xstrdup(data->nspid);
|
||||
- return true;
|
||||
- }
|
||||
- break;
|
||||
- case COL_PIDFD_PID:
|
||||
- xasprintf(str, "%d", (int)data->pid);
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
+ return pidfd_fill_column((struct pidfd_data *)unkn->anon_data,
|
||||
+ column_id,
|
||||
+ str);
|
||||
}
|
||||
|
||||
static const struct anon_ops anon_pidfd_ops = {
|
||||
diff --git a/misc-utils/meson.build b/misc-utils/meson.build
|
||||
index 847b1012..68ea9777 100644
|
||||
--- a/misc-utils/meson.build
|
||||
+++ b/misc-utils/meson.build
|
||||
@@ -56,6 +56,7 @@ lsfd_sources = files (
|
||||
'lsfd-sock-xinfo.c',
|
||||
'lsfd-unkn.c',
|
||||
'lsfd-fifo.c',
|
||||
+ 'lsfd-pidfd.c',
|
||||
)
|
||||
|
||||
uuidgen_sources = files(
|
||||
--
|
||||
2.45.0
|
||||
|
186
0003-lsfd-Support-pidfs.patch
Normal file
186
0003-lsfd-Support-pidfs.patch
Normal file
@ -0,0 +1,186 @@
|
||||
From: Xi Ruoyao <xry111@xry111.site>
|
||||
Date: Wed, 3 Apr 2024 15:46:57 +0800
|
||||
Subject: lsfd: Support pidfs
|
||||
Git-repo: https://github.com/util-linux/util-linux.git
|
||||
Git-commit: b1a48efd173c7f37d8df39a84eb25b4440335661
|
||||
Patch-mainline: yes
|
||||
References: kernel 6.9
|
||||
|
||||
In Linux 6.9 pidfds are moved from the anonymous inode infrastructure to
|
||||
a tiny pseudo filesystem named pidfs. Recognize it properly.
|
||||
|
||||
Fixes #2865.
|
||||
|
||||
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
|
||||
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
||||
---
|
||||
misc-utils/lsfd-file.c | 96 ++++++++++++++++++++++++++++++++++++++++++
|
||||
misc-utils/lsfd.c | 3 ++
|
||||
misc-utils/lsfd.h | 7 ++-
|
||||
3 files changed, 105 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/misc-utils/lsfd-file.c b/misc-utils/lsfd-file.c
|
||||
index 9b91462d..3f330146 100644
|
||||
--- a/misc-utils/lsfd-file.c
|
||||
+++ b/misc-utils/lsfd-file.c
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "procfs.h"
|
||||
|
||||
#include "lsfd.h"
|
||||
+#include "lsfd-pidfd.h"
|
||||
+#include "pidfd-utils.h"
|
||||
|
||||
static struct idcache *username_cache;
|
||||
|
||||
@@ -492,6 +494,22 @@ static unsigned long get_minor_for_mqueue(void)
|
||||
return minor(sb.st_dev);
|
||||
}
|
||||
|
||||
+static unsigned long get_minor_for_pidfs(void)
|
||||
+{
|
||||
+ int fd = pidfd_open(getpid(), 0);
|
||||
+ struct stat sb;
|
||||
+ unsigned long ret = 0;
|
||||
+
|
||||
+ if (fd < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (fstat(fd, &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFREG)
|
||||
+ ret = minor(sb.st_dev);
|
||||
+
|
||||
+ close(fd);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void file_class_initialize(void)
|
||||
{
|
||||
unsigned long m;
|
||||
@@ -510,6 +528,10 @@ static void file_class_initialize(void)
|
||||
m = get_minor_for_mqueue();
|
||||
if (m)
|
||||
add_nodev(m, "mqueue");
|
||||
+
|
||||
+ m = get_minor_for_pidfs();
|
||||
+ if (m)
|
||||
+ add_nodev(m, "pidfs");
|
||||
}
|
||||
|
||||
static void file_class_finalize(void)
|
||||
@@ -783,3 +805,77 @@ const struct file_class mqueue_file_class = {
|
||||
.fill_column = mqueue_file_fill_column,
|
||||
.get_ipc_class = mqueue_file_get_ipc_class,
|
||||
};
|
||||
+
|
||||
+struct pidfs_file {
|
||||
+ struct file file;
|
||||
+ struct pidfd_data data;
|
||||
+};
|
||||
+
|
||||
+static void init_pidfs_file_content(struct file *file)
|
||||
+{
|
||||
+ struct pidfs_file *pidfs_file = (struct pidfs_file *)file;
|
||||
+
|
||||
+ memset(&pidfs_file->data, 0, sizeof(pidfs_file->data));
|
||||
+}
|
||||
+
|
||||
+static int pidfs_file_handle_fdinfo(struct file *file, const char *key, const char *value)
|
||||
+{
|
||||
+ struct pidfs_file *pidfs_file = (struct pidfs_file *)file;
|
||||
+
|
||||
+ return pidfd_handle_fdinfo(&pidfs_file->data, key, value);
|
||||
+}
|
||||
+
|
||||
+static void pidfs_file_free_content(struct file *file)
|
||||
+{
|
||||
+ struct pidfs_file *pidfs_file = (struct pidfs_file *)file;
|
||||
+
|
||||
+ pidfd_free(&pidfs_file->data);
|
||||
+}
|
||||
+
|
||||
+static bool pidfs_file_fill_column(struct proc *proc __attribute__((__unused__)),
|
||||
+ struct file *file,
|
||||
+ struct libscols_line *ln,
|
||||
+ int column_id,
|
||||
+ size_t column_index)
|
||||
+{
|
||||
+ struct pidfs_file *pidfs_file = (struct pidfs_file *)file;
|
||||
+ char *buf = NULL;
|
||||
+
|
||||
+ switch(column_id) {
|
||||
+ case COL_TYPE:
|
||||
+ if (scols_line_set_data(ln, column_index, "pidfd"))
|
||||
+ err(EXIT_FAILURE, _("failed to add output data"));
|
||||
+ return true;
|
||||
+ case COL_NAME:
|
||||
+ buf = pidfd_get_name(&pidfs_file->data);
|
||||
+ break;
|
||||
+ default:
|
||||
+ if (!pidfd_fill_column(&pidfs_file->data, column_id, &buf))
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (buf &&
|
||||
+ scols_line_refer_data(ln, column_index, buf))
|
||||
+ err(EXIT_FAILURE, _("failed to add output data"));
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+const struct file_class pidfs_file_class = {
|
||||
+ .super = &file_class,
|
||||
+ .size = sizeof(struct pidfs_file),
|
||||
+ .initialize_content = init_pidfs_file_content,
|
||||
+ .handle_fdinfo = pidfs_file_handle_fdinfo,
|
||||
+ .fill_column = pidfs_file_fill_column,
|
||||
+ .free_content = pidfs_file_free_content,
|
||||
+};
|
||||
+
|
||||
+bool is_pidfs_dev(dev_t dev)
|
||||
+{
|
||||
+ const char *fs = get_nodev_filesystem(minor(dev));
|
||||
+
|
||||
+ if (fs && (strcmp (fs, "pidfs") == 0))
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c
|
||||
index 98820ee8..01e88d51 100644
|
||||
--- a/misc-utils/lsfd.c
|
||||
+++ b/misc-utils/lsfd.c
|
||||
@@ -683,6 +683,9 @@ static const struct file_class *stat2class(struct stat *sb)
|
||||
if (is_mqueue_dev(dev))
|
||||
return &mqueue_file_class;
|
||||
|
||||
+ if (is_pidfs_dev(dev))
|
||||
+ return &pidfs_file_class;
|
||||
+
|
||||
return &file_class;
|
||||
default:
|
||||
break;
|
||||
diff --git a/misc-utils/lsfd.h b/misc-utils/lsfd.h
|
||||
index e646758c..f0f17d5b 100644
|
||||
--- a/misc-utils/lsfd.h
|
||||
+++ b/misc-utils/lsfd.h
|
||||
@@ -228,7 +228,7 @@ struct file_class {
|
||||
};
|
||||
|
||||
extern const struct file_class file_class, cdev_class, bdev_class, sock_class, unkn_class, fifo_class,
|
||||
- nsfs_file_class, mqueue_file_class;
|
||||
+ nsfs_file_class, mqueue_file_class, pidfs_file_class;
|
||||
|
||||
/*
|
||||
* IPC
|
||||
@@ -307,4 +307,9 @@ bool is_mqueue_dev(dev_t dev);
|
||||
*/
|
||||
bool is_multiplexed_by_eventpoll(int fd, struct list_head *eventpolls);
|
||||
|
||||
+/*
|
||||
+ * Pidfs
|
||||
+ */
|
||||
+bool is_pidfs_dev(dev_t dev);
|
||||
+
|
||||
#endif /* UTIL_LINUX_LSFD_H */
|
||||
--
|
||||
2.45.0
|
||||
|
142
0004-lsfd-test-Adapt-test-cases-for-pidfs.patch
Normal file
142
0004-lsfd-test-Adapt-test-cases-for-pidfs.patch
Normal file
@ -0,0 +1,142 @@
|
||||
From: Xi Ruoyao <xry111@xry111.site>
|
||||
Date: Thu, 28 Mar 2024 04:01:02 +0800
|
||||
Subject: lsfd: test: Adapt test cases for pidfs
|
||||
Git-repo: https://github.com/util-linux/util-linux.git
|
||||
Git-commit: 04db2ba9008e9635286b1aafc8ecd9533a0a91bf
|
||||
Patch-mainline: yes
|
||||
References: kernel 6.9
|
||||
|
||||
On Linux >= 6.9, pidfds are from pidfs instead of anonymous inode.
|
||||
Thus:
|
||||
|
||||
STTYPE is REG on Linux >= 6.9, UNKN on Linux < 6.9.
|
||||
|
||||
KNAME is pidfd:[inode number] on Linux >= 6.9, anon_inode:[pidfd] on
|
||||
Linux < 6.9.
|
||||
|
||||
And ainode_class test cannot work on Linux >= 6.9, just skip this sub
|
||||
test if STTYPE is REG.
|
||||
|
||||
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
|
||||
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
||||
---
|
||||
tests/expected/lsfd/column-name-pidfd | 2 +-
|
||||
tests/expected/lsfd/column-type-pidfd | 2 +-
|
||||
tests/expected/lsfd/mkfds-pidfd | 2 +-
|
||||
tests/ts/lsfd/column-ainodeclass | 8 ++++++++
|
||||
tests/ts/lsfd/column-name | 7 +++++++
|
||||
tests/ts/lsfd/column-type | 7 +++++++
|
||||
tests/ts/lsfd/mkfds-pidfd | 4 ++++
|
||||
7 files changed, 29 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tests/expected/lsfd/column-name-pidfd b/tests/expected/lsfd/column-name-pidfd
|
||||
index 10e3c5e7..68787d69 100644
|
||||
--- a/tests/expected/lsfd/column-name-pidfd
|
||||
+++ b/tests/expected/lsfd/column-name-pidfd
|
||||
@@ -1,2 +1,2 @@
|
||||
-3 anon_inode:[pidfd] pid=1 comm= nspid=1
|
||||
+3 [KNAME] pid=1 comm= nspid=1
|
||||
pidfd:ASSOC,KNAME,NAME: 0
|
||||
diff --git a/tests/expected/lsfd/column-type-pidfd b/tests/expected/lsfd/column-type-pidfd
|
||||
index 6c9a9632..a4379807 100644
|
||||
--- a/tests/expected/lsfd/column-type-pidfd
|
||||
+++ b/tests/expected/lsfd/column-type-pidfd
|
||||
@@ -1,2 +1,2 @@
|
||||
-3 UNKN pidfd
|
||||
+3 [STTYPE] pidfd
|
||||
pidfd:ASSOC,STTYPE,TYPE: 0
|
||||
diff --git a/tests/expected/lsfd/mkfds-pidfd b/tests/expected/lsfd/mkfds-pidfd
|
||||
index 94846992..bce4dd42 100644
|
||||
--- a/tests/expected/lsfd/mkfds-pidfd
|
||||
+++ b/tests/expected/lsfd/mkfds-pidfd
|
||||
@@ -1,2 +1,2 @@
|
||||
-3 UNKN anon_inodefs pid=1 comm=systemd nspid=1 systemd 1
|
||||
+3 [STTYPE] [SOURCE] pid=1 comm=systemd nspid=1 systemd 1
|
||||
ASSOC,STTYPE,SOURCE,NAME,PIDFD.COMM,PIDFD.PID: 0
|
||||
diff --git a/tests/ts/lsfd/column-ainodeclass b/tests/ts/lsfd/column-ainodeclass
|
||||
index 6829494f..ab2abebd 100755
|
||||
--- a/tests/ts/lsfd/column-ainodeclass
|
||||
+++ b/tests/ts/lsfd/column-ainodeclass
|
||||
@@ -42,10 +42,18 @@ for C in pidfd inotify; do
|
||||
fi
|
||||
wait "${MKFDS_PID}"
|
||||
} > "$TS_OUTPUT" 2>&1
|
||||
+
|
||||
if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then
|
||||
ts_skip_subtest "pidfd_open(2) is not available"
|
||||
continue
|
||||
fi
|
||||
+
|
||||
+ STTYPE="$(head -n1 "$TS_OUTPUT" | awk '{print $2}')"
|
||||
+ if [ "$C-$STTYPE" == "pidfd-REG" ]; then
|
||||
+ ts_skip_subtest "pidfd is from pidfs instead of anon inode"
|
||||
+ continue
|
||||
+ fi
|
||||
+
|
||||
ts_finalize_subtest
|
||||
done
|
||||
|
||||
diff --git a/tests/ts/lsfd/column-name b/tests/ts/lsfd/column-name
|
||||
index 8bf8f421..9c67de88 100755
|
||||
--- a/tests/ts/lsfd/column-name
|
||||
+++ b/tests/ts/lsfd/column-name
|
||||
@@ -64,10 +64,17 @@ for C in ro-regular-file pidfd socketpair; do
|
||||
fi
|
||||
} > "$TS_OUTPUT" 2>&1
|
||||
wait "${MKFDS_PID}"
|
||||
+
|
||||
if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then
|
||||
ts_skip_subtest "pidfd_open(2) is not available"
|
||||
continue
|
||||
fi
|
||||
+
|
||||
+ case $C in
|
||||
+ pidfd)
|
||||
+ sed -i -E 's/(pidfd|anon_inode):\[[a-zA-Z]+\]/[KNAME]/' "$TS_OUTPUT"
|
||||
+ esac
|
||||
+
|
||||
ts_finalize_subtest
|
||||
done
|
||||
|
||||
diff --git a/tests/ts/lsfd/column-type b/tests/ts/lsfd/column-type
|
||||
index 77bc5c94..1b8aa8c6 100755
|
||||
--- a/tests/ts/lsfd/column-type
|
||||
+++ b/tests/ts/lsfd/column-type
|
||||
@@ -50,10 +50,17 @@ for C in ro-regular-file pidfd inotify socketpair; do
|
||||
fi
|
||||
wait "${MKFDS_PID}"
|
||||
} > "$TS_OUTPUT" 2>&1
|
||||
+
|
||||
if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then
|
||||
ts_skip_subtest "pidfd_open(2) is not available"
|
||||
continue
|
||||
fi
|
||||
+
|
||||
+ case $C in
|
||||
+ pidfd)
|
||||
+ sed -i -E 's/UNKN|REG/[STTYPE]/' "$TS_OUTPUT"
|
||||
+ esac
|
||||
+
|
||||
ts_finalize_subtest
|
||||
done
|
||||
|
||||
diff --git a/tests/ts/lsfd/mkfds-pidfd b/tests/ts/lsfd/mkfds-pidfd
|
||||
index c0fae4f7..9b0ff33c 100755
|
||||
--- a/tests/ts/lsfd/mkfds-pidfd
|
||||
+++ b/tests/ts/lsfd/mkfds-pidfd
|
||||
@@ -44,8 +44,12 @@ EXPR="(PID != ${TARGET}) and (FD == 3) and (PIDFD.PID == ${TARGET})"
|
||||
fi
|
||||
wait ${MKFDS_PID}
|
||||
} > $TS_OUTPUT 2>&1
|
||||
+
|
||||
if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then
|
||||
ts_skip "pidfd_open(2) is not available"
|
||||
fi
|
||||
|
||||
+sed -i -E -e 's/UNKN|REG/[STTYPE]/' -e 's/pidfs|anon_inodefs/[SOURCE]/' \
|
||||
+ $TS_OUTPUT
|
||||
+
|
||||
ts_finalize
|
||||
--
|
||||
2.45.0
|
||||
|
52
Add-documentation-on-blacklisted-modules-to-mount-8-.patch
Normal file
52
Add-documentation-on-blacklisted-modules-to-mount-8-.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From 1ade50a36f23fc35abb465aa5b7cfc73b2476328 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Fri, 1 Feb 2019 12:09:11 +0100
|
||||
Subject: [PATCH] Add documentation on blacklisted modules to mount(8) man page
|
||||
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
---
|
||||
sys-utils/mount.8 | 28 +++++++++++++++++++++++++++-
|
||||
1 file changed, 27 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/sys-utils/mount.8
|
||||
+++ b/sys-utils/mount.8
|
||||
@@ -205,6 +205,32 @@ Since util\-linux 2.35, \fBmount\fP does
|
||||
For more details, see \fBfstab\fP(5). Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount it, then use \fBusers\fP instead of \fBuser\fP in the \fIfstab\fP line. The \fBowner\fP option is similar to the \fBuser\fP option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for \fI/dev/fd\fP if a login script makes the console user owner of this device. The \fBgroup\fP option is similar, with the restriction that the user must be a member of the group of the special file.
|
||||
.sp
|
||||
The \fBuser\fP mount option is accepted if no username is specified. If used in the format \fBuser=someone\fP, the option is silently ignored and visible only for external mount helpers (/sbin/mount.<type>) for compatibility with some network filesystems.
|
||||
+.SS Blacklisted file systems
|
||||
+In the Linux kernel, file system types are implemented as kernel
|
||||
+modules. While many of these file systems are well maintained,
|
||||
+some of the older and less frequently used ones are not. This
|
||||
+poses a security risk, because maliciously crafted file system
|
||||
+images might open security holes when mounted either automatically
|
||||
+or by an inadvertent user. The
|
||||
+.B mount
|
||||
+command prints "unsupported file system type 'somefs'" in this case,
|
||||
+because it can't distinguish between a really unsupported file system
|
||||
+(kernel module non-existent) and a blacklisted file system.
|
||||
+
|
||||
+Users who need the blacklisted file systems and therefore want
|
||||
+to override the blacklisting can either load the blacklisted module
|
||||
+directly:
|
||||
+.RS
|
||||
+
|
||||
+.br
|
||||
+.BI "modprobe -v" " somefs"
|
||||
+.br
|
||||
+
|
||||
+.RE
|
||||
+or override the blacklist configuration by editing files under the
|
||||
+.I /etc/modprobe.d
|
||||
+directory.
|
||||
+
|
||||
.SS "Bind mount operation"
|
||||
.sp
|
||||
Remount part of the file hierarchy somewhere else. The call is:
|
||||
@@ -2571,4 +2597,4 @@ For bug reports, use the issue tracker a
|
||||
.SH "AVAILABILITY"
|
||||
.sp
|
||||
The \fBmount\fP command is part of the util\-linux package which can be downloaded from \c
|
||||
-.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."
|
||||
\ No newline at end of file
|
||||
+.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."
|
4
_multibuild
Normal file
4
_multibuild
Normal file
@ -0,0 +1,4 @@
|
||||
<multibuild>
|
||||
<package>systemd</package>
|
||||
<package>python</package>
|
||||
</multibuild>
|
4
_scmsync.obsinfo
Normal file
4
_scmsync.obsinfo
Normal file
@ -0,0 +1,4 @@
|
||||
mtime: 1732123801
|
||||
commit: 1f607dd355d8ca2a0fa48e4d3662cad355a81b877985b076ecc7a1527d45771c
|
||||
url: https://src.opensuse.org/jengelh/util-linux
|
||||
revision: master
|
20
baselibs.conf
Normal file
20
baselibs.conf
Normal file
@ -0,0 +1,20 @@
|
||||
libblkid1
|
||||
libblkid-devel
|
||||
requires -libblkid-<targettype>
|
||||
requires "libblkid1-<targettype> = <version>"
|
||||
libfdisk1
|
||||
libfdisk-devel
|
||||
requires -libfdisk-<targettype>
|
||||
requires "libfdisk1-<targettype> = <version>"
|
||||
libmount1
|
||||
libmount-devel
|
||||
requires -libmount-<targettype>
|
||||
requires "libmount1-<targettype> = <version>"
|
||||
libsmartcols1
|
||||
libsmartcols-devel
|
||||
requires -libsmartcols-<targettype>
|
||||
requires "libsmartcols1-<targettype> = <version>"
|
||||
libuuid1
|
||||
libuuid-devel
|
||||
requires -libuuid-<targettype>
|
||||
requires "libuuid1-<targettype> = <version>"
|
5
blkid.conf
Normal file
5
blkid.conf
Normal file
@ -0,0 +1,5 @@
|
||||
# do not keep cache file across reboots
|
||||
CACHE_FILE=/dev/.blkid.tab
|
||||
|
||||
# never try to sequentially scan all devices in /dev
|
||||
EVALUATE=udev
|
3
build.specials.obscpio
Normal file
3
build.specials.obscpio
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:61a765e8d466450446dd85c699160cfc02aab7dfe35927dbede2111c3afe94f2
|
||||
size 256
|
78
libmount-print-a-blacklist-hint-for-unknown-filesyst.patch
Normal file
78
libmount-print-a-blacklist-hint-for-unknown-filesyst.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From 199ae08b4df09ec4ce9d82584664e61bcb7ab91a Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Fri, 1 Feb 2019 11:36:42 +0100
|
||||
Subject: [PATCH 1/2] libmount: print a blacklist hint for "unknown filesystem
|
||||
type"
|
||||
|
||||
SUSE blacklists kernel modules for some old, poorly maintained
|
||||
file systems by default for security reasons. Provide a hopefully
|
||||
helpful message to users if mounting a possibly blacklisted file
|
||||
system fails.
|
||||
|
||||
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||
---
|
||||
libmount/src/context_mount.c | 41 ++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 37 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
|
||||
index f914c9b..a48483f 100644
|
||||
--- a/libmount/src/context_mount.c
|
||||
+++ b/libmount/src/context_mount.c
|
||||
@@ -1423,6 +1423,32 @@ done:
|
||||
return rc;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * SUSE blacklists kernel modules for some old, poorly maintained
|
||||
+ * file systems by default for security reasons.
|
||||
+ * A set of blacklist files is maintained under /etc/modprobe.d,
|
||||
+ * in the suse-module-tools package.
|
||||
+ * Blacklisted file system modules will cause mount(2) to fail
|
||||
+ * with -ENODEV.
|
||||
+ * If this happens for one of the blacklisted file systems, provide
|
||||
+ * a hint to the user where to look.
|
||||
+ */
|
||||
+static int is_maybe_blacklisted(const char *fstype)
|
||||
+{
|
||||
+ static const char *const fs_blacklist[] = {
|
||||
+ "adfs", "affs", "bfs", "befs", "cramfs", "efs", "erofs",
|
||||
+ "exofs", "freevxfs", "f2fs", "hfs", "hpfs",
|
||||
+ "jfs", "minix", "nilfs2", "ntfs", "omfs", "qnx4", "qnx6",
|
||||
+ "sysv", "ufs"
|
||||
+ };
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < sizeof(fs_blacklist)/sizeof(*fs_blacklist); i++)
|
||||
+ if (!strcmp(fs_blacklist[i], fstype))
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int mnt_context_get_mount_excode(
|
||||
struct libmnt_context *cxt,
|
||||
int rc,
|
||||
@@ -1670,10 +1696,17 @@ int mnt_context_get_mount_excode(
|
||||
case ENODEV:
|
||||
if (!buf)
|
||||
break;
|
||||
- if (mnt_context_get_fstype(cxt))
|
||||
- snprintf(buf, bufsz, _("unknown filesystem type '%s'"),
|
||||
- mnt_context_get_fstype(cxt));
|
||||
- else
|
||||
+ if (mnt_context_get_fstype(cxt)) {
|
||||
+ size_t n;
|
||||
+
|
||||
+ n = snprintf(buf, bufsz,
|
||||
+ _("unknown filesystem type '%s'"),
|
||||
+ mnt_context_get_fstype(cxt));
|
||||
+ if (n < bufsz &&
|
||||
+ is_maybe_blacklisted(mnt_context_get_fstype(cxt)))
|
||||
+ snprintf(buf + n, bufsz - n,
|
||||
+ " (hint: possibly blacklisted, see mount(8))");
|
||||
+ } else
|
||||
snprintf(buf, bufsz, _("unknown filesystem type"));
|
||||
break;
|
||||
|
||||
--
|
||||
2.19.2
|
||||
|
14
login.pamd
Normal file
14
login.pamd
Normal file
@ -0,0 +1,14 @@
|
||||
#%PAM-1.0
|
||||
auth requisite pam_nologin.so
|
||||
auth substack common-auth
|
||||
auth include postlogin-auth
|
||||
account substack common-account
|
||||
account include postlogin-account
|
||||
password substack common-password
|
||||
password include postlogin-password
|
||||
session required pam_loginuid.so
|
||||
session optional pam_keyinit.so force revoke
|
||||
session substack common-session
|
||||
session include postlogin-session
|
||||
session optional pam_motd.so
|
||||
session optional pam_mail.so standard
|
149
make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
Normal file
149
make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
Normal file
@ -0,0 +1,149 @@
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: 2013-06-06 08:27:43+0000
|
||||
Subject: let `su' handle /sbin and /usr/sbin in path
|
||||
|
||||
Index: util-linux-2.31/login-utils/su-common.c
|
||||
===================================================================
|
||||
--- util-linux-2.31.orig/login-utils/su-common.c
|
||||
+++ util-linux-2.31/login-utils/su-common.c
|
||||
@@ -944,6 +944,117 @@ static void setenv_path(const struct pas
|
||||
err(EXIT_FAILURE, _("failed to set the PATH environment variable"));
|
||||
}
|
||||
|
||||
+/* Add or clear /sbin and /usr/sbin for the su command
|
||||
+ used without `-'. */
|
||||
+
|
||||
+/* Set if /sbin is found in path. */
|
||||
+#define SBIN_MASK 0x01
|
||||
+/* Set if /usr/sbin is found in path. */
|
||||
+#define USBIN_MASK 0x02
|
||||
+
|
||||
+static char *
|
||||
+addsbin (const char *const path)
|
||||
+{
|
||||
+ unsigned char smask = 0;
|
||||
+ char *ptr, *tmp, *cur, *ret = NULL;
|
||||
+ size_t len;
|
||||
+
|
||||
+ if (!path || *path == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ tmp = xstrdup (path);
|
||||
+ cur = tmp;
|
||||
+ for (ptr = strsep (&cur, ":"); ptr != NULL; ptr = strsep (&cur, ":"))
|
||||
+ {
|
||||
+ if (!strcmp (ptr, "/sbin"))
|
||||
+ smask |= SBIN_MASK;
|
||||
+ if (!strcmp (ptr, "/usr/sbin"))
|
||||
+ smask |= USBIN_MASK;
|
||||
+ }
|
||||
+
|
||||
+ if ((smask & (USBIN_MASK|SBIN_MASK)) == (USBIN_MASK|SBIN_MASK))
|
||||
+ {
|
||||
+ free (tmp);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ len = strlen (path);
|
||||
+ if (!(smask & USBIN_MASK))
|
||||
+ len += strlen ("/usr/sbin:");
|
||||
+
|
||||
+ if (!(smask & SBIN_MASK))
|
||||
+ len += strlen (":/sbin");
|
||||
+
|
||||
+ ret = xmalloc (len + 1);
|
||||
+ strcpy (tmp, path);
|
||||
+
|
||||
+ *ret = 0;
|
||||
+ cur = tmp;
|
||||
+ for (ptr = strsep (&cur, ":"); ptr; ptr = strsep (&cur, ":"))
|
||||
+ {
|
||||
+ if (!strcmp (ptr, "."))
|
||||
+ continue;
|
||||
+ if (*ret)
|
||||
+ strcat (ret, ":");
|
||||
+ if (!(smask & USBIN_MASK) && !strcmp (ptr, "/bin"))
|
||||
+ {
|
||||
+ strcat (ret, "/usr/sbin:");
|
||||
+ strcat (ret, ptr);
|
||||
+ smask |= USBIN_MASK;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!(smask & SBIN_MASK) && !strcmp (ptr, "/usr/bin"))
|
||||
+ {
|
||||
+ strcat (ret, ptr);
|
||||
+ strcat (ret, ":/sbin");
|
||||
+ smask |= SBIN_MASK;
|
||||
+ continue;
|
||||
+ }
|
||||
+ strcat (ret, ptr);
|
||||
+ }
|
||||
+ free (tmp);
|
||||
+
|
||||
+ if (!(smask & USBIN_MASK))
|
||||
+ strcat (ret, ":/usr/sbin");
|
||||
+
|
||||
+ if (!(smask & SBIN_MASK))
|
||||
+ strcat (ret, ":/sbin");
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+clearsbin (const char *const path)
|
||||
+{
|
||||
+ char *ptr, *tmp, *cur, *ret = NULL;
|
||||
+
|
||||
+ if (!path || *path == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ tmp = strdup (path);
|
||||
+ if (!tmp)
|
||||
+ return NULL;
|
||||
+
|
||||
+ ret = xmalloc (strlen (path) + 1);
|
||||
+ *ret = 0;
|
||||
+ cur = tmp;
|
||||
+ for (ptr = strsep (&cur, ":"); ptr; ptr = strsep (&cur, ":"))
|
||||
+ {
|
||||
+ if (!strcmp (ptr, "/sbin"))
|
||||
+ continue;
|
||||
+ if (!strcmp (ptr, "/usr/sbin"))
|
||||
+ continue;
|
||||
+ if (!strcmp (ptr, "/usr/local/sbin"))
|
||||
+ continue;
|
||||
+ if (*ret)
|
||||
+ strcat (ret, ":");
|
||||
+ strcat (ret, ptr);
|
||||
+ }
|
||||
+ free (tmp);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void modify_environment(struct su_context *su, const char *shell)
|
||||
{
|
||||
const struct passwd *pw = su->pwd;
|
||||
@@ -982,6 +1093,22 @@ static void modify_environment(struct su
|
||||
|
||||
if (getlogindefs_bool("ALWAYS_SET_PATH", 0))
|
||||
setenv_path(pw);
|
||||
+ else
|
||||
+ {
|
||||
+ char const *path = getenv ("PATH");
|
||||
+ char *new = NULL;
|
||||
+
|
||||
+ if (pw->pw_uid)
|
||||
+ new = clearsbin (path);
|
||||
+ else
|
||||
+ new = addsbin (path);
|
||||
+
|
||||
+ if (new)
|
||||
+ {
|
||||
+ xsetenv ("PATH", new, 1);
|
||||
+ free (new);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (pw->pw_uid) {
|
||||
xsetenv("USER", pw->pw_name, 1);
|
16
remote.pamd
Normal file
16
remote.pamd
Normal file
@ -0,0 +1,16 @@
|
||||
#%PAM-1.0
|
||||
# This file is used by /bin/login in case of remote logins (means where
|
||||
# the -h option is used).
|
||||
auth requisite pam_nologin.so
|
||||
auth [user_unknown=ignore success=ok ignore=ignore auth_err=die default=bad] pam_securetty.so
|
||||
auth substack common-auth
|
||||
auth include postlogin-auth
|
||||
account substack common-account
|
||||
account include postlogin-account
|
||||
password substack common-password
|
||||
password include postlogin-password
|
||||
session required pam_loginuid.so
|
||||
session optional pam_keyinit.so force revoke
|
||||
session substack common-session
|
||||
session include postlogin-session
|
||||
session optional pam_mail.so standard
|
7
runuser-l.pamd
Normal file
7
runuser-l.pamd
Normal file
@ -0,0 +1,7 @@
|
||||
#%PAM-1.0
|
||||
# Note that runuser requires only "session" setting (and for example
|
||||
# "auth sufficient pam_rootok.so" dummy line).
|
||||
auth sufficient pam_rootok.so
|
||||
session optional pam_keyinit.so force revoke
|
||||
session include common-session
|
||||
session optional pam_xauth.so
|
7
runuser.pamd
Normal file
7
runuser.pamd
Normal file
@ -0,0 +1,7 @@
|
||||
#%PAM-1.0
|
||||
# Note that runuser requires only "session" setting (and for example
|
||||
# "auth sufficient pam_rootok.so" dummy line).
|
||||
auth sufficient pam_rootok.so
|
||||
session optional pam_keyinit.so revoke
|
||||
session include common-session-nonlogin
|
||||
session optional pam_xauth.so
|
31
static_lib.patch
Normal file
31
static_lib.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From: Stefan Schubert <schubi@suse.com>
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: 2024-04-15T13:34:15Z
|
||||
|
||||
[Original description: Added "Requires.private: libeconf" in order to
|
||||
build with static libeconf.a.]
|
||||
|
||||
This patch addresses a build failure in libblkid-using programs when
|
||||
one attempts to static-link the program:
|
||||
|
||||
$ g++ blkid_get_cache.cpp -static `pkg-config blkid --cflags --libs --static`
|
||||
ld: libblkid.a(la-config.o): in function `blkid_read_config':
|
||||
libblkid/src/config.c:160:(.text+0x150): undefined reference to `econf_readFile'
|
||||
ld: libblkid/src/config.c:241:(.text+0x1a1): undefined reference to `econf_freeFile'
|
||||
|
||||
The patch is not upstreamable in this form, as the presence of the
|
||||
Requires.private line needs to be conditionalized upon
|
||||
``HAVE_LIBECONF`` (cf. meson.build/configure.ac).
|
||||
|
||||
[Description updated; --jengelh]
|
||||
|
||||
diff -ur org/libblkid/blkid.pc.in patch/libblkid/blkid.pc.in
|
||||
--- org/libblkid/blkid.pc.in 2024-01-31 11:02:15.460811568 +0100
|
||||
+++ patch/libblkid/blkid.pc.in 2024-04-15 15:19:34.288703597 +0200
|
||||
@@ -6,5 +6,6 @@
|
||||
Name: blkid
|
||||
Description: Block device id library
|
||||
Version: @LIBBLKID_VERSION@
|
||||
+Requires.private: libeconf
|
||||
Cflags: -I${includedir}/blkid
|
||||
Libs: -L${libdir} -lblkid
|
9
su-l.pamd
Normal file
9
su-l.pamd
Normal file
@ -0,0 +1,9 @@
|
||||
#%PAM-1.0
|
||||
auth sufficient pam_rootok.so
|
||||
auth include common-auth
|
||||
account sufficient pam_rootok.so
|
||||
account include common-account
|
||||
password include common-password
|
||||
session optional pam_keyinit.so force revoke
|
||||
session include common-session
|
||||
session optional pam_xauth.so
|
6
su.default
Normal file
6
su.default
Normal file
@ -0,0 +1,6 @@
|
||||
# /etc/default/su is an override of /etc/login.defs for su.
|
||||
# See /etc/login.defs and su(1) for more.
|
||||
#
|
||||
# List of supported variables:
|
||||
# ALWAYS_SET_PATH, ENV_PATH, ENV_ROOTPATH, ENV_SUPATH, FAIL_DELAY
|
||||
#
|
8
su.pamd
Normal file
8
su.pamd
Normal file
@ -0,0 +1,8 @@
|
||||
#%PAM-1.0
|
||||
auth sufficient pam_rootok.so
|
||||
auth include common-auth
|
||||
account sufficient pam_rootok.so
|
||||
account include common-account
|
||||
password include common-password
|
||||
session include common-session-nonlogin
|
||||
session optional pam_xauth.so
|
5
tmpfiles.lastlog2.conf
Normal file
5
tmpfiles.lastlog2.conf
Normal file
@ -0,0 +1,5 @@
|
||||
# This file is for lastlog2/pam_lastlog2.
|
||||
#
|
||||
# See tmpfiles.d(5) for details
|
||||
#
|
||||
d /var/lib/lastlog 0755 - - -
|
16
util-linux-2.40.1.tar.sign
Normal file
16
util-linux-2.40.1.tar.sign
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEsMZNFDAcxu+u32Dk5LcdXuw5woQFAmY4lxMACgkQ5LcdXuw5
|
||||
woSckw//ZmoxCcjdDBv5LkAK0Yl5EMKZYzkvqswsp/Uwllgevb/FcCGwZ+F49RM3
|
||||
H8F5Kj5CIJW9wh2UNWxaMm4MxcGd3eG2NEwgYh8RiXSS84zEL78yaIJLyFlPziMp
|
||||
kZb0fpc2HpyCzDrvtlw6S5TGkUUx2uFqTQQG7GFd6TOlbPpGp4OpqY3adf85mwmr
|
||||
NKy0XbYLo6sqGENz6Uklbf5Qhc19UEEc1jScOYNpkuCxhRQguxq3Jc6W8A8DQkjB
|
||||
EWaw9Q1XYDV3Bnd40F0K+bo3CYB6z3pMM51NlsYxV0fKt/SoEvJw3S7u3VcbtJWn
|
||||
S6xl6q/sMINDrMIpSL5PAAg5yoBNIIoWW7OxSh0nv6ctp9dmln0sKBtXNr09zTWT
|
||||
q9mLUt7LwXB6LT3XI64262vF21bKq/hQO8IObsx8vfPSlp1SyGq7VqGh6QVbkjx6
|
||||
2vA7ueV5jfIKiAlZAcXz6NHjwxcBqYq7wASeUEmYPgh5lb4HBOuOgatYBNAmQoxp
|
||||
2t5AXPPhI/u95GRa4WntpgqlQm/1CKA9kHiezvO4P0lnpUluT24DXclMTcq4xaiN
|
||||
ci+dzVF2EPRoPJgYy9crKNsr7dftVtvAVXIRk3UaTwDe1o7OK4vSykDc0PSNxsHQ
|
||||
mMabBuFt17oweonotSOZ8z7blHnCVnzZWVxyIxC3Pw/0ChHFAkw=
|
||||
=68JD
|
||||
-----END PGP SIGNATURE-----
|
BIN
util-linux-2.40.1.tar.xz
(Stored with Git LFS)
Normal file
BIN
util-linux-2.40.1.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
16
util-linux-2.40.2.tar.sign
Normal file
16
util-linux-2.40.2.tar.sign
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEsMZNFDAcxu+u32Dk5LcdXuw5woQFAmaGWfQACgkQ5LcdXuw5
|
||||
woQyjw/+Pv55mIJB4V6DM/ZWWEgTKosHRaJK8NyZ8EieuBBz3BDxa8KECru0l8zK
|
||||
3wNiS/H15xnDlVPysQx+tk9ieWc4vPNTJ0WCbb9w4DS1P9aEpG4GwgAoQ+a+MbJY
|
||||
yYdfBYXLFMAxxIM7Crvls14rC5c4MCdFRMaVVdiqQSG6OKTuLXOGV+QglrzeVO6f
|
||||
03SKVv4NS/ModEoZwkGNBB+c63lKVLATIEhBQHE+TL9oB/KtLyEDEEwXc/5Pclz7
|
||||
pGM7knNN6O553NN4G5z0ez1ovZtbGJgNO9arLt2mLau57+dCoodCJn3ohagCfZH5
|
||||
ZeZI8ajj6sxZ2kgfvFF84wYP/eFZf0/3XOZfbif4Hy7UcV/bxZdQION62gvpiy/c
|
||||
/cdHN8Sga2B/1yNQyTO5oZTwr1fGnlInuy5LkvT7ZpfTtLR+QS9OhVcPWBbfYJbD
|
||||
D8KKIfPkuuzsWkpKqCmTim/67s3ZY0zIXWTOntMcFelItrfkr0wClEivBji+f97U
|
||||
wARhXLdS84MqEKyM7VH8hYpl6fgqpJPgWnO+91roXQyrnUCJVzM730oIDiEm1PKI
|
||||
tXnQo5qF+nBpBTvIvfDa5e52mcou42yMGQxGrCmkvzfm9Vypyz7lnyLRrzULYAqA
|
||||
0BZwMNwry1vmhYDWLKGH2TKkE5C7d+nwU4dzOCQWPTJhdm2FKcc=
|
||||
=YzYC
|
||||
-----END PGP SIGNATURE-----
|
BIN
util-linux-2.40.2.tar.xz
(Stored with Git LFS)
Normal file
BIN
util-linux-2.40.2.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
16
util-linux-2.40.4.tar.sign
Normal file
16
util-linux-2.40.4.tar.sign
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEsMZNFDAcxu+u32Dk5LcdXuw5woQFAmeFCjYACgkQ5LcdXuw5
|
||||
woQOfw//e1E0K/KQutqIhO4bl+gnpmq8lTP/2Bn3eCrrpoyM5V+FTh/gxVUbsU6H
|
||||
uTUw7LZVAb1Ihwp6j3XnkqjzhOQ5yBe6iv2H5pfYQS6mSemIuIBoMd9PyCvNgh90
|
||||
mW4jC6WnSdaH71QW9lAPPjog45v6WXR/8UwhTGf/0tKkxurwUyyIaAktG5FtGnlW
|
||||
xVQ4tOyqAgcGdTtNFrD3pgO3rydYZIo/JMwL0mTpfcgzgbKZ1aJVx1J2mdRVZ5N9
|
||||
MMLU6/6qAmxEy8EUb2AmlTCFjXNC2J7eRZGvRF1WzNbFBh6cShl/825OY/9Kvmzv
|
||||
IWIfuFBvyLa6VPEDDw2U0dtrHXXGeSs7ACSKE+0aMDTrznPy6WuA4XRFIm5AuOt3
|
||||
Gb/95ZK4udrijg5cquMZMzs5yFCiDNGYpwMWMAwHglNfPtwSKZ6tno0k1YrE/Y0P
|
||||
9+dq2rjjpREHO5itFigLAJQVHVop3rp8EfRLONgXy4Sh/j7mUjjACE4DWwzBsJEQ
|
||||
fEwTbb91oHJ2WtiTj3P2nOyVUMOv9PX3p8V/V0RXQcLe7gfCa198evEcA5Swcihm
|
||||
aym4FE58Trr7FBRyQcRuU5B74i7VW5a+22yLpvG0l0jL8Aer8iAaG86yJjogTUHi
|
||||
uQJKHnc2ZBtBB8XKht1KsqMs/5qlo6aoalo+bR9cewuoAJZNoa8=
|
||||
=gB1/
|
||||
-----END PGP SIGNATURE-----
|
3
util-linux-2.40.4.tar.xz
Normal file
3
util-linux-2.40.4.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5c1daf733b04e9859afdc3bd87cc481180ee0f88b5c0946b16fdec931975fb79
|
||||
size 8848216
|
44
util-linux-agetty-prevent-cursor-escape.patch
Normal file
44
util-linux-agetty-prevent-cursor-escape.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 20b405c0fea29675e1fb54b894eb1c18459f9d50 Mon Sep 17 00:00:00 2001
|
||||
From: Stanislav Brabec <sbrabec@suse.cz>
|
||||
Date: Sun, 21 Jul 2024 15:01:42 +0200
|
||||
Subject: [PATCH] agetty: Prevent cursor escape
|
||||
|
||||
Starting with 5de97519, it is possible to escape the login dialog on the
|
||||
screen by arrow characters or using escape sequences.
|
||||
|
||||
Since full processing of escape sequences and ignore them would be
|
||||
complicated, use a work around: instead of sending ESC to output, send a
|
||||
printable character.
|
||||
|
||||
It could cause a rendering regression in a very obscure condition: compiled
|
||||
without IUTF8, encoding is ISO-11548-1 and BRAILLE PATTERN DOTS-1245 is
|
||||
part of login name. I believe that it is out of supported combinations.
|
||||
|
||||
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
|
||||
---
|
||||
term-utils/agetty.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
|
||||
index b28b197ff..500e0992f 100644
|
||||
--- a/term-utils/agetty.c
|
||||
+++ b/term-utils/agetty.c
|
||||
@@ -2289,7 +2289,14 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t
|
||||
if ((size_t)(bp - logname) >= sizeof(logname) - 1)
|
||||
log_err(_("%s: input overrun"), op->tty);
|
||||
if ((tp->c_lflag & ECHO) == 0)
|
||||
- write_all(1, &c, 1); /* echo the character */
|
||||
+ /* Visualize escape sequence instead of its execution */
|
||||
+ if (ascval == CTL('['))
|
||||
+ /* Ideally it should be "\xe2\x90\x9b"
|
||||
+ * if (op->flags & (F_UTF8)),
|
||||
+ * but only some fonts contain it */
|
||||
+ write_all(1, "^[", 2);
|
||||
+ else
|
||||
+ write_all(1, &c, 1); /* echo the character */
|
||||
*bp++ = ascval; /* and store it */
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
21
util-linux-bash-completion-su-chsh-l.patch
Normal file
21
util-linux-bash-completion-su-chsh-l.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From: Stanislav Brabec <sbrabec@suse.com>
|
||||
Date: 2022-03-03 03:22:45+0000
|
||||
References: bugzilla.suse.com/1172427
|
||||
Subject: Fix "su -s" bash completion.
|
||||
|
||||
su -s <TAB> completion depends on "chsh -l" present in the
|
||||
util-linux implementation of chsh. But SUSE uses chsh from shadow
|
||||
package that does not include this feature. Use /etc/shells
|
||||
instead.
|
||||
|
||||
--- util-linux/bash-completion/su
|
||||
+++ util-linux/bash-completion/su
|
||||
@@ -14,7 +14,7 @@ _su_module()
|
||||
return 0
|
||||
;;
|
||||
'-s'|'--shell')
|
||||
- COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
|
||||
+ COMPREPLY=( $(compgen -W "$(</etc/shells)" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
'-h'|'--help'|'-V'|'--version')
|
58
util-linux-login_defs-check.sh
Normal file
58
util-linux-login_defs-check.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Extract list of variables supported by su/runuser.
|
||||
#
|
||||
# If you edit this file, you will probably need to edit
|
||||
# shadow-login_defs-check.sh from shadow sources in a similar way.
|
||||
|
||||
set -o errexit
|
||||
|
||||
echo -n "Checking login.defs variables in util-linux... " >&2
|
||||
(
|
||||
grep -rh getlogindefs . |
|
||||
sed -n 's/^.*getlogindefs[a-z_]*("\([A-Z0-9_]*\)".*$/\1/p'
|
||||
grep -rh logindefs_setenv . |
|
||||
sed -n 's/^.*logindefs_setenv*("[A-Z0-9_]*", "\([A-Z0-9_]*\)".*$/\1/p'
|
||||
) | LC_ALL=C sort -u >util-linux-login_defs-vars.lst
|
||||
|
||||
if test $(sha1sum util-linux-login_defs-vars.lst | sed 's/ .*$//') != 8516ca34e059b2dee1d4421a3ab07e88331b1674 ; then
|
||||
|
||||
echo "does not match!" >&2
|
||||
echo "Checksum is: $(sha1sum util-linux-login_defs-vars.lst | sed 's/ .*$//')" >&2
|
||||
|
||||
cat >&2 <<EOF
|
||||
|
||||
You have to perform following steps:
|
||||
|
||||
Check whether the error is false positive (script failed to extract
|
||||
variables) or true positive (variable list changed).
|
||||
|
||||
If it is false positive:
|
||||
- Fix this script.
|
||||
- The same fix is needed in shadow package in shadow-login_defs-check.sh.
|
||||
|
||||
If it is true positive:
|
||||
- Check-out shadow package and call shadow-login_defs-check.sh.
|
||||
- Compare its output shadow-login_defs-check-util-linux.lst with
|
||||
util-linux-login_defs-vars.lst in the util-linux build directory.
|
||||
- Update shadow shadow-login_defs-util-linux.patch, if needed.
|
||||
- If shadow-login_defs-util-linux.patch was updated, update
|
||||
login_defs-support-for-util-linux symbol version in both shadow and
|
||||
util-linux spec files accordingly.
|
||||
- Update checksum in this script.
|
||||
- Possibly update su.default with these new list of su/runuser specific
|
||||
variables:
|
||||
EOF
|
||||
echo -n " " >&2
|
||||
(
|
||||
grep -rh getlogindefs login-utils/su-common.c |
|
||||
sed -n 's/^.*getlogindefs[a-z_]*("\([A-Z0-9_]*\)".*$/\1/p'
|
||||
grep -rh logindefs_setenv login-utils/su-common.c |
|
||||
sed -n 's/^.*logindefs_setenv*("[A-Z0-9_]*", "\([A-Z0-9_]*\)".*$/\1/p'
|
||||
) | LC_ALL=C sort -u | tr '\n' ' ' | sed 's/ /, /g;s/, $//' >&2
|
||||
echo -e '\n' >&2
|
||||
|
||||
exit 1
|
||||
else
|
||||
echo "OK" >&2
|
||||
fi
|
158
util-linux-lscpu-skip-aarch64-decode.patch
Normal file
158
util-linux-lscpu-skip-aarch64-decode.patch
Normal file
@ -0,0 +1,158 @@
|
||||
From 50a3efab6d126b28fcdcc28f1a0cd5cd596ae357 Mon Sep 17 00:00:00 2001
|
||||
From: "Pratik R. Sampat" <pratikrajesh.sampat@amd.com>
|
||||
Date: Mon, 22 Jul 2024 16:00:46 +0000
|
||||
Subject: [PATCH] lscpu: Skip aarch64 decode path for rest of the architectures
|
||||
|
||||
lscpu behaves differently when run sudo vs non-sudo on AMD architectures.
|
||||
|
||||
On sudo runs, it adds a BIOS model name and BIOS CPU family which it
|
||||
does not add for the latter. However since this parsing from the DMI is
|
||||
primarily catered to aarch64, for AMD platform the BIOS model name is
|
||||
printed out as follows "AMD XXX Processor *Unknown* CPU @ X.XGHz" due
|
||||
to the part number is not populated on the platform.
|
||||
|
||||
The issue boils down to an unconditional call to arm_decode() which
|
||||
attempts to read the DMI path and populate the processor information
|
||||
such as processor version and part number which is set to Unknown on AMD
|
||||
CPUs.
|
||||
|
||||
81d6de9 (lscpu: remove the old code) changed the DMI path from
|
||||
/sys/firmware/dmi/entries/4-0/raw (non-existent) to
|
||||
/sys/firmware/dmi/tables/dmi (existent) which has brought this latent
|
||||
issue to light as DMI was starting to be parsed incorrectly.
|
||||
|
||||
Therefore, do not perform aarch64 parsing for other architectures.
|
||||
|
||||
Before
|
||||
------
|
||||
$ lscpu
|
||||
Vendor ID: AuthenticAMD
|
||||
Model name: AMD EPYC XXXX X-Core Processor
|
||||
CPU family: 26
|
||||
|
||||
$ sudo lscpu
|
||||
Vendor ID: AuthenticAMD
|
||||
BIOS Vendor ID: Advanced Micro Devices, Inc.
|
||||
Model name: AMD EPYC XXXX X-Core Processor
|
||||
BIOS Model name: AMD EPYC XXXX X-Core Processor Unknown CPU @ X.XGHz
|
||||
BIOS CPU family: 107
|
||||
CPU family: 26
|
||||
|
||||
After
|
||||
-----
|
||||
$ lscpu
|
||||
Vendor ID: AuthenticAMD
|
||||
Model name: AMD EPYC XXXX X-Core Processor
|
||||
CPU family: 26
|
||||
|
||||
$ sudo lscpu
|
||||
Vendor ID: AuthenticAMD
|
||||
Model name: AMD EPYC XXXX X-Core Processor
|
||||
CPU family: 26
|
||||
|
||||
Fixes: 81d6de9 ("lscpu: remove the old code")
|
||||
Co-developed-by: Karel Zak <kzak@redhat.com>
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
Signed-off-by: Pratik R. Sampat <pratikrajesh.sampat@amd.com>
|
||||
---
|
||||
sys-utils/lscpu-arm.c | 37 ++++++++++++++++++++++++++++++++++++-
|
||||
sys-utils/lscpu.c | 3 ++-
|
||||
sys-utils/lscpu.h | 2 ++
|
||||
3 files changed, 40 insertions(+), 2 deletions(-)
|
||||
|
||||
Contains parts of:
|
||||
commit 5d1129e6879a05aa9ac5804ffc8ace22cda735c1
|
||||
Author: Karel Zak <kzak@redhat.com>
|
||||
Date: Mon Jul 29 10:21:28 2024 +0200
|
||||
|
||||
Index: util-linux-2.39.3/sys-utils/lscpu-arm.c
|
||||
===================================================================
|
||||
--- util-linux-2.39.3.orig/sys-utils/lscpu-arm.c
|
||||
+++ util-linux-2.39.3/sys-utils/lscpu-arm.c
|
||||
@@ -332,14 +332,49 @@ static int parse_id(const char *str)
|
||||
|
||||
#define parse_model_id(_cxt) (parse_id((_cxt)->model))
|
||||
|
||||
+static inline int get_implementer_id(struct lscpu_cputype *ct)
|
||||
+{
|
||||
+ if (ct->vendor_id)
|
||||
+ return ct->vendor_id;
|
||||
+ return parse_id(ct->vendor);
|
||||
+}
|
||||
+
|
||||
static inline int parse_implementer_id(struct lscpu_cputype *ct)
|
||||
{
|
||||
+ int id;
|
||||
+
|
||||
if (ct->vendor_id)
|
||||
return ct->vendor_id;
|
||||
- ct->vendor_id = parse_id(ct->vendor);
|
||||
+ id = get_implementer_id(ct);
|
||||
+ if (id <= 0)
|
||||
+ return id;
|
||||
+
|
||||
+ ct->vendor_id = id;
|
||||
return ct->vendor_id;
|
||||
}
|
||||
|
||||
+int is_arm(struct lscpu_cxt *cxt)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ if (is_live(cxt))
|
||||
+ return strcmp(cxt->arch->name, "aarch64") == 0;
|
||||
+
|
||||
+ /* dump; assume ARM if vendor ID is known */
|
||||
+ for (i = 0; i < cxt->ncputypes; i++) {
|
||||
+
|
||||
+ int j, id = get_implementer_id(cxt->cputypes[i]);
|
||||
+ if (id <= 0)
|
||||
+ continue;
|
||||
+ for (j = 0; hw_implementer[j].id != -1; j++) {
|
||||
+ if (hw_implementer[j].id == id)
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Use model and vendor IDs to decode to human readable names.
|
||||
*/
|
||||
Index: util-linux-2.39.3/sys-utils/lscpu.c
|
||||
===================================================================
|
||||
--- util-linux-2.39.3.orig/sys-utils/lscpu.c
|
||||
+++ util-linux-2.39.3/sys-utils/lscpu.c
|
||||
@@ -1371,7 +1371,8 @@ int main(int argc, char *argv[])
|
||||
lscpu_read_numas(cxt);
|
||||
lscpu_read_topology(cxt);
|
||||
|
||||
- lscpu_decode_arm(cxt);
|
||||
+ if (is_arm(cxt))
|
||||
+ lscpu_decode_arm(cxt);
|
||||
|
||||
cxt->virt = lscpu_read_virtualization(cxt);
|
||||
|
||||
Index: util-linux-2.39.3/sys-utils/lscpu.h
|
||||
===================================================================
|
||||
--- util-linux-2.39.3.orig/sys-utils/lscpu.h
|
||||
+++ util-linux-2.39.3/sys-utils/lscpu.h
|
||||
@@ -252,6 +252,8 @@ struct lscpu_cxt {
|
||||
int is_cluster; /* For aarch64 if the machine doesn't have ACPI PPTT */
|
||||
};
|
||||
|
||||
+#define is_live(_cxt) (!(_cxt)->noalive)
|
||||
+
|
||||
#define is_cpu_online(_cxt, _cpu) \
|
||||
((_cxt) && (_cpu) && (_cxt)->online && \
|
||||
CPU_ISSET_S((_cpu)->logical_id, (_cxt)->setsize, (_cxt)->online))
|
||||
@@ -260,6 +262,8 @@ struct lscpu_cxt {
|
||||
((_cxt) && (_cpu) && (_cxt)->present && \
|
||||
CPU_ISSET_S((_cpu)->logical_id, (_cxt)->setsize, (_cxt)->present))
|
||||
|
||||
+int is_arm(struct lscpu_cxt *cxt);
|
||||
+
|
||||
struct lscpu_cputype *lscpu_new_cputype(void);
|
||||
void lscpu_ref_cputype(struct lscpu_cputype *ct);
|
||||
void lscpu_unref_cputype(struct lscpu_cputype *ct);
|
7
util-linux-rpmlintrc
Normal file
7
util-linux-rpmlintrc
Normal file
@ -0,0 +1,7 @@
|
||||
# False positives. Libraries outside LD_LIBRARY_PATH use RPATH to find libraries, not ldconfig.
|
||||
addFilter("library-without-ldconfig-postin /usr/libexec/build/staging/.*")
|
||||
addFilter("library-without-ldconfig-postun /usr/libexec/build/staging/.*")
|
||||
# Not applicable for multi flavor build.
|
||||
addFilter("invalid-spec-name")
|
||||
# Not important, and it simplifies packaging.
|
||||
addFilter("non-etc-or-var-file-marked-as-conffile /usr/libexec/build/staging/.*")
|
22
util-linux-umount-losetup-lazy-destruction-generated.patch
Normal file
22
util-linux-umount-losetup-lazy-destruction-generated.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- util-linux-2.39.3/sys-utils/umount.8 2023-12-04 20:34:55.708989211 +0100
|
||||
+++ util-linux-2.39.3.patched/sys-utils/umount.8 2024-08-01 19:46:58.227874568 +0200
|
||||
@@ -156,6 +156,8 @@
|
||||
The \fBumount\fP command will automatically detach loop device previously initialized by \fBmount\fP(8) command independently of \fI/etc/mtab\fP.
|
||||
.sp
|
||||
In this case the device is initialized with "autoclear" flag (see \fBlosetup\fP(8) output for more details), otherwise it\(cqs necessary to use the option \fB\-\-detach\-loop\fP or call \fBlosetup \-d\fP \fIdevice\fP. The autoclear feature is supported since Linux 2.6.25.
|
||||
+.sp
|
||||
+Note that since Linux v3.7 kernel uses "lazy device destruction". The system just marks the loop device by autoclear flag and destroys it later. If you need to wait for a complete removal of the loop device, call \fBudevadm settle\fP after \fBumount\fP.
|
||||
.SH "EXTERNAL HELPERS"
|
||||
.sp
|
||||
The syntax of external unmount helpers is:
|
||||
--- util-linux-2.39.3/sys-utils/losetup.8 2023-12-04 20:34:54.926993943 +0100
|
||||
+++ util-linux-2.39.3.patched/sys-utils/losetup.8 2024-08-01 19:37:02.084188151 +0200
|
||||
@@ -74,7 +74,7 @@
|
||||
.sp
|
||||
\fB\-d\fP, \fB\-\-detach\fP \fIloopdev\fP...
|
||||
.RS 4
|
||||
-Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return \fBEBUSY\fP error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later.
|
||||
+Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return \fBEBUSY\fP error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later. Even if the device is not used, the loop device can be destroyed later. If you need to wait for a complete removal of the loop device, call \fBudevadm settle\fP after \fBlosetup\fP.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-D\fP, \fB\-\-detach\-all\fP
|
41
util-linux-umount-losetup-lazy-destruction.patch
Normal file
41
util-linux-umount-losetup-lazy-destruction.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From fc67f18be51f57ee9a59a0f8f7ad16f284a24a3e Mon Sep 17 00:00:00 2001
|
||||
From: Stanislav Brabec <sbrabec@suse.cz>
|
||||
Date: Wed, 19 Jun 2024 17:31:34 +0200
|
||||
Subject: [PATCH] umount, losetup: Document loop destroy behavior
|
||||
|
||||
The loop device detach runs asynchronously in the background. It can cause
|
||||
unexpected errors. Document the possible existence of the loop device after
|
||||
exit of losetup -d or umount and need of "udevadm settle".
|
||||
|
||||
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
|
||||
---
|
||||
sys-utils/losetup.8.adoc | 2 +-
|
||||
sys-utils/umount.8.adoc | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: util-linux-2.39.3/sys-utils/losetup.8.adoc
|
||||
===================================================================
|
||||
--- util-linux-2.39.3.orig/sys-utils/losetup.8.adoc
|
||||
+++ util-linux-2.39.3/sys-utils/losetup.8.adoc
|
||||
@@ -54,7 +54,7 @@ The _size_ and _offset_ arguments may be
|
||||
Show the status of all loop devices. Note that not all information is accessible for non-root users. See also *--list*. The old output format (as printed without *--list*) is deprecated.
|
||||
|
||||
*-d*, *--detach* _loopdev_...::
|
||||
-Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return *EBUSY* error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later.
|
||||
+Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return *EBUSY* error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later. Even if the device is not used, the loop device can be destroyed later. If you need to wait for a complete removal of the loop device, call *udevadm settle* after *losetup*.
|
||||
|
||||
*-D*, *--detach-all*::
|
||||
Detach all associated loop devices.
|
||||
Index: util-linux-2.39.3/sys-utils/umount.8.adoc
|
||||
===================================================================
|
||||
--- util-linux-2.39.3.orig/sys-utils/umount.8.adoc
|
||||
+++ util-linux-2.39.3/sys-utils/umount.8.adoc
|
||||
@@ -127,6 +127,8 @@ The *umount* command will automatically
|
||||
|
||||
In this case the device is initialized with "autoclear" flag (see *losetup*(8) output for more details), otherwise it's necessary to use the option *--detach-loop* or call *losetup -d* _device_. The autoclear feature is supported since Linux 2.6.25.
|
||||
|
||||
+Note that since Linux v3.7 kernel uses "lazy device destruction". The system just marks the loop device by autoclear flag and destroys it later. If you need to wait for a complete removal of the loop device, call *udevadm settle* after *umount*.
|
||||
+
|
||||
== EXTERNAL HELPERS
|
||||
|
||||
The syntax of external unmount helpers is:
|
6048
util-linux.changes
Normal file
6048
util-linux.changes
Normal file
File diff suppressed because it is too large
Load Diff
58
util-linux.keyring
Normal file
58
util-linux.keyring
Normal file
@ -0,0 +1,58 @@
|
||||
pub rsa4096 2011-10-10 [SC] [expires: 2033-05-14]
|
||||
B0C64D14301CC6EFAEDF60E4E4B71D5EEC39C284
|
||||
uid [ unknown] Karel Zak <kzak@redhat.com>
|
||||
sub rsa4096 2011-10-10 [E] [expires: 2033-05-14]
|
||||
FC0214B4E2D01655F5898228ED846C667BA16CAC
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBE6StA4BEACp9++Y+DgbBloJEuVhsDjDIvAR1n/aHPDyPQQzg/DkKtR3BXHn
|
||||
dGfTL9/DR8y9YzLNwUf2lWsEAvwHZ2XfUTp5S5nVbgpAB0/Q2ebP0TnkNYaRkxq7
|
||||
VJF+kvUcA6hxYKYcIos2kJyfVytPE6FpFBqlgTmjcCTx4HHwePkVTVRyotOoA2V/
|
||||
UUwixgkyG7aVfy4QBKHAkATpTPC4l+ISaOHKUiajxRoa99rpmBPl4FhIw3b5rPYA
|
||||
26q9Pz8q1AwbXA1PXxzwKVqqfwEkl6sxUVKiM8rUuhic2lnDMIXexNMvqznpFqtB
|
||||
v7n+z/5N8RbB1DQjWpy/Z7OW6yyYXW9e33c6IgU5n46rIyTPYyzq3mDfOsJdvoG/
|
||||
nhF7VUkGDPYWfmx9ejvpKdoNCQ2q+MVp20msntcETcOq1r9SJwNXcsx+I/3ptbtX
|
||||
Q+MQyA1L5FifkpA7+akITF5luOqUb2TToEBLiF/nn8y0sIUa/HGgcUrK2N9E1VNJ
|
||||
tcIt/z0sZJUHYC+EBh/G0UNt9tRwPdnUks5sua1sCquXnkd9IS0Kr3Kq/C6JOKzz
|
||||
UDGdFKVc6wExf70hX5h0g1kkypyjNwipGSdk+qVXO0IF/tKMToa8WZqoK3enzryI
|
||||
Kmdq7IQ0ThdTTTC1ctVk4367/30prpNHF4/642G0OOiQCzWBrb0V217HvQARAQAB
|
||||
tBtLYXJlbCBaYWsgPGt6YWtAcmVkaGF0LmNvbT6JAlUEEwEIAD8CGwMGCwkIBwMC
|
||||
BhUIAgkKCwQWAgMBAh4BAheAFiEEsMZNFDAcxu+u32Dk5LcdXuw5woQFAmRkpsEF
|
||||
CSid9bMACgkQ5LcdXuw5woSvFA/+LYBDPSubYZF4lS8lNlWwRNe1gP9VrCkaF5mb
|
||||
Psx7cV8eHQICR/QJD7WDSIHlnfaBCmNelwGRc76PB23Huvq8xwvTYiQDWdqIN4Vl
|
||||
gDLqSganq53poN1BNBFRP6ubsdGjHlSYH+ygf8XXL/h+/b9Ud61eb43XQ5sUhFQU
|
||||
kEZEiJ26rCwOQWnlyJBMzo0axwW55qKoMmNjcwtRrB5kW7QDZ8BHVZiEqVrjJxQh
|
||||
0NpwrjlFdRZ8Ak+/3Iz1UOIJl+p0+5sjx6iY7Xy7oKP28msdLcqRy/o58A+IHGQ1
|
||||
Y5DeeosNkatnT9+7TQdAxJdJzuLpH9WTmXyIoG1DP8p2A2fjvLpYMEomWKYBb6ci
|
||||
1MZaI1Kdw9BX3xfaI0OhRDArLN0Nu630jTLafwf+jv8OtNEtb2BnbHWIrQw0rRc7
|
||||
877VRu7wmyTroj5IJthuEVr+NWw9RqCMljO/SDoR3GzE+2xSvKQlZU//vIBdHiVV
|
||||
u4IbKhHlYELFMiqmNWoqlTFwstpP+TgYYtwf0Xuhv/1Y7PezI8Zvp8/pjYwmjCg6
|
||||
CdtTZMSonFBmMuA5hA/5Eg2KEwplHUfz/XgCe4wNv21tnvUY7QuHU2ZvlInEFACM
|
||||
/4L1cIz7/PmQke7z7WvXP0d2pCMtfTra0RqH1nneNgq0VAhGnyI5qpK+n+hSYTqV
|
||||
3VQNNQi5Ag0ETpK0DgEQAMbkeKd3rViqhdcei2tok7Z6Ow+LLcHFJlNB634gk7m3
|
||||
JRFJdUi/5m5X8wFFL/zx+QEvacekrlsG0lPXUPZkRKbOJlYaAy1lFXi9rd+HcZox
|
||||
5V2LmlemY9mnh8FzrQXeIIp93VXz/VrPCJxm12FOmGRzo7sRMKvbjQ6smg6C+KVu
|
||||
m/xa5XCGN8Q4vYPAohMrq3NtrVVJxeJ6EOGFOyw/XhFCIf85wwW6IcIcl4dA4f2S
|
||||
7h/OpPb+XHFKjiQxYpHZWyVbXt/dmvdm+tuL9vxQT/dP9GyhpCfaaX0F8OIyA3BP
|
||||
iXYguUTselkx8PZYA/qK0YeiVx1uE1qPEAwd0/m3rjNJ3AqYHwBu4ijudswq4kyI
|
||||
92Q5L/zHdgdGV7hYQR5FZMRyrLOqQyowKoovFzhIK5Iy/6KeAOsev53m6y4yVCNP
|
||||
xzvU8iKmX06kzwmSXwIjZOhUXbTCKNg6h/hP+OM5tiJmTUpyqoqFDMxcSEoK32Er
|
||||
kBooyrkGK5uVL9DkRenNxGBWYb5Iwd2FQ0s3uCKUXHn3f0S/7fpM0T9/rqv1qIX5
|
||||
ZuIjVXUkazQthXIXPCYUwKBBSyfKrIBE1EScvKx0sT3w8NI7YRLG70E7uRO+U/Sr
|
||||
mn4wpCJiP+znBKpfDwQMJIEf27T8VCKDJXRr4nvRZlk2l2LnCr6pVnXosQ1B3G0r
|
||||
ABEBAAGJAjwEGAEIACYCGwwWIQSwxk0UMBzG767fYOTktx1e7DnChAUCZGSnpQUJ
|
||||
KJ32lwAKCRDktx1e7DnChJ0gD/wOsq5mWpoSvBmhI/Xa4WOl2D9ltYYJxrQpdTd+
|
||||
IhUuQUCZle/z6dSO2jsrpcvnwn3OHBQguvX8vzBr2qFeQDjrAbZ4V76teY2Zg+5o
|
||||
HFy21TlCFrNeFLrk4m8PyCrfQVoQ55ESLPUBp0qK5VLzKjFAHD7+Z90bEie6IGUc
|
||||
rJyUokTNc7hSWsQk96rAENE6cxCgsEGZhtsS41iBZ4lkhkaVfpPj/yxiiOFw101N
|
||||
G1PXq+EAJ6iaIvBbNiy+AI9EFVAkX6uMM8INely0HAn/H3/hc/xADiUFolPiIEwK
|
||||
E04L/8KHVH5vn007kUeMD4DecvL+8XYyT18+jH/Hvpai610uWwfBP50HoKa9A8JD
|
||||
ppBZaqBGzeNvCMUWU6rxyLoNOeJduUwFTh3mUesBoF7Iqdpe1CphuUlOKWUYY6Jq
|
||||
ZEZ7oQN630z0QsLzr6YZinnnfMbO9xNktfJPBMju6UPmOHfYI/zJFRe5VTqvG8w3
|
||||
SxJVriqs75jFpGqSC/a7IcW3j2FeVQ66sAcik4XRA9JO7SpsTJtebAw0tQ8nIkIj
|
||||
ekmNJnNAlIKOnisKca9QRzuUn5HNPl8UDeN9KjxsFkmDMEkRSuijpLEFe+66bkjP
|
||||
NdEeAGQJbiXWb1z9vHHQpDPKMXhK18D5PBnLDIl8iFnpDE+M088Xnavf9eYapj2k
|
||||
Zh9rvA==
|
||||
=cevX
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
1784
util-linux.spec
Normal file
1784
util-linux.spec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user