[LU-7187] Client does not sanitize jobstats variable Created: 18/Sep/15  Updated: 29/Oct/15  Resolved: 02/Oct/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.7.0, Lustre 2.5.4
Fix Version/s: Lustre 2.8.0

Type: Improvement Priority: Critical
Reporter: Jesse Hanley Assignee: Niu Yawei (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

RHEL 6.6


Issue Links:
Related
Rank (Obsolete): 9223372036854775807

 Description   

The Lustre client doesn't appear to sanitize the contents of the job stats variable.

For example:
[root@client ~]# lctl set_param jobid_var=TESTINGVAR
jobid_var=TESTINGVAR

[user@client test_dir]# export TESTINGVAR=$(echo -e "test\n\n\a\b\tstring"); touch example.file

[user@mds1 ~]# lctl get_param -n mdt.*.job_stats
job_stats:

  • job_id: test

string
snapshot_time: 1442594528
open:

{ samples: 1, unit: reqs }

close:

{ samples: 1, unit: reqs }

mknod:

{ samples: 0, unit: reqs }

link:

{ samples: 0, unit: reqs }

unlink:

{ samples: 0, unit: reqs }

mkdir:

{ samples: 0, unit: reqs }

rmdir:

{ samples: 0, unit: reqs }

rename:

{ samples: 0, unit: reqs }

getattr:

{ samples: 0, unit: reqs }

setattr:

{ samples: 1, unit: reqs }

getxattr:

{ samples: 0, unit: reqs }

setxattr:

{ samples: 0, unit: reqs }

statfs:

{ samples: 0, unit: reqs }

sync:

{ samples: 0, unit: reqs }

samedir_rename:

{ samples: 0, unit: reqs }

crossdir_rename:

{ samples: 0, unit: reqs }

This also produces an audible bell (the \a).

I wouldn't say this is a bug, but it is probably unintended behavior. It's definitely reproducible. I've tested with some various escape codes. Probably my favorite thus far has been setting color codes.

Thanks,

Jesse



 Comments   
Comment by Andreas Dilger [ 18/Sep/15 ]

Probably the best/easiest thing to do is filter this at both the input and output of the jobid to use isprint() and replace non-printing characters with '.' or similar. At worst this could allow some collisions in the jobid statistics.

Comment by Niu Yawei (Inactive) [ 21/Sep/15 ]

I don't think it's a bug, given that non-printable character is allowed in the jobid environment variable.
If user don't want the non-printable character for some reason, I think it's user app/script's (in user level) duty to set the restriction, so that won't affect other users who want non-printable character.

Comment by Oleg Drokin [ 21/Sep/15 ]

Niu, I agree it's not strictly Lustre bug. But we might be a bit more proactive lookign for user's good here and still filter out unprintable characters anyway at least on the output.
So let's go with that, should not be hard to do.

Comment by Niu Yawei (Inactive) [ 22/Sep/15 ]

Niu, I agree it's not strictly Lustre bug. But we might be a bit more proactive lookign for user's good here and still filter out unprintable characters anyway at least on the output.
So let's go with that, should not be hard to do.

Sure, I think we can replace the non-printable character with some special character like '?' on the output side, so that to confine the output of jobid in single line.

Comment by Gerrit Updater [ 22/Sep/15 ]

Niu Yawei (yawei.niu@intel.com) uploaded a new patch: http://review.whamcloud.com/16593
Subject: LU-7187 jobstats: confine the output of jobid to single line
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: c31038f1c6a2de133ec9c70e32f0bbd378552a74

Comment by Gerrit Updater [ 02/Oct/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/16593/
Subject: LU-7187 jobstats: confine the output of jobid to single line
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: fb60c82405ba7f84dd9dd5411e9bdae3ecb8cf4a

Comment by Joseph Gmitter (Inactive) [ 02/Oct/15 ]

Landed for 2.8.0

Generated at Sat Feb 10 02:06:44 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.