Re: boost::asio and seccomp

Marek Küthe <[email protected]> Tue, 18 Nov 2025 17:39:34 +0000
Newsgroups gmane.comp.lib.boost.asio.user,gmane.comp.lib.boost.user
Message-ID <20251118173934.55632818@ciel>
--===============2301772646379249989==
Content-Type: multipart/signed; boundary="Sig_/be4B.ukUdH/GVQa32y9=67J";
 protocol="application/pgp-signature"; micalg=pgp-sha512

--Sig_/be4B.ukUdH/GVQa32y9=67J
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thanks for your reply, Christian.

On Mon, 17 Nov 2025 17:39:17 +0100
Christian Eggers <[email protected]> wrote:

> at least the asio-users list looks dead to me ...

I was unsure about that too, so I wrote to boost-users (at least I
should have) as well. Is there perhaps another forum or something
similar?

> On Monday, 17 November 2025, 16:52:34 CET, Marek K=C3=BCthe wrote:
> > Hello,
> >=20
> > I would like to make my program more secure under Linux with seccomp.
> > My question is: how can I query which backend boost::asio uses (epoll,
> > select, etc.)?  =20
>=20
> <disclaimer>I am not an ASIO expert</disclaimer>
>=20
> As far is I understand, (boost::)asio uses epoll by default under Linux.
> This a compile time decision, not runtime. Everything is configured by ma=
cros
> which are documented here:

Thanks for confirming that. That's how I understood it too.

> https://www.boost.org/doc/libs/latest/doc/html/boost_asio/using.html#boos=
t_asio.using.macros
>=20
> The default values of the macros are determined by the values of various =
BOOST_ASIO_HAS_
> macros which in turn get their defaults mostly depending on the target pl=
atform.

The challenge for me now is to use the macros to determine which
backend boost::asio uses. Unfortunately, there is not a BOOST_ASIO_HAS_
for every syscall, and the logic behind how this is implemented does
not seem to be documented.

> As (boost::)asio is (by default) a header only library, you have to set t=
hose
> defines during compilation of your application (at least for the source
> files where you include the ASIO headers).
>=20
> As an alternative to epoll/(p)poll/select you may also use the io_uring
> backend (requires liburing and kernel support). The release notes for Boo=
st 1.78
> tell how to enable this:
>=20
> https://www.boost.org/doc/libs/latest/doc/html/boost_asio/history.html#bo=
ost_asio.history.asio_1_22_0___boost_1_78

If I only wanted to sandbox the program for myself, that would probably
be sufficient. However, I want my program to sandbox itself using
libseccomp. Perhaps I didn't express that clearly.

> > I would also like to know which system calls boost::asio
> > uses for which Linux backend. =20
> You probably may run your application under 'strace' in order to see
> all kernel calls made by your application. I would suggest starting with
> a trivial application (single process, e.g. single threaded, not too
> many i/o objects) for getting understandable output.

That's a good idea. However, in theory, in order to capture all
syscalls, I would have to compile the program in different combinations
and run strace.

--=20
Marek K=C3=BCthe
[email protected]
er/ihm he/him

--Sig_/be4B.ukUdH/GVQa32y9=67J
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEmqKBWfzrPNg7whIBfoaRRmmRCMcFAmkcr1cACgkQfoaRRmmR
CMdH9RAAj/BpG9dUayzd3pNnOitXtYMLwL7lZSk5m6KoJXtPciBA3NgKMP62ncUy
z605Q+45s1PtXXTbog0KdgZWICcWpplj64R+BL/l3ovHJ4ODaUvpIlCtyfrkjBOP
fhYa8iC5iEfBcF87A4rjsfD5YiY7mbw9a88fSXmx/y4BQhJxc3uwDZUdiLz943ux
ycLY0OWqR32T9JRHo8IGxa+AzW28tRaOIjasl0r1UxU40FMI1B7aBNytfUXK+U+T
BgR8zGe6UOfnDGlOK4eooxiWyCuukAVZkLqYowuSWNNuVKS76CVYa0DkfZE4snYn
GPiCiYirRdPDjXxuHfDYQoDApOB50P2UcahzbpPzkEpxkEQZiRAllX0p0habQKu2
PO5XCuGHj4cTNHRl04RIUDNb3pUEqtDkX5xMXgjLWUiECIIumG/Hc5guiues6k4A
bQeEluffAgeckwt1K72uiE1a6NE4wpq5R2Zu8FSpXfhKQnKUphwi68P3bVx+mYUq
oRzieA3e96US3EKwLACzzaMmIt2i1WzfRFZgNXm5MccOGhGvgHLz1ibbnAXo3PUe
uOcALueJJ6VNZ8jlRWQjXT/sPUqXl0M9n5Y/0mRerMmXYTnI5NWayxWjWC+g6fAY
cuPJ6fem7mUwDqbKrcY6bgpN417FVTO2gzE3tnkkOtGli9n2wNY=
=PzM/
-----END PGP SIGNATURE-----

--Sig_/be4B.ukUdH/GVQa32y9=67J--


--===============2301772646379249989==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============2301772646379249989==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
asio-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

--===============2301772646379249989==--