[085/190] Revert "audit: fix a memory leak bug"
diff mbox series

Message ID 20210421130105.1226686-86-gregkh@linuxfoundation.org
State New, archived
Headers show
Series
  • Revertion of all of the umn.edu commits
Related show

Commit Message

Greg KH April 21, 2021, 12:59 p.m. UTC
This reverts commit 70c4cf17e445264453bc5323db3e50aa0ac9e81f.

Commits from @umn.edu addresses have been found to be submitted in "bad
faith" to try to test the kernel community's ability to review "known
malicious" changes.  The result of these submissions can be found in a
paper published at the 42nd IEEE Symposium on Security and Privacy
entitled, "Open Source Insecurity: Stealthily Introducing
Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
of Minnesota) and Kangjie Lu (University of Minnesota).

Because of this, all submissions from this group must be reverted from
the kernel tree and will need to be re-reviewed again to determine if
they actually are a valid fix.  Until that work is complete, remove this
change to ensure that no problems are being introduced into the
codebase.

Cc: Wenwen Wang <wang6495@umn.edu>
Cc: Richard Guy Briggs <rgb@redhat.com>
Cc: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/auditfilter.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Paul Moore April 21, 2021, 4:18 p.m. UTC | #1
On Wed, Apr 21, 2021 at 9:04 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> This reverts commit 70c4cf17e445264453bc5323db3e50aa0ac9e81f.
>
> Commits from @umn.edu addresses have been found to be submitted in "bad
> faith" to try to test the kernel community's ability to review "known
> malicious" changes.  The result of these submissions can be found in a
> paper published at the 42nd IEEE Symposium on Security and Privacy
> entitled, "Open Source Insecurity: Stealthily Introducing
> Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> of Minnesota) and Kangjie Lu (University of Minnesota).
>
> Because of this, all submissions from this group must be reverted from
> the kernel tree and will need to be re-reviewed again to determine if
> they actually are a valid fix.  Until that work is complete, remove this
> change to ensure that no problems are being introduced into the
> codebase.
>
> Cc: Wenwen Wang <wang6495@umn.edu>
> Cc: Richard Guy Briggs <rgb@redhat.com>
> Cc: Paul Moore <paul@paul-moore.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  kernel/auditfilter.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

NACK on this revert.  I've looked at the original patch again this
morning, and the original patch still looks correct and doesn't appear
to introduce any new faults to the best of my understanding.

> diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
> index 333b3bcfc545..19f908b96000 100644
> --- a/kernel/auditfilter.c
> +++ b/kernel/auditfilter.c
> @@ -1125,24 +1125,22 @@ int audit_rule_change(int type, int seq, void *data, size_t datasz)
>         int err = 0;
>         struct audit_entry *entry;
>
> +       entry = audit_data_to_entry(data, datasz);
> +       if (IS_ERR(entry))
> +               return PTR_ERR(entry);
> +
>         switch (type) {
>         case AUDIT_ADD_RULE:
> -               entry = audit_data_to_entry(data, datasz);
> -               if (IS_ERR(entry))
> -                       return PTR_ERR(entry);
>                 err = audit_add_rule(entry);
>                 audit_log_rule_change("add_rule", &entry->rule, !err);
>                 break;
>         case AUDIT_DEL_RULE:
> -               entry = audit_data_to_entry(data, datasz);
> -               if (IS_ERR(entry))
> -                       return PTR_ERR(entry);
>                 err = audit_del_rule(entry);
>                 audit_log_rule_change("remove_rule", &entry->rule, !err);
>                 break;
>         default:
> +               err = -EINVAL;
>                 WARN_ON(1);
> -               return -EINVAL;
>         }
>
>         if (err || type == AUDIT_DEL_RULE) {
> --
> 2.31.1
Greg KH April 21, 2021, 4:26 p.m. UTC | #2
On Wed, Apr 21, 2021 at 12:18:44PM -0400, Paul Moore wrote:
> On Wed, Apr 21, 2021 at 9:04 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > This reverts commit 70c4cf17e445264453bc5323db3e50aa0ac9e81f.
> >
> > Commits from @umn.edu addresses have been found to be submitted in "bad
> > faith" to try to test the kernel community's ability to review "known
> > malicious" changes.  The result of these submissions can be found in a
> > paper published at the 42nd IEEE Symposium on Security and Privacy
> > entitled, "Open Source Insecurity: Stealthily Introducing
> > Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> > of Minnesota) and Kangjie Lu (University of Minnesota).
> >
> > Because of this, all submissions from this group must be reverted from
> > the kernel tree and will need to be re-reviewed again to determine if
> > they actually are a valid fix.  Until that work is complete, remove this
> > change to ensure that no problems are being introduced into the
> > codebase.
> >
> > Cc: Wenwen Wang <wang6495@umn.edu>
> > Cc: Richard Guy Briggs <rgb@redhat.com>
> > Cc: Paul Moore <paul@paul-moore.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  kernel/auditfilter.c | 12 +++++-------
> >  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> NACK on this revert.  I've looked at the original patch again this
> morning, and the original patch still looks correct and doesn't appear
> to introduce any new faults to the best of my understanding.
> 

Thanks for the review, much appreciate it, I'll drop it.

greg k-h
Richard Guy Briggs April 21, 2021, 5:02 p.m. UTC | #3
On 2021-04-21 12:18, Paul Moore wrote:
> On Wed, Apr 21, 2021 at 9:04 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > This reverts commit 70c4cf17e445264453bc5323db3e50aa0ac9e81f.
> >
> > Commits from @umn.edu addresses have been found to be submitted in "bad
> > faith" to try to test the kernel community's ability to review "known
> > malicious" changes.  The result of these submissions can be found in a
> > paper published at the 42nd IEEE Symposium on Security and Privacy
> > entitled, "Open Source Insecurity: Stealthily Introducing
> > Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> > of Minnesota) and Kangjie Lu (University of Minnesota).
> >
> > Because of this, all submissions from this group must be reverted from
> > the kernel tree and will need to be re-reviewed again to determine if
> > they actually are a valid fix.  Until that work is complete, remove this
> > change to ensure that no problems are being introduced into the
> > codebase.
> >
> > Cc: Wenwen Wang <wang6495@umn.edu>
> > Cc: Richard Guy Briggs <rgb@redhat.com>
> > Cc: Paul Moore <paul@paul-moore.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  kernel/auditfilter.c | 12 +++++-------
> >  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> NACK on this revert.  I've looked at the original patch again this
> morning, and the original patch still looks correct and doesn't appear
> to introduce any new faults to the best of my understanding.

Agreed.  Though on review, a much simpler fix to my original patch that
caused this problem requiring this fix
	e85322d21cfebeac64f58a204e9adc0bc5c1e46f rgb 2014-10-02 ("audit: cull redundancy in audit_rule_change")
would have been the two-liner in the error path similar to the pattern
in audit_data_to_entry() error path would have been:

	if (entry->rule.tree)
		audit_put_tree(entry->rule.tree); /* that's the temporary one */

> > diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
> > index 333b3bcfc545..19f908b96000 100644
> > --- a/kernel/auditfilter.c
> > +++ b/kernel/auditfilter.c
> > @@ -1125,24 +1125,22 @@ int audit_rule_change(int type, int seq, void *data, size_t datasz)
> >         int err = 0;
> >         struct audit_entry *entry;
> >
> > +       entry = audit_data_to_entry(data, datasz);
> > +       if (IS_ERR(entry))
> > +               return PTR_ERR(entry);
> > +
> >         switch (type) {
> >         case AUDIT_ADD_RULE:
> > -               entry = audit_data_to_entry(data, datasz);
> > -               if (IS_ERR(entry))
> > -                       return PTR_ERR(entry);
> >                 err = audit_add_rule(entry);
> >                 audit_log_rule_change("add_rule", &entry->rule, !err);
> >                 break;
> >         case AUDIT_DEL_RULE:
> > -               entry = audit_data_to_entry(data, datasz);
> > -               if (IS_ERR(entry))
> > -                       return PTR_ERR(entry);
> >                 err = audit_del_rule(entry);
> >                 audit_log_rule_change("remove_rule", &entry->rule, !err);
> >                 break;
> >         default:
> > +               err = -EINVAL;
> >                 WARN_ON(1);
> > -               return -EINVAL;
> >         }
> >
> >         if (err || type == AUDIT_DEL_RULE) {
> > --
> > 2.31.1
> 
> -- 
> paul moore
> www.paul-moore.com
> 

- RGB

--
Richard Guy Briggs <rgb@redhat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
Paul Moore April 21, 2021, 5:14 p.m. UTC | #4
On Wed, Apr 21, 2021 at 1:03 PM Richard Guy Briggs <rgb@redhat.com> wrote:
> On 2021-04-21 12:18, Paul Moore wrote:
> > On Wed, Apr 21, 2021 at 9:04 AM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > This reverts commit 70c4cf17e445264453bc5323db3e50aa0ac9e81f.
> > >
> > > Commits from @umn.edu addresses have been found to be submitted in "bad
> > > faith" to try to test the kernel community's ability to review "known
> > > malicious" changes.  The result of these submissions can be found in a
> > > paper published at the 42nd IEEE Symposium on Security and Privacy
> > > entitled, "Open Source Insecurity: Stealthily Introducing
> > > Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> > > of Minnesota) and Kangjie Lu (University of Minnesota).
> > >
> > > Because of this, all submissions from this group must be reverted from
> > > the kernel tree and will need to be re-reviewed again to determine if
> > > they actually are a valid fix.  Until that work is complete, remove this
> > > change to ensure that no problems are being introduced into the
> > > codebase.
> > >
> > > Cc: Wenwen Wang <wang6495@umn.edu>
> > > Cc: Richard Guy Briggs <rgb@redhat.com>
> > > Cc: Paul Moore <paul@paul-moore.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > >  kernel/auditfilter.c | 12 +++++-------
> > >  1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > NACK on this revert.  I've looked at the original patch again this
> > morning, and the original patch still looks correct and doesn't appear
> > to introduce any new faults to the best of my understanding.
>
> Agreed.  Though on review, a much simpler fix to my original patch that
> caused this problem requiring this fix
>         e85322d21cfebeac64f58a204e9adc0bc5c1e46f rgb 2014-10-02 ("audit: cull redundancy in audit_rule_change")
> would have been the two-liner in the error path similar to the pattern
> in audit_data_to_entry() error path would have been:
>
>         if (entry->rule.tree)
>                 audit_put_tree(entry->rule.tree); /* that's the temporary one */

Given the situation this morning I think it is best to limit
discussion on this thread to just the safety of the patches in
question and the necessity of the reverts Greg is proposing here.  If
you have suggestions about how to clean-up or otherwise improve the
code relating to these patches I think it is better to have that
discussion in the appropriate subsystem list/forum/etc (as one would
do normally).
Greg KH April 27, 2021, 4:44 p.m. UTC | #5
On Wed, Apr 21, 2021 at 06:26:47PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 21, 2021 at 12:18:44PM -0400, Paul Moore wrote:
> > On Wed, Apr 21, 2021 at 9:04 AM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > This reverts commit 70c4cf17e445264453bc5323db3e50aa0ac9e81f.
> > >
> > > Commits from @umn.edu addresses have been found to be submitted in "bad
> > > faith" to try to test the kernel community's ability to review "known
> > > malicious" changes.  The result of these submissions can be found in a
> > > paper published at the 42nd IEEE Symposium on Security and Privacy
> > > entitled, "Open Source Insecurity: Stealthily Introducing
> > > Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> > > of Minnesota) and Kangjie Lu (University of Minnesota).
> > >
> > > Because of this, all submissions from this group must be reverted from
> > > the kernel tree and will need to be re-reviewed again to determine if
> > > they actually are a valid fix.  Until that work is complete, remove this
> > > change to ensure that no problems are being introduced into the
> > > codebase.
> > >
> > > Cc: Wenwen Wang <wang6495@umn.edu>
> > > Cc: Richard Guy Briggs <rgb@redhat.com>
> > > Cc: Paul Moore <paul@paul-moore.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > >  kernel/auditfilter.c | 12 +++++-------
> > >  1 file changed, 5 insertions(+), 7 deletions(-)
> > 
> > NACK on this revert.  I've looked at the original patch again this
> > morning, and the original patch still looks correct and doesn't appear
> > to introduce any new faults to the best of my understanding.
> > 
> 
> Thanks for the review, much appreciate it, I'll drop it.

Now dropped.

Patch
diff mbox series

diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 333b3bcfc545..19f908b96000 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1125,24 +1125,22 @@  int audit_rule_change(int type, int seq, void *data, size_t datasz)
 	int err = 0;
 	struct audit_entry *entry;
 
+	entry = audit_data_to_entry(data, datasz);
+	if (IS_ERR(entry))
+		return PTR_ERR(entry);
+
 	switch (type) {
 	case AUDIT_ADD_RULE:
-		entry = audit_data_to_entry(data, datasz);
-		if (IS_ERR(entry))
-			return PTR_ERR(entry);
 		err = audit_add_rule(entry);
 		audit_log_rule_change("add_rule", &entry->rule, !err);
 		break;
 	case AUDIT_DEL_RULE:
-		entry = audit_data_to_entry(data, datasz);
-		if (IS_ERR(entry))
-			return PTR_ERR(entry);
 		err = audit_del_rule(entry);
 		audit_log_rule_change("remove_rule", &entry->rule, !err);
 		break;
 	default:
+		err = -EINVAL;
 		WARN_ON(1);
-		return -EINVAL;
 	}
 
 	if (err || type == AUDIT_DEL_RULE) {