SHA256
1
0
forked from pool/slurm
slurm/pam_slurm-Initialize-arrays-and-pass-sizes.patch
Egbert Eich ef6d6521aa Accepting request 1067475 from home:eeich:branches:network:cluster
- updated to 23.02.0-0rc1
  * Highlights
    + slurmctld - Add new RPC rate limiting feature. This is enabled through
      SlurmctldParameters=rl_enable, otherwise disabled by default.
    + Make scontrol reconfigure and sending a SIGHUP to the slurmctld behave
      the same. If you were using SIGHUP as a 'lighter' scontrol reconfigure
      to rotate logs please update your scripts to use SIGUSR2 instead.
    + Change cloud nodes to show by default. PrivateData=cloud is no longer
      needed.
    + sreport - Count planned (FKA reserved) time for jobs running in
      IGNORE_JOBS reservations. Previously was lumped into IDLE time.
    + job_container/tmpfs - Support running with an arbitrary list of private
      mount points (/tmp and /dev/shm are the default, but not required).
    + job_container/tmpfs - Set more environment variables in InitScript.
    + Make all cgroup directories created by Slurm owned by root. This was the
      behavior in cgroup/v2 but not in cgroup/v1 where by default the step
      directories ownership were set to the user and group of the job.
    + accounting_storage/mysql - change purge/archive to calculate record ages
      based on end time, rather than start or submission times.
    + job_submit/lua - add support for log_user() from slurm_job_modify().
    + Run the following scripts in slurmscriptd instead of slurmctld:
      ResumeProgram, ResumeFailProgram, SuspendProgram, ResvProlog, ResvEpilog,
      and RebootProgram (only with SlurmctldParameters=reboot_from_controller).
    + Only permit changing log levels with 'srun --slurmd-debug' by root
      or SlurmUser.
    + slurmctld will fatal() when reconfiguring the job_submit plugin fails.
    + Add PowerDownOnIdle partition option to power down nodes after nodes
      become idle.
    + Add "[jobid.stepid]" prefix from slurmstepd and "slurmscriptd" prefix
      from slurmcriptd to Syslog logging. Previously was only happening when

OBS-URL: https://build.opensuse.org/request/show/1067475
OBS-URL: https://build.opensuse.org/package/show/network:cluster/slurm?expand=0&rev=231
2023-02-23 19:32:51 +00:00

85 lines
2.8 KiB
Diff

From: Egbert Eich <eich@suse.com>
Date: Mon Feb 20 21:29:27 2023 +0100
Subject: pam_slurm: Initialize arrays and pass sizes
Patch-mainline: Not yet
Git-commit: 5feca5c29d4e820dafd8d34c0343944b28890902
References: bsc#1007053
PAM is security critical:
- clear arrays
- ensure strings are NULL-terminated.
Signed-off-by: Egbert Eich <eich@suse.com>
Originally-from: Sebastian Krahmer <krahmer@suse.com>
Signed-off-by: Egbert Eich <eich@suse.de>
---
contribs/pam/pam_slurm.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/contribs/pam/pam_slurm.c b/contribs/pam/pam_slurm.c
index 20d21a9..363b6ae 100644
--- a/contribs/pam/pam_slurm.c
+++ b/contribs/pam/pam_slurm.c
@@ -266,9 +266,9 @@ static int
_gethostname_short (char *name, size_t len)
{
int error_code, name_len;
- char *dot_ptr, path_name[1024];
+ char *dot_ptr, path_name[1024] = {0};
- error_code = gethostname(path_name, sizeof(path_name));
+ error_code = gethostname(path_name, sizeof(path_name) - 1);
if (error_code)
return error_code;
@@ -296,13 +296,13 @@ static int
_slurm_match_allocation(uid_t uid)
{
int authorized = 0, i;
- char hostname[MAXHOSTNAMELEN];
+ char hostname[MAXHOSTNAMELEN] = {0};
char *nodename = NULL;
job_info_msg_t * msg;
slurm_init(NULL);
- if (_gethostname_short(hostname, sizeof(hostname)) < 0) {
+ if (_gethostname_short(hostname, sizeof(hostname) - 1) < 0) {
_log_msg(LOG_ERR, "gethostname: %m");
return 0;
}
@@ -425,7 +425,7 @@ _send_denial_msg(pam_handle_t *pamh, struct _options *opts,
*/
extern void libpam_slurm_init (void)
{
- char libslurmname[64];
+ char libslurmname[64] = {0};
if (slurm_h)
return;
@@ -433,10 +433,10 @@ extern void libpam_slurm_init (void)
/* First try to use the same libslurm version ("libslurm.so.24.0.0"),
* Second try to match the major version number ("libslurm.so.24"),
* Otherwise use "libslurm.so" */
- if (snprintf(libslurmname, sizeof(libslurmname),
+ if (snprintf(libslurmname, sizeof(libslurmname) - 1,
"libslurm.so.%d.%d.%d", SLURM_API_CURRENT,
SLURM_API_REVISION, SLURM_API_AGE) >=
- sizeof(libslurmname) ) {
+ sizeof(libslurmname) - 1) {
_log_msg (LOG_ERR, "Unable to write libslurmname\n");
} else if ((slurm_h = dlopen(libslurmname, RTLD_NOW|RTLD_GLOBAL))) {
return;
@@ -445,8 +445,10 @@ extern void libpam_slurm_init (void)
libslurmname, dlerror ());
}
- if (snprintf(libslurmname, sizeof(libslurmname), "libslurm.so.%d",
- SLURM_API_CURRENT) >= sizeof(libslurmname) ) {
+ memset(libslurmname, 0, sizeof(libslurmname));
+
+ if (snprintf(libslurmname, sizeof(libslurmname) - 1, "libslurm.so.%d",
+ SLURM_API_CURRENT) >= sizeof(libslurmname) - 1) {
_log_msg (LOG_ERR, "Unable to write libslurmname\n");
} else if ((slurm_h = dlopen(libslurmname, RTLD_NOW|RTLD_GLOBAL))) {
return;