Whamcloud - gitweb
LU-16376 obdclass: NUL terminate long jobid strings 51/49351/3
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 8 Dec 2022 18:43:57 +0000 (11:43 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 20 Dec 2022 14:44:03 +0000 (14:44 +0000)
commit9eba5d57297f807fddf046356c846478bbf232f4
treee8434b77e5287fa373ccb7eb5fe42748551b4290
parent2faee9972cdcde6652db1a857b548b3f7396944b
LU-16376 obdclass: NUL terminate long jobid strings

It appears that some jobid names can be sent that are using the full
32-byte size, rather than containing an embedded NUL terminator. This
caused errors in lprocfs_job_stats_log() when it overflowed.

If there is no NUL terminator in lustre_msg_get_jobid() then add one
if not found within the buffer, so that the rest of the code doesn't
have to deal with unterminated strings.

This potentially exposes a larger issue that other places may not be
handling the unterminated string properly either, which needs to be
addressed separately on both the client and server.  Terminating the
jobid to 31 chars only on the client does not totally solve the issue,
since there will still be older clients that are not doing this, so
the server needs to handle this in any case.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I4c05fabdacb6a0bbf6477d3601a628fe1f3ebbe5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49351
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lprocfs_jobstats.c
lustre/ptlrpc/pack_generic.c