Avoid changing permissions of /var/lib/metrics/uma-events |
|||||||
Issue descriptionAs part of the code path for recording UMA stats, shill tries to change file permissions on /var/lib/metrics/uma-events, which will fail when shill is run as non-root user. See code below: https://cs.corp.google.com/chromeos_public/src/aosp/system/connectivity/shill/metrics.cc?rcl=e940876477cc07e8c38a329c0808fb0fb3880477&l=1631 --> https://cs.corp.google.com/chromeos_public/src/platform2/metrics/metrics_library.cc?rcl=d43e1af7e8b2a442cb976bef467103c4d65b16e1&l=206 --> https://cs.corp.google.com/chromeos_public/src/platform2/metrics/serialization/serialization_utils.cc?rcl=d43e1af7e8b2a442cb976bef467103c4d65b16e1&l=281
,
Feb 5 2018
,
Feb 5 2018
,
Mar 2 2018
,
Mar 8 2018
Does this make shill crash? Are we noticing this now because we're changing what user shill runs under?
,
Mar 8 2018
Shill doesn't crash, I just observed that when running shill under a non-root user the fchmod() call fails. So not a big deal, just something I came across when sandboxing shill. I believe authpolicy and cryptohome have/will have the same issue so i figured I'd fix it so other people don't have to figure out whats going on. One would only really notice this when monitoring syscalls.
,
Jun 6 2018
semenzato@ was the last one working on this in https://chromium-review.googlesource.com/c/chromiumos/platform2/+/956012, so assigning to him. Not relevant for any of the shill work since the worst that happens under existing behavior is that a fchmod() syscall fails silently.
,
Jun 6 2018
Actually that CL belongs to mortonm@. Not sure what happened. In any case I just uploaded the fixes requested by vapier@, which I think take care of all issues.
,
Jun 8 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform2/+/5f7d03739b645b2091c872512c5118b1c74c9cb3 commit 5f7d03739b645b2091c872512c5118b1c74c9cb3 Author: Micah Morton <mortonm@chromium.org> Date: Fri Jun 08 06:33:44 2018 metrics: Avoid changing file perms on UMA file. Whenever SendToUMA is called, the metrics library tries to change file permissions on /var/lib/metrics/uma-events, which will fail when invoked by a user other than root or chronos. Change init script to make sure that there is no race between when the file is created and when its permission bits are set. This way there should be no need to fchmod() the file before accessing it -- eliminating errors caused by non-root processes trying to fchmod() the file. BUG= chromium:804933 TEST=Tested shill code with the change, don't see any errors. Change-Id: Ib73524858dd6c4c08d0acd45ba1c77223042da58 Reviewed-on: https://chromium-review.googlesource.com/956012 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Micah Morton <mortonm@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [modify] https://crrev.com/5f7d03739b645b2091c872512c5118b1c74c9cb3/metrics/serialization/serialization_utils.cc [modify] https://crrev.com/5f7d03739b645b2091c872512c5118b1c74c9cb3/metrics/init/metrics_library.conf
,
Jun 8 2018
,
Jun 21 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform2/+/52fa073b862975503f015226a60c977cf7b6c183 commit 52fa073b862975503f015226a60c977cf7b6c183 Author: Micah Morton <mortonm@chromium.org> Date: Thu Jun 21 15:14:27 2018 metrics: Fix syntax error in pre-start script We took out an unneeded fchmod call in CL:956012, which required changing the associated pre-start script. Fix a syntax error in the script that was causing the script to fail/crash. BUG= chromium:804933 , chromium:853701 TEST=without syntax fix, verified that /var/lib/metrics/uma-events has wrong ownership/perms and /run/metrics doesn't get created, but file gets correct ownership/perms and dir gets created after this fix Change-Id: I62a31f412162638eb648f6505414274a7dfae8bf Reviewed-on: https://chromium-review.googlesource.com/1106046 Commit-Ready: Mattias Nissler <mnissler@chromium.org> Tested-by: Micah Morton <mortonm@chromium.org> Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [modify] https://crrev.com/52fa073b862975503f015226a60c977cf7b6c183/metrics/init/metrics_library.conf |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by mortonm@chromium.org
, Jan 23 2018