Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 May 2017 00:36:27 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r318764 - stable/11/lib/libsysdecode
Message-ID:  <201705240036.v4O0aRLM006103@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed May 24 00:36:27 2017
New Revision: 318764
URL: https://svnweb.freebsd.org/changeset/base/318764

Log:
  MFC 315283:
  Fix sysdecode_cap_rights which currently prints bogus capability rights.
  
  PR:		217787

Modified:
  stable/11/lib/libsysdecode/flags.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libsysdecode/flags.c
==============================================================================
--- stable/11/lib/libsysdecode/flags.c	Wed May 24 00:00:55 2017	(r318763)
+++ stable/11/lib/libsysdecode/flags.c	Wed May 24 00:36:27 2017	(r318764)
@@ -963,23 +963,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?201705240036.v4O0aRLM006103>