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
curl & systemd DynamicUser = Out of Memory #6200
Comments
what do you get on your and what about |
|
i'm confused, hopefully someone else will come along and be less confused than me (i'm just a random passer-by, i'm not a curl dev or anything and i have no idea what im doing) hmm that stack trace is curious, i don't really see any ENOMEM/ENOBUFS/ENOSPC or anything that screams
is about though.. and this request looks like complete bogus, "\x63" looks like a completely bogus memory location in
but getrandom didn't return EFAULT, odd.. (edit: maybe strace got confused and thought it was a char* string and showed us "the content of the string" instead of the actual memory address? i guess it's possible that's what happened) does the same thing happen if you compile this code as /********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
//curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "ipinfo.io/ip");
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.72.0");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
//curl_easy_setopt(hnd, CURLOPT_SSH_KNOWNHOSTS, "/home/hansh/.ssh/known_hosts");
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may select to either not use them or implement
them yourself.
CURLOPT_WRITEDATA set to a objectpointer
CURLOPT_INTERLEAVEDATA set to a objectpointer
CURLOPT_WRITEFUNCTION set to a functionpointer
CURLOPT_READDATA set to a objectpointer
CURLOPT_READFUNCTION set to a functionpointer
CURLOPT_SEEKDATA set to a objectpointer
CURLOPT_SEEKFUNCTION set to a functionpointer
CURLOPT_ERRORBUFFER set to a objectpointer
CURLOPT_STDERR set to a objectpointer
CURLOPT_DEBUGFUNCTION set to a functionpointer
CURLOPT_DEBUGDATA set to a objectpointer
CURLOPT_HEADERFUNCTION set to a functionpointer
CURLOPT_HEADERDATA set to a objectpointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/ |
Thanks for looking into this. I am as puzzled as you are... This code compiles fine and executes without error even when started via the service file. To add some more confusion, i'm seeing the same error happening on multiple Raspberry Pi 4 (both 2GB and 4GB version), however, on a Pi3B (same OS, same systemd and curl versions) the error does not occur. |
This is the working trace on the Pi3B:
|
suggests it might be a curl (the cli program curl) problem rather than a libcurl problem (alebit CURLE_OUT_OF_MEMORY sounds like a LIBcurl thing, idk) on the system where it crash, if you open a shell and just run
(PS: on some netcats like the GNU netcat the syntax is
does it still crash? also is -vvv required for it to crash, or is vvv irrelevant for crashing? |
irrelevant, i was just hoping to get more info.
yes Actually I've figured out what the problem was by compiling v7.73.0 from here. The latest version complains:
When adding
to the service file everything works, even the old version in RaspberryOS! Is there a need for the home directory to be present? Can that be turned off? |
... as there should be reason to error out completely. Reported-by: Andreas Fischer Fixes #6200
My proposed fix is in #6201 as not finding the home dir should not be a reason to error out like that! |
... as there should be no reason to error out completely. Reported-by: Andreas Fischer Fixes #6200
... as there should be no reason to error out completely. Reported-by: Andreas Fischer Fixes #6200
... as there should be no reason to error out completely. Reported-by: Andreas Fischer Fixes #6200
Thanks for the report, fixed now! |
Thank you Daniel! |
Workaround for curl version 7.74.0 and earlier which would fail with an "Out of Memory" error if $HOME is unset. It happens that the systemd environment does not set $HOME by default so adding it explicitly here avoids the bug.
I did this
curl.service
in/etc/systemd/system
systemctl start curl.service
results in (
journalctl
):I expected the following
curl works without problems, since this example works on x64 (Archlinux).
curl/libcurl version
operating system
The text was updated successfully, but these errors were encountered: