Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

OS-1338 for local auditors, LA_FLG_BINDTO does not audit all symbol b…

…indings
  • Loading branch information...
commit aa5e1bc33afe16d8214718ebf16031a708ba7d6e 1 parent fda27c9
Bryan Cantrill authored June 26, 2012

Showing 1 changed file with 22 additions and 10 deletions. Show diff stats Hide diff stats

  1. 32  usr/src/cmd/sgs/rtld/common/audit.c
32  usr/src/cmd/sgs/rtld/common/audit.c
@@ -21,6 +21,7 @@
21 21
 
22 22
 /*
23 23
  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
  24
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
24 25
  *
25 26
  * Audit interfaces.  Auditing can be enabled in two ways:
26 27
  *
@@ -986,19 +987,23 @@ _audit_symbind(APlist *list, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx,
986 987
 
987 988
 		if (alp->al_symbind == 0)
988 989
 			continue;
989  
-		if ((racp = _audit_client(AUDINFO(rlmp), almp)) == NULL)
  990
+
  991
+		if ((racp = _audit_client(AUDINFO(rlmp), almp)) != NULL &&
  992
+		    (racp->ac_flags & FLG_AC_BINDFROM) == 0)
990 993
 			continue;
  994
+
991 995
 		if ((dacp = _audit_client(AUDINFO(dlmp), almp)) == NULL)
992 996
 			continue;
993  
-		if (((racp->ac_flags & FLG_AC_BINDFROM) == 0) ||
994  
-		    ((dacp->ac_flags & FLG_AC_BINDTO) == 0))
  997
+
  998
+		if ((dacp->ac_flags & FLG_AC_BINDTO) == 0)
995 999
 			continue;
996 1000
 
997 1001
 		/*
998  
-		 * The la_symbind interface is only called when the calling
999  
-		 * object has been identified as BINDFROM, and the destination
1000  
-		 * object has been identified as BINDTO.  Use a local version of
1001  
-		 * the flags, so that any user update can be collected.
  1002
+		 * The la_symbind interface is only called when the destination
  1003
+		 * object has been identified as BINDTO and either the
  1004
+		 * destination object is being locally audited or the calling
  1005
+		 * object has been identified as BINDFROM.  Use a local version
  1006
+		 * of the flags, so that any user update can be collected.
1002 1007
 		 */
1003 1008
 		(*called)++;
1004 1009
 		lflags = (oflags & ~(LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT));
@@ -1007,8 +1012,8 @@ _audit_symbind(APlist *list, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx,
1007 1012
 		    alp->al_libname, name, ovalue, oflags));
1008 1013
 
1009 1014
 		leave(alml, thr_flg_reenter);
1010  
-		sym->st_value = (*alp->al_symbind)(sym, ndx,
1011  
-		    &(racp->ac_cookie), &(dacp->ac_cookie),
  1015
+		sym->st_value = (*alp->al_symbind)(sym, ndx, racp == NULL ?
  1016
+		    NULL : &(racp->ac_cookie), &(dacp->ac_cookie),
1012 1017
 		/* BEGIN CSTYLED */
1013 1018
 #if	defined(_ELF64)
1014 1019
 		    &lflags, name);
@@ -1065,10 +1070,17 @@ audit_symbind(Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx, Addr value,
1065 1070
 	if (auditors && (auditors->ad_flags & LML_TFLG_AUD_SYMBIND))
1066 1071
 		nsym.st_value = _audit_symbind(auditors->ad_list,
1067 1072
 		    rlmp, dlmp, &nsym, ndx, flags, &called);
1068  
-	if (AUDITORS(rlmp) && (AUDITORS(rlmp)->ad_flags & LML_TFLG_AUD_SYMBIND))
  1073
+
  1074
+	if ((AUDITORS(rlmp) && AUDITORS(rlmp)->ad_flags & LML_TFLG_AUD_SYMBIND))
1069 1075
 		nsym.st_value = _audit_symbind(AUDITORS(rlmp)->ad_list,
1070 1076
 		    rlmp, dlmp, &nsym, ndx, flags, &called);
1071 1077
 
  1078
+	if (dlmp != rlmp && (AUDITORS(dlmp) &&
  1079
+	    (AUDITORS(dlmp)->ad_flags & LML_TFLG_AUD_SYMBIND))) {
  1080
+		nsym.st_value = _audit_symbind(AUDITORS(dlmp)->ad_list,
  1081
+		    rlmp, dlmp, &nsym, ndx, flags, &called);
  1082
+	}
  1083
+
1072 1084
 	/*
1073 1085
 	 * If no la_symbind() was called for this interface, fabricate that no
1074 1086
 	 * la_pltenter, or la_pltexit is required.  This helps reduce the glue

0 notes on commit aa5e1bc

Please sign in to comment.
Something went wrong with that request. Please try again.