You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2010/04/12 13:02:35 UTC

DO NOT REPLY [Bug 49094] New: apr_pollset_create_ex does not return error codes from pollset providers

https://issues.apache.org/bugzilla/show_bug.cgi?id=49094

           Summary: apr_pollset_create_ex does not return error codes from
                    pollset providers
           Product: APR
           Version: HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: sami.tolvanen@mywot.com


Created an attachment (id=25263)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25263)
Test case for reproducing the problem

The apr_pollset_create_ex function in APR 1.4.2 (and HEAD) always returns
APR_SUCCESS even if the pollset provider's create function returns an error. In
case of the Linux epoll provider, if epoll_create fails, this also causes a
crash in an unsuspecting application when the pollset is destroyed, as
demonstrated by the attached test case (assumes a Linux system without
epoll_create1, e.g. CentOS 5):

[sami@builder ~]$ gcc -Wall -o test test.c -I /usr/local/apr/include/apr-1 -L
/usr/local/apr/lib -lapr-1
[sami@builder ~]$ ./test
Segmentation fault

The application causes epoll_create failure by passing 0 as the pollset size
and demonstrates how a) apr_pollset_create_ex returns APR_SUCCESS despite the
failure that occurred and that b) apr_pollset_destroy causes a segmentation
fault when impl_pollset_cleanup in epoll.c references a NULL pointer.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 49094] apr_pollset_create_ex does not return error codes from pollset providers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49094

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Jeff Trawick <tr...@apache.org> 2010-04-12 11:29:03 EDT ---
The fix has been committed to 1.4.x thru trunk.  Thanks!

(I didn't commit the defensive check in the 2nd patch; we wouldn't ordinarily
add such logic until/unless we know that the check is required for some bug
free path of execution.)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 49094] apr_pollset_create_ex does not return error codes from pollset providers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49094

--- Comment #2 from Sami Tolvanen <sa...@mywot.com> 2010-04-12 07:10:54 EDT ---
Created an attachment (id=25265)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25265)
epoll.c: Fix the potential segmentation fault in impl_pollset_cleanup

Adds a check for a NULL pointer to impl_pollset_cleanup. It can be argued that
this patch is unnecessary after the first one, but personally I would prefer to
see more defensive programming in APR. If this is applied without the first
patch, the test case doesn't segfault, but exits with code 0.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 49094] apr_pollset_create_ex does not return error codes from pollset providers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49094

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 49094] apr_pollset_create_ex does not return error codes from pollset providers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49094

--- Comment #1 from Sami Tolvanen <sa...@mywot.com> 2010-04-12 07:07:52 EDT ---
Created an attachment (id=25264)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25264)
pollset.c: Fix apr_pollset_create_ex error handling

A proposed patch that causes apr_pollset_create_ex to correctly return an error
when the pollset provider's create function fails. The test case exits with
code 3 after this patch is applied.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org