getaddrinfo: __resolv_conf_allocate: Assertion `conf == ptr' failed

Asked by Alberto Pires de Oliveira Neto

Hi, I have a code that needs to resolve a name to IP. This code is already working in a lot of different distros and versions for a long time, but when I try to run in a freshly installed Ubuntu 18.04.1 (4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 x86_64 x86_64 x86_64), and my /etc/resolv.conf has a line "search anyname.???" where ??? can be any group of three letters I get the following error:

  Electric Fence 2.2 Copyright (C) 1987-1999 Bruce Perens <email address hidden>
Resolving for Host: <aaa>, Port: <5000>
resolv: resolv_conf.c:423: __resolv_conf_allocate: Assertion `conf == ptr' failed.
Aborted (core dumped)

It's also important to mention, that Electric Fence (-lefence) must be used.
I've included the code that causes the error, it happens when I call getaddrinfo

Thanks.

 char buffer[128];
 struct addrinfo hints;
 struct addrinfo *result, *rp;
 struct sockaddr_in *address;

 if (argc < 2) {
  printf("Error: Resolve <host> <port>\n");
  exit(1);
 }

 char *p = (char*) malloc(120);
 printf("Resolving for Host: <%s>, Port: <%s>\n", argv[1], argv[2]);

 memset(&hints, 0, sizeof(struct addrinfo));
 hints.ai_canonname = NULL;
 hints.ai_addr = NULL;
 hints.ai_next = NULL;
 //hints.ai_family = AF_UNSPEC;
 hints.ai_family = AF_INET;
 hints.ai_socktype = SOCK_STREAM;
 hints.ai_flags = AI_NUMERICSERV;

 if (getaddrinfo(argv[1], argv[2], &hints, &result) != 0) {
  printf("Failed to call getaddrinfo.\n");
  exit(1);
 }

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Are you using DHCP on the system or are you using a static IP?
Is the system fully updated?

Thanks

Revision history for this message
Alberto Pires de Oliveira Neto (apon) said :
#2

Yes, using dhcp. Apart from the extra development packages it was a standard installation.
And the system is fully updated. (Last update Sep 19/2018)

Revision history for this message
Alberto Pires de Oliveira Neto (apon) said :
#3

This last test was made on a VirtualBox installation, but I was already able to replicate this on two different computers with the same conditions.

Revision history for this message
Alberto Pires de Oliveira Neto (apon) said :
#4

Another update: I was suspecting of the glibc-2.27 (the one that is used on Ubuntu 18), so I've downloaded the glibc-2.27 on my Ubuntu 16.04-LTS and was able to replicate the problem as well.

Revision history for this message
Alberto Pires de Oliveira Neto (apon) said :
#5

Also, it is possible that it's something in the Electric Fence library (-lefence) since it's used for debug of memory allocation. Probably an issue with EFence and glibc-2.27.

I've debugged the resolv_conf.c and it seams that alloc_buffer_allocate() and alloc_buffer_alloc() should return the same pointer are not doing this:

resolv_conf.conf: 0x7f9f00f33f90
resolv_conf.ptr : 0x7f9f00f33f8c
resolv: resolv_conf.c:425: __resolv_conf_allocate: Assertion `conf == ptr' failed.

If I don't call malloc before calling getaddrinfo or do not use -lefence the problem doesn't happen.

I hope it helps, anyway I'll keep digging...

Revision history for this message
Launchpad Janitor (janitor) said :
#6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Alexander Traud (traud) said :
#7

I am facing the same assert while debugging openssl s_server. Thanks for the trick with removing ‘search’ from the file ‘/etc/resolv.conf’. Anyway, any news about this issue?

Revision history for this message
Alberto Pires de Oliveira Neto (apon) said :
#8

Not so far. It seams that a name with 8 or more characters before the dot works. Example:
search eexample.com

I've noticed also a message in my syslog:

systemd-resolved[1434]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.

I don't know yet if there is a connection, I'm still lost.

Revision history for this message
Launchpad Janitor (janitor) said :
#9

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Paul Sheer (paulsheer) said :
#10

Hi,

The reason for this failure is probably because the Electric Fence (-lefence / libefence.so) library is returning non-aligned pointers from its malloc() function.

Hope this helps

Paul

Revision history for this message
James Gosling (jamesgosling124) said :
#11

To have more chances for a positive assessment and getting approving comments https://expert-writers.net/cpm-homework-help, our dedicated writing gurus put great effort to write a well-considered proposal for your capstone to succeed.

Revision history for this message
James Gosling (jamesgosling124) said :
#12

Can your assignment wait for a couple of days? Order it in advance https://www.writemyessays.org/ and enjoy your sweet saving! If you have a complicated task at hand, the best solution is to pick a 3+ day turnaround.

Revision history for this message
Amy Patterson (amypattersonhere) said :
#13

I really fancy wasting my free time with claasmates, but commonly the university and professors don't award me that chance. That's why I had to go to the licensed https://www.thesiswritingservice.com/ service to note a paper that will cover all my requirements. And it was unusual! I didn't expected that the art they did would be such professional and absolutely perfect!

Revision history for this message
Jasmine Campbell (jasminecampbell) said :
#14

First, I was very skeptical about using all these online writing services and always tried to craft a paper on my own. But when I was suddenly required to write a recommendation letter, I got confused as I understood that it's not something you can write about yourself alone. That was the reason for searching some professional LoR services like https://www.lorwriting.com and believe me, it was totally worth it!

Revision history for this message
Josh Hall (joshhall11) said (last edit ):
#15

As soon as I've decided to have a nursing major together with suddenly I faced the troubles with writing my looking after documents. I was so nervous that I won't be able to contend with everything on my own then again I found a cool alternative: https://nursingwriting.org/nursing-assignment/! If you're a student, as with me, who find it hard to cope with all these documents alone, the best option for your needs would be to find a consultant who will craft the very best nursing paper on your behalf. This is your major to success that can make you noticed among other students and additionally increase your chances of getting a place in the desired school.

Revision history for this message
Sharon Gonzalez (sharongonzalez) said :
#16

So, I have to say I am fully satisfied by the arguments in the stuff told above. I have learned how to give some good ones from the source recommended on http://essaypapers.reviews/ because I trust all the essay papers reviews posted here.

Revision history for this message
Saint Otis (saintotis12) said :
#17

Join the fun filled https://mines-weeper.io puzzle game. The challenge opens all safe cells. Don't let the mine explode if you want to win