Bug 9575 - NULL pointer dereference on kernel/auditsc.c
Summary: NULL pointer dereference on kernel/auditsc.c
Status: CLOSED CODE_FIX
Alias: None
Product: Process Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Paul Mundt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-15 13:11 UTC by Marcio Buss
Modified: 2008-09-20 23:54 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.23
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Marcio Buss 2007-12-15 13:11:00 UTC
 
Comment 1 Marcio Buss 2007-12-15 13:17:40 UTC
Not sure if "process management" is the right place to report this, but 
there's a null pointer dereference on kernel/auditsc.c as follows:

(1) assume the condition on line 1995 is true
(2) assume the condition on line 1996 is also true
(3) assume the test "if (ctxt)" at line 1998 evaluates to
    false, which implies that "ctx" is null
(4) assume that the condition at line 2004 is false so
    that we don't return
(5) then the expression "if (!ctx->target_pid)" (line 2010)
    is executed with a "ctx" pointer that's null.

This is a false alarm only if "ctx" is never null. But then the test
"if (ctx)" at line 1998 is bogus (which means some code change is
needed).
Comment 2 Eric Paris 2007-12-20 11:53:37 UTC
Your line numbers don't match up with any kernel I can find so I'm going ENTIRELY on where I see if(!ctx->target_pid) which is inside __audit_signal_info().  Assuming I'm looking at the right function you are right about there being needless extra checks for if(ctx) because the only caller to __audit_signal_info is:

kernel/audit.h::audit_signal_info()

which includes a check for !audit_dummy_context() which really does nothing but check if current has a valid audit_context.

since we can never get into __audit_signal_info with current->audit_context == NULL all of the checks inside for NULL are needless and a waste of time, but this doesn't appear to be a NULL pointer dereference to me.
Comment 3 Paul Mundt 2008-09-20 23:53:14 UTC
(In reply to comment #2)
> Your line numbers don't match up with any kernel I can find so I'm going
> ENTIRELY on where I see if(!ctx->target_pid) which is inside
> __audit_signal_info().  Assuming I'm looking at the right function you are
> right about there being needless extra checks for if(ctx) because the only
> caller to __audit_signal_info is:
> 
Given 2.6.23, this was an accurate bug report. It was fixed by Al Viro in bfef93a5d1fb5654fe2025276c55e202d10b5255, in the 2.6.25-rc1 cycle.

Note You need to log in before you can comment on or make changes to this bug.