-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect error handling in httpGets2 #879
Comments
Closes: OpenPrinting#879 In case of some errors httpGets2 waits for the next packet. In all cases of errors it should return NULL. Signed-off-by: Heinrich Schuchardt <[email protected]>
Closes: OpenPrinting#879 In case of some errors httpGets2 waits for the next packet. In all other cases of errors it should return NULL to avoid negative values of http->used leading to ending up in an endless loop. Signed-off-by: Heinrich Schuchardt <[email protected]>
The discussion happens on the PR, setting the correct label. |
Unfortunately, the fix for this bug is not actually working. In Ubuntu 24.04 the fix is applied but the bug still occurs. See https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2067918 and there expecially comment #10 https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2067918/comments/10 |
Many users of Ubuntu 24.04 are still reporting this very same problem. |
Are you sure that the fix has been applied in Ubuntu 24.04? I looked at the source (via |
@tillkamppeter Can you respond to @jknockel ? |
Sorry for the late reply. I was very busy, had some days off, a conference, and now there was also the vulnerability. I have checked now and the upstream introduction of the fix was in 2.4.8 and 24.04 has only 2.4.7, and I see no distro patch in 2.4.7 which backports the fix. Probably the fix was too late for the release of 24.04 LTS. We need to somehow test it, in 24.10 (which has CUPS 2.4.10 which contains it) and perhaps also a 2.4.7 with backported fix in a PPA for 24.04, to check whether one could do an SRU. |
I got somebody reporting to still have the cups-browsed issue on Ubuntu 24.10 with CUPS 2.4.10: https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2049315/comments/29 As CUPS 2.4.10 contains the changes described in this issue report, it seems that the change does not fix the issue. |
For me it also looks like that the patch is without effect, as if the added |
@tillkamppeter According to the bug report, |
I have checked now and the Ubuntu package of CUPS does not apply any patches to I also had a look through the code of |
It is easy to see when reviewing the code of The code of cups-browsed ( So only thing which could cause |
Before, a HTTP connection to the local CUPS was opened and kept in a global variable of http_t* during the whole session. Functions connecting to the local CUPS just used this connection. Later on multi-threading for time consuming actions like DNS-SD resolving and creating CUPS queues got introduced. Also the sub-threads for creating CUPS queues used the global HTTP connection. This could have cause drace conditions messing up the http_t data structure. Most probably this has caused to the "used" field of the data structure (number of bytes which are in use in the internal buffer, must be >= 0) getting negative nad this making the httpGets() function of libcups busy-looping, which caused cups-browsed taking 100% of one or two CPU cores and requiring SIGKILL to get terminated. Bug reports at Ubuntu: - cups-browsed running non-stop on two cores https://bugs.launchpad.net/bugs/2049315 - cups-browsed high-cpu usage https://bugs.launchpad.net/bugs/2067918 - cups-browsed delays shutdown for 90 s https://bugs.launchpad.net/bugs/2073504 Bug report on CUPS: - OpenPrinting/cups#879 This commit does away with the global connection. Each function which had used the global HTTP connection to the local CUPS creates an HTTP connection onits own now and closes it before returning.CUPS can accept several HTTP connections in parallel, therefore it is no problem if we have individual connections now and if they happen in parallel due to the sub-threads. Note that testing is needed to determine whether this change actually fixes the bug. The probability is high, butdue to the fact that the bug is not easily reproducable it will take some time.
I have now modified cups-browsed to not use a global HTTP connection to the local CUPS any more but individual connections, to avoid any race conditions and mess-ups in the parallel threads: OpenPrinting/cups-browsed@a8b645e4b3 This should fix the problem. |
Describe the bug
cups-browsed runs into an infinite loop in httpGets.
To Reproduce
The issues was sometimes observed in cups-browsed on Ubuntu 24.04. See https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2049315.
Expected behavior
httpGets2 should not enter an endless loop if a connection error occurs or the webserver provides invalid data.
System Information:
Additional context
Debugging showed negative values of http->used in httpGets.
Some error paths lead to negative numbers being added to http->used. The following diff should avoid this:
The text was updated successfully, but these errors were encountered: