diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-08-17 17:44:26 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-08-17 17:44:26 -0700 |
commit | b495ae599aeff85511449ef17bd50d656d40bc28 (patch) | |
tree | 898f459d96365eb637500ba1c17480258dd7062c /pkg/sentry/kernel/semaphore | |
parent | 8f6c54c8c023d551d6d09b5428ac59fb704c7067 (diff) | |
parent | 2f1c65e7fa49ddf6debb5d8ba4a5b08e17404e2a (diff) |
Merge pull request #6262 from sudo-sturbia:msgqueue/syscalls3
PiperOrigin-RevId: 391416650
Diffstat (limited to 'pkg/sentry/kernel/semaphore')
-rw-r--r-- | pkg/sentry/kernel/semaphore/semaphore.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pkg/sentry/kernel/semaphore/semaphore.go b/pkg/sentry/kernel/semaphore/semaphore.go index 8a5c81a68..28e466948 100644 --- a/pkg/sentry/kernel/semaphore/semaphore.go +++ b/pkg/sentry/kernel/semaphore/semaphore.go @@ -336,19 +336,15 @@ func (s *Set) Size() int { return len(s.sems) } -// Change changes some fields from the set atomically. -func (s *Set) Change(ctx context.Context, creds *auth.Credentials, owner fs.FileOwner, perms fs.FilePermissions) error { +// Set modifies attributes for a semaphore set. See semctl(IPC_SET). +func (s *Set) Set(ctx context.Context, ds *linux.SemidDS) error { s.mu.Lock() defer s.mu.Unlock() - // "The effective UID of the calling process must match the owner or creator - // of the semaphore set, or the caller must be privileged." - if !s.obj.CheckOwnership(creds) { - return linuxerr.EACCES + if err := s.obj.Set(ctx, &ds.SemPerm); err != nil { + return err } - s.obj.Owner = owner - s.obj.Perms = perms s.changeTime = ktime.NowFromContext(ctx) return nil } |