summaryrefslogtreecommitdiff
path: root/jni/node-inl.h
diff options
context:
space:
mode:
author Zim <zezeozue@google.com> 2020-10-19 15:39:33 +0100
committer Zim <zezeozue@google.com> 2020-10-19 15:43:40 +0100
commit9aa6f54bcfee12cd973fb27b77e565a64f2f167e (patch)
treec90ffced3cd7c0653ab47c52d3d9abdee5a6f250 /jni/node-inl.h
parentdeb93cb2db8ee1177e654e19594c2fa3dcca6bfc (diff)
Use open(2) uid for transforms
With node transforms, we delay calling the transform until read(2), if the opened fd is first read from a different process, we might use the wrong uid while computing the transform. To fix, we add the uid of process opening in the handle, and use it at read Test: Manual Bug: 170487388 Change-Id: I98d5e093bffc78c26c8fa1040bbe4504b7f92760
Diffstat (limited to 'jni/node-inl.h')
-rw-r--r--jni/node-inl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/jni/node-inl.h b/jni/node-inl.h
index e5344cc37..b635a1c48 100644
--- a/jni/node-inl.h
+++ b/jni/node-inl.h
@@ -41,13 +41,15 @@ namespace mediaprovider {
namespace fuse {
struct handle {
- explicit handle(int fd, const RedactionInfo* ri, bool cached) : fd(fd), ri(ri), cached(cached) {
+ explicit handle(int fd, const RedactionInfo* ri, bool cached, uid_t uid)
+ : fd(fd), ri(ri), cached(cached), uid(uid) {
CHECK(ri != nullptr);
}
const int fd;
const std::unique_ptr<const RedactionInfo> ri;
const bool cached;
+ const uid_t uid;
~handle() { close(fd); }
};