builds and runs on intel-x86 and rpi4 with acceptable realtime performance

This commit is contained in:
vaughn committed 2026-09-25 17:29:14 -04:00
1 parent 2bce6fa556
commit 3faf544f0b
120 files changed
+6317 -1

No files matched your search

@@ -0,0 +1,31 @@
From 232757d8dc40384db38281bd2d0f99f1d94ddd9e Mon Sep 17 00:00:00 2001
From: Yi Zhao <yi.zhao@windriver.com>
Date: Thu, 26 Dec 2024 15:31:15 +0800
Subject: [PATCH] modules/pam_postgresok: change uid to 28
The default uid for postgres user is 28 in meta-oe rather than 26 in
redhat linux.
Upstream-Status: Inappropriate [WRLinux Specific]
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
modules/pam_postgresok/pam_postgresok.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/pam_postgresok/pam_postgresok.c b/modules/pam_postgresok/pam_postgresok.c
index 0961b72..786a233 100644
--- a/modules/pam_postgresok/pam_postgresok.c
+++ b/modules/pam_postgresok/pam_postgresok.c
@@ -69,7 +69,7 @@ int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc
uid = getuid();
pw = pam_modutil_getpwuid(pamh, uid);
- if ((uid == 26) && (pw != NULL) && (strcmp(pw->pw_name, "postgres") == 0))
+ if ((uid == 28) && (pw != NULL) && (strcmp(pw->pw_name, "postgres") == 0))
retval = PAM_SUCCESS;
if (ctrl & PAM_DEBUG_ARG) {
--
2.25.1
@@ -0,0 +1,130 @@
From aa752cb9d30072912dd3b5d51a86ab2fe6f08970 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Mon, 11 Jan 2021 15:40:21 +0800
Subject: [PATCH] pam_faillock: add option to accept uid as argument
Add options '--uid' for command pam_faillock to accept uid as argument.
Upstream-Status: Submitted [https://github.com/linux-pam/linux-pam/pull/595]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
modules/pam_faillock/main.c | 62 ++++++++++++++++++++++++++++++++++---
1 file changed, 58 insertions(+), 4 deletions(-)
diff --git a/modules/pam_faillock/main.c b/modules/pam_faillock/main.c
index c6dd19c..ff0e647 100644
--- a/modules/pam_faillock/main.c
+++ b/modules/pam_faillock/main.c
@@ -56,10 +56,29 @@
#include "faillock.h"
#include "faillock_config.h"
+static int get_uid (const char *uidstr, uid_t *uid)
+{
+ long long int val;
+ char *endptr;
+
+ errno = 0;
+ val = strtoll (uidstr, &endptr, 10);
+ if ( ('\0' == *uidstr)
+ || ('\0' != *endptr)
+ || (ERANGE == errno)
+ || (val != (uid_t)val)) {
+ return 0;
+ }
+
+ *uid = (uid_t)val;
+ return 1;
+}
+
static int
args_parse(int argc, char **argv, struct options *opts)
{
int i;
+ int cline_user = 0;
int rv;
const char *dir = NULL;
const char *conf = NULL;
@@ -67,6 +86,7 @@ args_parse(int argc, char **argv, struct options *opts)
memset(opts, 0, sizeof(*opts));
opts->progname = argv[0];
+ opts->uid = (uid_t)-1;
for (i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--conf") == 0) {
@@ -94,6 +114,24 @@ args_parse(int argc, char **argv, struct options *opts)
return -1;
}
opts->user = argv[i];
+ cline_user++;
+ }
+ else if (strcmp(argv[i], "--uid") == 0) {
+ ++i;
+ if(i >= argc || strlen(argv[i]) == 0) {
+ fprintf(stderr, "%s: No user id supplied.\n", argv[0]);
+ return -1;
+ }
+ uid_t user_id = (uid_t)-1;
+ if ( (get_uid (argv[i], &user_id) ==0)
+ || (user_id == (uid_t)-1)) {
+ fprintf (stderr,
+ _("%s: invalid user ID '%s'\n"),
+ argv[0], argv[i]);
+ return -1;
+ }
+ opts->uid = user_id;
+ cline_user++;
}
else if (strcmp(argv[i], "--reset") == 0) {
opts->reset = 1;
@@ -121,6 +159,10 @@ args_parse(int argc, char **argv, struct options *opts)
}
}
+ if (cline_user > 1) {
+ fprintf(stderr, "--user and --uid are mutually exclusive options!\n");
+ return -1;
+ }
return 0;
}
@@ -129,8 +171,8 @@ usage(const char *progname)
{
fprintf(stderr,
_("Usage: %s [--dir /path/to/tally-directory]"
- " [--user username] [--reset] [--legacy-output]\n"), progname);
-
+ " [--user username] [--uid userid] [--reset] [--legacy-output]\n"), progname);
+ fprintf(stderr, "NOTE: --user and --uid are mutually exclusive options, userid must be non-negative.\n");
}
static int
@@ -323,9 +365,21 @@ main (int argc, char *argv[])
return 1;
}
- if (opts.user == NULL) {
+ if (opts.user == NULL && opts.uid == (uid_t)-1) {
return do_allusers(&opts);
}
- return do_user(&opts, opts.user);
+ if (opts.user != NULL) {
+ return do_user(&opts, opts.user);
+ }
+ else {
+ errno = 0;
+ struct passwd *pwd = getpwuid(opts.uid);
+ if (pwd) {
+ return do_user(&opts, pwd->pw_name);
+ }
+ else {
+ fprintf(stderr, "%s: No matching passwd found, errno: %d\n", opts.progname, errno);
+ }
+ }
}
--
2.25.1
@@ -0,0 +1,20 @@
Upstream-Status: Inappropriate [WRLinux Specific]
diff --git a/modules/meson.build b/modules/meson.build
index 68a7a63..cbe5c8a 100644
--- a/modules/meson.build
+++ b/modules/meson.build
@@ -1,5 +1,6 @@
subdir('pam_access')
subdir('pam_canonicalize_user')
+subdir('pam_chroot')
subdir('pam_debug')
subdir('pam_deny')
subdir('pam_echo')
@@ -23,6 +24,7 @@ subdir('pam_motd')
subdir('pam_namespace')
subdir('pam_nologin')
subdir('pam_permit')
+subdir('pam_postgresok')
subdir('pam_pwhistory')
subdir('pam_rhosts')
subdir('pam_rootok')
+4
View File
@@ -0,0 +1,4 @@
# This file is generated automatically by wry
LIBPAM_INC_WRLINUX = ""
LIBPAM_INC_WRLINUX = "libpam_wrlinux.inc"
require ${LIBPAM_INC_WRLINUX}
+68
View File
@@ -0,0 +1,68 @@
#
# Add a few "redhat" modules to pam. Some have been accepted upstream and
# are part of the distribution, but not the three we add here.
#
PAM_PV = "1.3.1"
PAM_SRCREV = "ac815ddc575d8fe4762352e4f78adf0179f3bf5780d2e5da27f52ffc0157f0c2985726efb4ff3a31ceb42071afddb9c9cd72c0ce79699ae40f9633b927c808f2"
FILESEXTRAPATHS:prepend := "${THISDIR}/libpam:"
SRC_URI += "https://src.fedoraproject.org/repo/pkgs/pam/pam-redhat-${PAM_PV}.tar.xz/sha512/${PAM_SRCREV}/pam-redhat-${PAM_PV}.tar.xz;name=redhat \
file://wrlinux-redhat-pam-modules.patch \
file://0002-modules-pam_postgresok-change-uid-to-28.patch \
${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'file://pam_faillock_add_uid.patch', '', d)} \
"
SRC_URI[redhat.sha256sum] = "894213fafbb557d40fba28dcc66f557fa0b4bf0ab32b0e4931b1d2be47e381fc"
# If necessary, move pam-redhat modules to where they will be built.
# We create a local function and use sh.
#
do_lcl_rh_move () {
SAVED_PWD=`pwd`; cd ${S}
if [ ! -e modules/pam_chroot ] ; then
mv ${UNPACKDIR}/pam-redhat-${PAM_PV}/* modules/
fi
cd ${SAVED_PWD}
}
# Now, we define our own do_patch. We rely on the fact
# that the default do_patch just invokes patch_do_patch.
#
python do_patch () {
bb.build.exec_func('do_lcl_rh_move', d)
bb.build.exec_func('patch_do_patch', d)
}
do_install:append() {
if ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'true', 'false', d)}; then
sed -i '/end of pam-auth-update config/i \
# faillock is required to reset the fail count on success\
account required pam_faillock.so' \
${D}${sysconfdir}/pam.d/common-account
sed -i '/pam_unix.so/i \
auth required pam_faillock.so preauth deny=5 even_deny_root unlock_time=60' \
${D}${sysconfdir}/pam.d/common-auth
sed -i '/pam_unix.so/a \
auth [default=die] pam_faillock.so authfail deny=5 even_deny_root unlock_time=60 \
auth sufficient pam_faillock.so authsucc deny=5 even_deny_root unlock_time=60' \
${D}${sysconfdir}/pam.d/common-auth
fi
if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','false','true',d)}; then
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/console 0755 root root - -" >> ${D}${sysconfdir}/tmpfiles.d/pam.conf
if ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'true', 'false', d)}; then
echo "d /run/faillock 0755 root root - -" >> ${D}${sysconfdir}/tmpfiles.d/pam.conf
fi
else
echo "d root root 0755 /var/run/console none" >> ${D}${sysconfdir}/default/volatiles/99_pam
if ${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'true', 'false', d)}; then
echo "d root root 0755 /var/run/faillock none" >> ${D}${sysconfdir}/default/volatiles/99_pam
fi
fi
}
PACKAGECONFIG[faillock] = ",,,"
RDEPENDS:${PN}-runtime += "${@bb.utils.contains('PACKAGECONFIG', 'faillock', 'pam-plugin-faillock', '', d)}"