[Lldb-commits] [lldb] r156424 - in /lldb/trunk/source/Host/macosx/launcherXPCService: LauncherRootXPCService-Info.plist LauncherRootXPCService.mm LauncherXPCService-Info.plist

Han Ming Ong hanming at apple.com
Tue May 8 14:35:52 PDT 2012


Author: hanming
Date: Tue May  8 16:35:52 2012
New Revision: 156424

URL: http://llvm.org/viewvc/llvm-project?rev=156424&view=rev
Log:
<rdar://problem/11400476>

On Lion, because the rights initially doesn't exist in /etc/authorization, if an admin user logs in and uses lldb within the first 5 minutes, it is possible to do AuthorizationCopyRights on LaunchUsingXPCRightName and get the rights back. As another security measure, we make sure that the LaunchUsingXPCRightName rights actually exists.

Removed Xcode as the user of the XPC service to shrink the security surface area.

Modified:
    lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
    lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService.mm
    lldb/trunk/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist

Modified: lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist?rev=156424&r1=156423&r2=156424&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist (original)
+++ lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist Tue May  8 16:35:52 2012
@@ -33,7 +33,6 @@
 		<key>_AllowedClients</key>
 		<array>
 			<string> identifier = com.apple.lldb AND_APPLE_CODE_SIGNED</string>
-			<string> identifier = com.apple.dt.Xcode AND_APPLE_CODE_SIGNED</string>
 		</array>
 		<key>_RoleAccount</key>
 		<string>root</string>

Modified: lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService.mm?rev=156424&r1=156423&r2=156424&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService.mm (original)
+++ lldb/trunk/source/Host/macosx/launcherXPCService/LauncherRootXPCService.mm Tue May  8 16:35:52 2012
@@ -33,10 +33,18 @@
 	
 	// Given a set of rights, return the subset that is currently authorized by the AuthorizationRef given; count(subset) > 0  -> success.
 	bool auth_success = (status == errAuthorizationSuccess && outAuthorizedRights && outAuthorizedRights->count > 0) ? true : false;
-	
 	if (outAuthorizedRights) AuthorizationFreeItemSet(outAuthorizedRights);
-        
-        return auth_success ? 0 : 3;
+    if (!auth_success)
+        return 3;
+    
+    // On Lion, because the rights initially doesn't exist in /etc/authorization, if an admin user logs in and uses lldb within the first 5 minutes,
+    // it is possible to do AuthorizationCopyRights on LaunchUsingXPCRightName and get the rights back.
+    // As another security measure, we make sure that the LaunchUsingXPCRightName rights actually exists.
+    status = AuthorizationRightGet(LaunchUsingXPCRightName, NULL);
+    if (status == errAuthorizationSuccess)
+        return 0;
+    else
+        return 4;
 }
 
 #endif

Modified: lldb/trunk/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist?rev=156424&r1=156423&r2=156424&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist (original)
+++ lldb/trunk/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist Tue May  8 16:35:52 2012
@@ -33,7 +33,6 @@
 		<key>_AllowedClients</key>
 		<array>
 			<string> identifier = com.apple.lldb AND_APPLE_CODE_SIGNED</string>
-			<string> identifier = com.apple.dt.Xcode AND_APPLE_CODE_SIGNED</string>
 		</array>
 		<key>ServiceType</key>
 		<string>Application</string>





More information about the lldb-commits mailing list