Re: [PATCH v1] uml: remove support for CONFIG_STATIC_LINK

From: Anton Ivanov
Date: Thu Dec 12 2019 - 02:15:28 EST


On 12/12/2019 05:23, James McMechan wrote:
Fixed up version without html...
Um what is broken, uml seems to be working with the old stack and static linking.

I saw a comment that the vector io stuff breaks uml on static link,
but I was just running one without vector io, I had the pcap library linked in instead.
It was up for about 3 days when I rebooted from mconsole 'cad'
It would seem simplest to just mark vector io as !STATIC in the config...
I was running 5.4.2 with a pretty close to defconfig

I had to twiddle the uml pcap a little to deconflict the headers, and make sure pcap was not linking to dbus.
I have not looked into vector io too closely I seemed to remember it was using host getaddrinfo the only thing in uml doing so I think it was pulling in the glibc, so-so dynamically link networking even when told not to... and that was breaking the startup process by changing memory maps behind the programs back or some such and then segfaulting the process much like the "we will implement async io in userspace behind the processes back" did back in the day.

I would expect it to be possible to remove the getaddrinfo or use kernel functions.

If you just try to do 1:1 replacement with the legacy functions you stop being v6 compliant. You after that need to go through quite a lot of hoops and extra code to get that back.

You cannot use kernel functions - this is on the host userspace side of UML.

It does not seem to have much in the way of comments, and I don't understand what it is trying to do.
Why would a network protocol need to lookup "protocol/ip address/port num" sets in userspace? it should just be passing everything somewhere...
Is it trying to do dynamic routing of the packets to different transports?

It is using shared code for (at present) tap (two forms - one optimized for throughput, one using a tap/socket pair optimized for packets per second), raw sockets, gre, l2tpv3 (both raw and over udp) and one flavour unix domain sockets.

Both gre and l2tpv3 support v4 and v6.

While it is possible to replace getaddrinfo with a sequence of gethostbyname, etc it will:

1. Grow the size of the code by at least 100 lines if not more. If I take care of all corner cases which getaddrinfo() does - more.

2. Defeat one of the purposes of the exercise - to make it easy to add new socket transports.

3. There is no guarantee that the glibc guys will not make gethostbyname and friends fallback to getaddrinfo internally one day (in fact I am surprised they have not done it yet).


Slight confused but still running,

Jim McMechan



--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/