<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/include/nolibc/stackprotector.h, branch v7.2-rc1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.2-rc1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.2-rc1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-05-24T21:52:58+00:00</updated>
<entry>
<title>tools/nolibc: stackprotector: Avoid stalling program startup if crng is not init yet</title>
<updated>2026-05-24T21:52:58+00:00</updated>
<author>
<name>Daniel Palmer</name>
<email>daniel@thingy.jp</email>
</author>
<published>2026-05-22T09:07:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b882d807fa443b529ae8bf917d7b640a8d555437'/>
<id>urn:sha1:b882d807fa443b529ae8bf917d7b640a8d555437</id>
<content type='text'>
We are using the getrandom syscall to get a random seed for the
stack protector canary but we are calling it with no flags which means
it'll block until there is some real randomness to return.

This means that if the crng is not ready yet program startup will
block and if you are unlucky that could be for a long time and
look like the program has crashed.

Even if the call to getrandom does not yield any random data,
we will still initialize the canary.

Fixes: 7188d4637e95 ("tools/nolibc: add support for stack protector")
Signed-off-by: Daniel Palmer &lt;daniel@thingy.jp&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260522090726.726985-1-daniel@thingy.jp
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: Rename __no_stack_protector to __nolibc_no_stack_protector</title>
<updated>2026-04-27T16:14:47+00:00</updated>
<author>
<name>Daniel Palmer</name>
<email>daniel@thingy.jp</email>
</author>
<published>2026-04-25T11:13:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9adc1c33a10491b0f97152facce186f073ac91e3'/>
<id>urn:sha1:9adc1c33a10491b0f97152facce186f073ac91e3</id>
<content type='text'>
To avoid polluting the namespace rename __no_stack_protector to
__nolibc_no_stack_protector so its now within the nolibc umbrella.

Suggested-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Daniel Palmer &lt;daniel@thingy.jp&gt;
Link: https://patch.msgid.link/20260425111315.3191461-2-daniel@thingy.jp
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: rename my_syscallX() to __nolibc_syscallX()</title>
<updated>2026-02-25T07:21:17+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2026-02-23T21:40:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=55f1d6a9d6780e779e882a4d2d1b3db311835798'/>
<id>urn:sha1:55f1d6a9d6780e779e882a4d2d1b3db311835798</id>
<content type='text'>
The naming convention of the my_syscallX() macros is a bit unfortunate.
They may conflict with application code and the name is very generic.

Switch to __nolibc_syscallX(). The leading underscores place the symbols
in the implementation-defined namespace, avoiding conflicting names.
It is also clearer that these are non-standard extensions from nolibc.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://patch.msgid.link/20260223-nolibc-namespacing-v1-1-52574ffebb2c@weissschuh.net
</content>
</entry>
<entry>
<title>tools/nolibc: add option to disable runtime</title>
<updated>2025-10-29T15:29:16+00:00</updated>
<author>
<name>Benjamin Berg</name>
<email>benjamin.berg@intel.com</email>
</author>
<published>2025-09-24T14:20:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3d66c4e14fbf4d59ca4665391d133655fa668042'/>
<id>urn:sha1:3d66c4e14fbf4d59ca4665391d133655fa668042</id>
<content type='text'>
In principle, it is possible to use nolibc for only some object files in
a program. In that case, the startup code in _start and _start_c is not
going to be used. Add the NOLIBC_NO_RUNTIME compile time option to
disable it entirely and also remove anything that depends on it.

Doing this avoids warnings from modpost for UML as the _start_c code
references the main function from the .init.text section while it is not
inside .init itself.

Signed-off-by: Benjamin Berg &lt;benjamin.berg@intel.com&gt;
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: add prototypes for non-static functions</title>
<updated>2025-02-03T19:57:37+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2025-01-23T20:10:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0de64754a55470adb0a870f3105c8922334bb6fe'/>
<id>urn:sha1:0de64754a55470adb0a870f3105c8922334bb6fe</id>
<content type='text'>
With -Wmissing-prototypes the compiler will warn about non-static
functions which don't have a prototype defined.
This warning doesn't make much sense for nolibc itself but for user code
it is still useful.
To pacify the compiler add prototypes next to the function definitions,
similar to how it is handled elsewhere in the kernel.

Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://lore.kernel.org/r/20250123-nolibc-prototype-v1-1-e1afc5c1999a@weissschuh.net
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: stackprotector: mark implicitly used symbols as used</title>
<updated>2024-08-16T15:23:13+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2024-08-12T20:50:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ff7b9abbfce985b92f71c855246508edb0980cd6'/>
<id>urn:sha1:ff7b9abbfce985b92f71c855246508edb0980cd6</id>
<content type='text'>
During LTO the references from the compiler-generated prologue and
epilogues to the stack protector symbols are not visible and the symbols
are removed.
This will then lead to errors during linking.
As those symbols are already #ifdeffed-out if unused mark them as "used"
to prevent their removal.

Acked-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://lore.kernel.org/r/20240812-nolibc-lto-v2-2-736af7bbefa8@weissschuh.net
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: stackprotector.h: make __stack_chk_init static</title>
<updated>2023-08-23T03:17:07+00:00</updated>
<author>
<name>Zhangjin Wu</name>
<email>falcon@tinylab.org</email>
</author>
<published>2023-08-05T06:12:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dcb677c3d3290c18cfdbc54d2f8fcf0279c06206'/>
<id>urn:sha1:dcb677c3d3290c18cfdbc54d2f8fcf0279c06206</id>
<content type='text'>
This allows to generate smaller text/data/dec size.

As the _start_c() function added by crt.h, __stack_chk_init() is called
from _start_c() instead of the assembly _start. So, it is able to mark
it with static now.

Reviewed-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Signed-off-by: Zhangjin Wu &lt;falcon@tinylab.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: stackprotector.h: add empty __stack_chk_init for !_NOLIBC_STACKPROTECTOR</title>
<updated>2023-08-23T02:40:22+00:00</updated>
<author>
<name>Zhangjin Wu</name>
<email>falcon@tinylab.org</email>
</author>
<published>2023-07-15T18:22:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d7f16723d37c6aeaa4fb93b433db367ad8398b9c'/>
<id>urn:sha1:d7f16723d37c6aeaa4fb93b433db367ad8398b9c</id>
<content type='text'>
Let's define an empty __stack_chk_init for the !_NOLIBC_STACKPROTECTOR
branch.

This allows to remove #ifdef around every call of __stack_chk_init().

Signed-off-by: Zhangjin Wu &lt;falcon@tinylab.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: fix segfaults on compilers without attribute no_stack_protector</title>
<updated>2023-06-09T18:46:08+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2023-05-24T06:44:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e76b70dec9c257f4ccebd7f98d1de97ed071f0d1'/>
<id>urn:sha1:e76b70dec9c257f4ccebd7f98d1de97ed071f0d1</id>
<content type='text'>
Not all compilers, notably GCC &lt; 10, have support for
__attribute__((no_stack_protector)).
Fall back to a mechanism that also works there.

Tested with GCC 9.5.0 from kernel.org crosstools.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/nolibc: add autodetection for stackprotector support</title>
<updated>2023-06-09T18:46:08+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2023-05-21T09:36:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=818924d1295ea16db267ea6defe08b21243583b6'/>
<id>urn:sha1:818924d1295ea16db267ea6defe08b21243583b6</id>
<content type='text'>
The stackprotector support in nolibc should be enabled iff it is also
enabled in the compiler.
Use the preprocessor defines added by gcc and clang if stackprotector
support is enable to automatically do so in nolibc.

This completely removes the need for any user-visible API.

To avoid inlining the lengthy preprocessor check into every user
introduce a new header compiler.h that abstracts the logic away.

As the define NOLIBC_STACKPROTECTOR is now not user-relevant anymore
prefix it with an underscore.

Suggested-by: Willy Tarreau &lt;w@1wt.eu&gt;
Link: https://lore.kernel.org/lkml/20230520133237.GA27501@1wt.eu/
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
</entry>
</feed>
