tools/thermal/tmon: Fix predictable temporary path /var/log/tmon.log
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | tools/thermal/tmon: Prevent symlink attack on log filetools/ tools/ | +37 | 0 replies | |
| 2/3 | tools/thermal/tmon: Make sure ctrl_cdev is a Null terminated stringtools/ | +1 | 0 replies | |
| 3/3 | tools/thermal/tmon: Cleanup only: Use LOG_FILE varstools/ | +4 | 0 replies |
Reviews trailers per patch
1 of 3 patches has a Reviewed-by or Acked-by.
| Patch | Thomas Renninger |
|---|---|
| 1/3 | R-b |
| 2/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] tools/thermal/tmon: Fix predictable temporary path /var/log/tmon.log
Wolfgang Frisch identified and reported:
tmon only runs as root and logs event to /var/tmp/tmon.log. If fs.protected_symlinks=0, an unprivileged user can overwrite arbitrary files on the system.
nobody@localhost:/var/tmp> ln -s /test/shadow tmon.log root@localhost:/> tmon -l
I could reproduce the issue and after some discussion we came to 3 possible solutions:
1. Use /var/log/tmon.log instead of world-readable /var/tmp
2. Add randomness to the file name, e.g. /var/log/tmon.log.QipZjI
3. Make /var/tmp/tmon.log safe (TM), or say more robust.
Wolfgang came up with a patch which is part of this submission. His intention is to keep /var/tmp/tmon.log, in case other tools/scripts or docs rely on it.
If 3. is a suitable solution, it would be great if someone could pile these patches for next submission round.
Thanks,
Thomas
Thomas Renninger (3):
tools/thermal/tmon: Prevent symlink attack on log file tools/thermal/tmon: Make sure ctrl_cdev is a Null terminated string tools/thermal/tmon: Cleanup only: Use LOG_FILE vars
tools/thermal/tmon/tmon.c | 57 +++++++++++++++++++++++++++------------ tools/thermal/tmon/tmon.h | 3 ++- 2 files changed, 42 insertions(+), 18 deletions(-)
Signature · 1 line
2.49.0