Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2017 20:31:10 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315283 - head/lib/libsysdecode
Message-ID:  <201703142031.v2EKVAXt031235@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik (ports committer)
Date: Tue Mar 14 20:31:10 2017
New Revision: 315283
URL: https://svnweb.freebsd.org/changeset/base/315283

Log:
  Fix sysdecode_cap_rights which currently prints bogus capability rights
  
  PR:		217787
  Reviewed by:	jhb, emaste
  Approved by:	jhb

Modified:
  head/lib/libsysdecode/flags.c

Modified: head/lib/libsysdecode/flags.c
==============================================================================
--- head/lib/libsysdecode/flags.c	Tue Mar 14 20:14:57 2017	(r315282)
+++ head/lib/libsysdecode/flags.c	Tue Mar 14 20:31:10 2017	(r315283)
@@ -962,23 +962,15 @@ sysdecode_umtx_rwlock_flags(FILE *fp, u_
 	return (print_mask_0ul(fp, umtxrwlockflags, flags, rem));
 }
 
-/* XXX: This should be in <sys/capsicum.h> */
-#define	CAPMASK(right)	((right) & (((uint64_t)1 << 57) - 1))
-
 void
 sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp)
 {
 	struct name_table *t;
-	int idx;
 	bool comma;
 
 	comma = false;
 	for (t = caprights; t->str != NULL; t++) {
-		idx = ffs(CAPIDXBIT(t->val)) - 1;
-		if (CAPARSIZE(rightsp) < idx)
-			continue;
-		if ((rightsp->cr_rights[CAPIDXBIT(t->val)] & CAPMASK(t->val)) ==
-		    CAPMASK(t->val)) {
+		if (cap_rights_is_set(rightsp, t->val)) {
 			fprintf(fp, "%s%s", comma ? "," : "", t->str);
 			comma = true;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703142031.v2EKVAXt031235>