[apparmor] PATCH [3/3] - Fix leaking of screened logged messages

Jamie Strandboge jamie at canonical.com
Thu Sep 9 17:24:47 BST 2010


On Thu, 2010-09-09 at 09:09 -0700, John Johansen wrote:
> AppArmor notify is not freeing up messages that are not reported
> 
> Index: utils/apparmor_notify
> ===================================================================
> --- utils.orig/apparmor_notify	2010-09-09 08:50:27.684193402 -0700
> +++ utils/apparmor_notify	2010-09-09 08:51:27.634191991 -0700
> @@ -224,14 +224,14 @@
>      my $since = 0;
>      if (defined($date) and $#params > 0 and $params[1] =~ /^[0-9]+$/) {
>          $since = int($params[1]);
> -        int($date) >= $since or return ();
> +        int($date) >= $since or goto err;
>      }
>  
>      # ignore all but status and denied messages
>      my $type = LibAppArmor::aa_log_record::swig_event_get($test);
>  
>      $type == $LibAppArmor::AA_RECORD_DENIED ||
> -    $type == $LibAppArmor::AA_RECORD_STATUS or return ();
> +    $type == $LibAppArmor::AA_RECORD_STATUS or goto err;
>  
>      my $profile = LibAppArmor::aa_log_record::swig_profile_get($test);
>      my $operation = LibAppArmor::aa_log_record::swig_operation_get($test);
> @@ -242,6 +242,10 @@
>      LibAppArmorc::free_record($test);
>  
>      return ($profile, $operation, $name, $denied, $family, $sock_type, $date);
> +
> +err:
> +    LibAppArmorc::free_record($test);
> +    return ();
>  }
>  
>  sub format_message {
> 

Nice catch. ACK so long as we do this instead (based on feedback from
patch 2/3 in this series):
-    $type == $LibAppArmor::AA_RECORD_DENIED or return ();
+    $type == $LibAppArmor::AA_RECORD_DENIED or goto err;

-- 
Jamie Strandboge             | http://www.canonical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/apparmor/attachments/20100909/52aa8cde/attachment.pgp 


More information about the AppArmor mailing list