Hi, Markus,

sorry for the late reply it was quite busy lately. You're describing exactly the issue, we are facing in our project. We need to use old kernel which we have only in binary form and have headers for it. At the same time we would like to have the latest musl running on it.

The problem we encounter is that for unsupported (or better said, not supported yet) syscalls we get performance overhead because of the ENOSYS.

We see 2 options to approach this:

 1. remove the syscalls manually/alter the code to not invoke them (hacky)
 2. during musl compile time (maybe even configure-time), parse the supplied kernel headers and based on availability of syscalls use defines to steer the code execution (more universal)

Would the 2nd case be something that musl community would be interested in, should we choose to implement it for the project?


Regards,
Martin

po 10. 5. 2021 v 20:58 odesílatel Markus Wichmann <nullplan@gmx.net> napsal:
On Mon, May 10, 2021 at 07:50:44AM +0200, Martin Vajnar wrote:
> Hello guys,
>
> I'd like to ask, if it is generally supported to run recent musl on older
> kernels? My primary concern is that there are new syscalls being added to
> linux, while at the same time I do not see a switch similar to glibc's to
> select compatibility mode (--enable-kernel). Is there some means which
> prevent invocation of unimplemented syscalls on older kernels when using
> musl?
>
> Best regards,
> Martin Vajnar

In general, musl tries to support all kernel versions from 2.6.0 on. If
you call a newer system call on a kernel that doesn't support it, you
will get ENOSYS back, but all algorithms implemented in the library will
fall back to that smallest common denominator (and some things even
further).

There is no way to prevent calls to new system calls on older kernels,
since the kernel already takes care of that.

Ciao,
Markus