New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 804933 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Avoid changing permissions of /var/lib/metrics/uma-events

Project Member Reported by mortonm@chromium.org, Jan 23 2018

Issue description

Description: Show this description
Components: Security
Labels: OS-Chrome
Cc: kerrnel@chromium.org
Does this make shill crash?  Are we noticing this now because we're changing what user shill runs under?
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. 
Components: -Security Internals>Metrics
Owner: semenzato@chromium.org
Summary: Avoid changing permissions of /var/lib/metrics/uma-events (was: Dropping shill privileges: avoid changing permissions of /var/lib/metrics/uma-events)
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.
Cc: vapier@chromium.org mortonm@chromium.org
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.
Project Member

Comment 9 by bugdroid1@chromium.org, 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

Status: Fixed (was: Untriaged)
Project Member

Comment 11 by bugdroid1@chromium.org, 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