Changes with Apache 2.3.3
+ *) Various modules: Do better checking of pollset operations in order to
+ avoid segmentation faults if they fail. PR 46467
+ [Stefan Fritsch <sf sfritsch.de>]
+
*) mod_autoindex: Correctly create an empty cell if the description
for a file is missing. PR 47682 [Peter Poeml <poeml suse.de>]
/* Create the pollset */
rv = apr_pollset_create(&data->pollset, 2, r->pool, 0);
- AP_DEBUG_ASSERT(rv == APR_SUCCESS);
+ if (rv != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "cgi: apr_pollset_create(); check system or user limits");
+ return NULL;
+ }
fd.desc_type = APR_POLL_FILE;
fd.reqevents = APR_POLLIN;
fd.desc.f = out; /* script's stdout */
fd.client_data = (void *)1;
rv = apr_pollset_add(data->pollset, &fd);
- AP_DEBUG_ASSERT(rv == APR_SUCCESS);
+ if (rv != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "cgi: apr_pollset_add(); check system or user limits");
+ return NULL;
+ }
fd.desc.f = err; /* script's stderr */
fd.client_data = (void *)2;
rv = apr_pollset_add(data->pollset, &fd);
- AP_DEBUG_ASSERT(rv == APR_SUCCESS);
+ if (rv != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "cgi: apr_pollset_add(); check system or user limits");
+ return NULL;
+ }
data->r = r;
b->data = data;
apr_file_pipe_timeout_set(script_err, 0);
b = cgi_bucket_create(r, script_in, script_err, c->bucket_alloc);
+ if (b == NULL)
+ return HTTP_INTERNAL_SERVER_ERROR;
#else
b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
#endif
if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) {
apr_socket_close(sock);
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
- "proxy: CONNECT: error apr_pollset_create()");
+ "proxy: CONNECT: error apr_pollset_create();"
+ " check system or user limits");
return HTTP_INTERNAL_SERVER_ERROR;
}
pollfd.reqevents = APR_POLLIN;
pollfd.desc.s = client_socket;
pollfd.client_data = NULL;
- apr_pollset_add(pollset, &pollfd);
+ rv = apr_pollset_add(pollset, &pollfd);
+ if (rv != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "proxy: CONNECT: error apr_pollset_add();"
+ " check system or user limits");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
/* Add the server side to the poll */
pollfd.desc.s = sock;
- apr_pollset_add(pollset, &pollfd);
+ rv = apr_pollset_add(pollset, &pollfd);
+ if (rv != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "proxy: CONNECT: error apr_pollset_add();"
+ " check system or user limits");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
while (1) { /* Infinite loop until error (one side closes the connection) */
if ((rv = apr_pollset_poll(pollset, -1, &pollcnt, &signalled)) != APR_SUCCESS) {
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
"Couldn't create a Thread Safe Pollset. "
- "Is it supported on your platform?");
+ "Is it supported on your platform?"
+ "Also check system or user limits!");
return HTTP_INTERNAL_SERVER_ERROR;
}
apr_pollset_destroy(event_pollset);
pfd.reqevents = APR_POLLIN;
pfd.client_data = lr;
- /* ### check the status */
- (void) apr_pollset_add(pollset, &pfd);
+ status = apr_pollset_add(pollset, &pfd);
+ if (status != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf,
+ "Couldn't add listener to pollset; check system or user limits");
+ clean_child_exit(APEXIT_CHILDSICK);
+ }
lr->accept_func = ap_unixd_accept;
}
free(ti);
- /* ### check the status */
- (void) apr_pollset_create(&pollset, num_listensocks, tpool, 0);
+ rv = apr_pollset_create(&pollset, num_listensocks, tpool, 0);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
+ "Couldn't create pollset in thread;"
+ " check system or user limits");
+ /* let the parent decide how bad this really is */
+ clean_child_exit(APEXIT_CHILDSICK);
+ }
for (lr = ap_listeners; lr != NULL; lr = lr->next) {
apr_pollfd_t pfd = { 0 };
pfd.reqevents = APR_POLLIN;
pfd.client_data = lr;
- /* ### check the status */
- (void) apr_pollset_add(pollset, &pfd);
+ rv = apr_pollset_add(pollset, &pfd);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
+ "Couldn't create add listener to pollset;"
+ " check system or user limits");
+ /* let the parent decide how bad this really is */
+ clean_child_exit(APEXIT_CHILDSICK);
+ }
lr->accept_func = ap_unixd_accept;
}