Changeset d7eec4e in mod_gnutls


Ignore:
Timestamp:
Feb 23, 2023, 5:55:53 AM (4 weeks ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
main, master
Children:
b732220
Parents:
3855d9e
Message:

Fix loop in blocking read on transport timeout

The loop was cased by an incorrect errno if the transport read in
mgs_transport_read() fails with an APR TIMEUP status, as happens when
mod_reqtimeout limits are exceeded. Setting the transport errno to
EGAIN meant that a blocking read would be retried endlessly, setting
ETIMEDOUT instead makes the read fail as it should.

The bug was introduced in commit 92cb0cca41af946055307e373b6ab6d76d34f356,
first release to include it was 0.9.0.

Many thanks to Félix Arreola Rodríguez for the detailed analysis [1]
on the Debian bug tracker!

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942737#25

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_io.c

    r3855d9e rd7eec4e  
    33 *  Copyright 2008 Nikos Mavrogiannopoulos
    44 *  Copyright 2011 Dash Shendy
    5  *  Copyright 2015-2020 Fiona Klute
     5 *  Copyright 2015-2022 Fiona Klute
    66 *
    77 *  Licensed under the Apache License, Version 2.0 (the "License");
     
    278278                ctxt->input_rc = APR_EGENERAL;
    279279                break;
     280            } else if (rc == GNUTLS_E_PULL_ERROR
     281                       && APR_STATUS_IS_TIMEUP(ctxt->input_rc)) {
     282                ap_log_cerror(
     283                    APLOG_MARK, APLOG_TRACE2, ctxt->input_rc, ctxt->c,
     284                    "%s: transport read timed out", __func__);
    280285            } else {
    281286                /* Some Other Error. Report it. Die. */
     
    10041009        {
    10051010            ctxt->input_rc = rc;
    1006             gnutls_transport_set_errno(ctxt->session, EAGAIN);
     1011            gnutls_transport_set_errno(ctxt->session, ETIMEDOUT);
    10071012            return -1;
    10081013        }
Note: See TracChangeset for help on using the changeset viewer.