forked from pool/slurm
Egbert Eich
e481851f5a
- Updated to 20.02.5, changes: * Fix leak of TRESRunMins when job time is changed with --time-min * pam_slurm - explicitly initialize slurm config to support configless mode. * scontrol - Fix exit code when creating/updating reservations with wrong Flags. * When a GRES has a no_consume flag, report 0 for allocated. * Fix cgroup cleanup by jobacct_gather/cgroup. * When creating reservations/jobs don't allow counts on a feature unless using an XOR. * Improve number of boards discovery * Fix updating a reservation NodeCnt on a zero-count reservation. * slurmrestd - provide an explicit error messages when PSK auth fails. * cons_tres - fix job requesting single gres per-node getting two or more nodes with less CPUs than requested per-task. * cons_tres - fix calculation of cores when using gres and cpus-per-task. * cons_tres - fix job not getting access to socket without GPU or with less than --gpus-per-socket when not enough cpus available on required socket and not using --gres-flags=enforce binding. * Fix HDF5 type version build error. * Fix creation of CoreCnt only reservations when the first node isn't available. * Fix wrong DBD Agent queue size in sdiag when using accounting_storage/none. * Improve job constraints XOR option logic. * Fix preemption of hetjobs when needed nodes not in leader component. * Fix wrong bit_or() messing potential preemptor jobs node bitmap, causing bad node deallocations and even allocation of nodes from other partitions. * Fix double-deallocation of preempted non-leader hetjob components. * slurmdbd - prevent truncation of the step nodelists over 4095. * Fix nodes remaining in drain state state after rebooting with ASAP option. - changes from 20.02.4: OBS-URL: https://build.opensuse.org/request/show/845108 OBS-URL: https://build.opensuse.org/package/show/network:cluster/slurm?expand=0&rev=156
82 lines
2.5 KiB
Diff
82 lines
2.5 KiB
Diff
From: Sebastian Krahmer <krahmer@suse.com>
|
|
Date: Thu Feb 2 09:49:38 2017 +0100
|
|
Subject: [PATCH]pam_slurm: Initialize arrays and pass sizes
|
|
Git-repo: https://github.com/SchedMD/slurm
|
|
Git-commit: fbfbb90f6a2e7f134220991ed3263894ba365411
|
|
References: bsc#1007053
|
|
Signed-off-by: Egbert Eich <eich@suse.de>
|
|
|
|
PAM is security critical:
|
|
- clear arrays
|
|
- ensure strings are NULL-terminated.
|
|
|
|
Signed-off-by: Egbert Eich <eich@suse.com>
|
|
---
|
|
|
|
diff -Nrua a/contribs/pam/pam_slurm.c b/contribs/pam/pam_slurm.c
|
|
--- a/contribs/pam/pam_slurm.c
|
|
+++ b/contribs/pam/pam_slurm.c
|
|
@@ -266,9 +266,9 @@
|
|
_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 @@
|
|
_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_conf_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 @@
|
|
*/
|
|
extern void libpam_slurm_init (void)
|
|
{
|
|
- char libslurmname[64];
|
|
+ char libslurmname[64] = {0};
|
|
|
|
if (slurm_h)
|
|
return;
|
|
@@ -433,10 +433,10 @@
|
|
/* 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 @@
|
|
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;
|