|
|
Message-ID: <Pine.BSM.4.64L.2406170426130.32337@herc.mirbsd.org>
Date: Mon, 17 Jun 2024 04:29:35 +0000 (UTC)
From: Thorsten Glaser <tg@...bsd.de>
To: musl@...ts.openwall.com
Subject: Re: Question about flexible array
樊鹏 dixit:
>The reason is a difference between gcc and g++:
>
>Flexible array members are not officially part of C++.
>Flexible array members were officially standardized in C99.
>/usr/include/bits/signal.h:35:23: error: flexible array member 'mcontext_t::__extcontext' not at end of 'struct tbb::detail::r1::coroutine_type'
No, that’s not the problem here (the compiler allows that).
The problem is this, in oneTBB itself:
struct coroutine_type {
coroutine_type() : my_context(), my_stack(), my_stack_size() {}
ucontext_t my_context;
void* my_stack;
std::size_t my_stack_size;
};
There’s a double problem here. One is the ordering. Changing to…
struct coroutine_type {
coroutine_type() : my_context(), my_stack(), my_stack_size() {}
void* my_stack;
std::size_t my_stack_size;
ucontext_t my_context;
};
… would fix that, but I *bet* that the surrounding code allocates
its struct coroutine_type by a fixed size and copies my_context
by sizeof(ucontext_t), which necessarily does not include the FAM.
I’m not sure if it is even permissible for ucontext_t to contain
a FAM; perhaps instead you need to figure out the exact or a
maximum size and change the declaration (and the ABI, most likely)
to that?
Otherwise, all that’s left is to forbid userspace the copying of
ucontext_t, which probably won’t fly…
bye,
//mirabilos
--
“ah that reminds me, thanks for the stellar entertainment that you and certain
other people provide on the Debian mailing lists │ sole reason I subscribed to
them (I'm not using Debian anywhere) is the entertainment factor │ Debian does
not strike me as a place for good humour, much less German admin-style humour”
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.