<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/jump_label.h, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-01-10T00:00:13+00:00</updated>
<entry>
<title>jump_label: Define guard() for jump_label_lock</title>
<updated>2025-01-10T00:00:13+00:00</updated>
<author>
<name>Masami Hiramatsu (Google)</name>
<email>mhiramat@kernel.org</email>
</author>
<published>2024-12-09T02:41:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e2b6e5e4877ac898b61338dc20491cd837af79b2'/>
<id>urn:sha1:e2b6e5e4877ac898b61338dc20491cd837af79b2</id>
<content type='text'>
Link: https://lore.kernel.org/all/173371207108.480397.12818384744149153972.stgit@devnote2/

Signed-off-by: Masami Hiramatsu (Google) &lt;mhiramat@kernel.org&gt;</content>
</entry>
<entry>
<title>jump_label,module: Don't alloc static_key_mod for __ro_after_init keys</title>
<updated>2024-03-22T10:18:16+00:00</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2024-03-13T18:01:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=91a1d97ef482c1e4c9d4c1c656a53b0f6b16d0ed'/>
<id>urn:sha1:91a1d97ef482c1e4c9d4c1c656a53b0f6b16d0ed</id>
<content type='text'>
When a static_key is marked ro_after_init, its state will never change
(after init), therefore jump_label_update() will never need to iterate
the entries, and thus module load won't actually need to track this --
avoiding the static_key::next write.

Therefore, mark these keys such that jump_label_add_module() might
recognise them and avoid the modification.

Use the special state: 'static_key_linked(key) &amp;&amp; !static_key_mod(key)'
to denote such keys.

jump_label_add_module() does not exist under CONFIG_JUMP_LABEL=n, so the
newly-introduced jump_label_init_ro() can be defined as a nop for that
configuration.

[ mingo: Renamed jump_label_ro() to jump_label_init_ro() ]

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Valentin Schneider &lt;vschneid@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@kernel.org&gt;
Link: https://lore.kernel.org/r/20240313180106.2917308-2-vschneid@redhat.com
</content>
</entry>
<entry>
<title>locking/atomic: treewide: use raw_atomic*_&lt;op&gt;()</title>
<updated>2023-06-05T07:57:20+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2023-06-05T07:01:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0f613bfa8268a89be25f2b6b58fc6fe8ccd9a2ba'/>
<id>urn:sha1:0f613bfa8268a89be25f2b6b58fc6fe8ccd9a2ba</id>
<content type='text'>
Now that we have raw_atomic*_&lt;op&gt;() definitions, there's no need to use
arch_atomic*_&lt;op&gt;() definitions outside of the low-level atomic
definitions.

Move treewide users of arch_atomic*_&lt;op&gt;() over to the equivalent
raw_atomic*_&lt;op&gt;().

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20230605070124.3741859-19-mark.rutland@arm.com
</content>
</entry>
<entry>
<title>jump_label: Prevent key-&gt;enabled int overflow</title>
<updated>2022-12-01T23:53:05+00:00</updated>
<author>
<name>Dmitry Safonov</name>
<email>dima@arista.com</email>
</author>
<published>2022-11-23T17:38:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eb8c507296f6038d46010396d91b42a05c3b64d9'/>
<id>urn:sha1:eb8c507296f6038d46010396d91b42a05c3b64d9</id>
<content type='text'>
1. With CONFIG_JUMP_LABEL=n static_key_slow_inc() doesn't have any
   protection against key-&gt;enabled refcounter overflow.
2. With CONFIG_JUMP_LABEL=y static_key_slow_inc_cpuslocked()
   still may turn the refcounter negative as (v + 1) may overflow.

key-&gt;enabled is indeed a ref-counter as it's documented in multiple
places: top comment in jump_label.h, Documentation/staging/static-keys.rst,
etc.

As -1 is reserved for static key that's in process of being enabled,
functions would break with negative key-&gt;enabled refcount:
- for CONFIG_JUMP_LABEL=n negative return of static_key_count()
  breaks static_key_false(), static_key_true()
- the ref counter may become 0 from negative side by too many
  static_key_slow_inc() calls and lead to use-after-free issues.

These flaws result in that some users have to introduce an additional
mutex and prevent the reference counter from overflowing themselves,
see bpf_enable_runtime_stats() checking the counter against INT_MAX / 2.

Prevent the reference counter overflow by checking if (v + 1) &gt; 0.
Change functions API to return whether the increment was successful.

Signed-off-by: Dmitry Safonov &lt;dima@arista.com&gt;
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>jump_label: make initial NOP patching the special case</title>
<updated>2022-06-24T07:48:55+00:00</updated>
<author>
<name>Ard Biesheuvel</name>
<email>ardb@kernel.org</email>
</author>
<published>2022-06-15T15:41:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7e6b9db27de9f69a705c1a046d45882c768e16c3'/>
<id>urn:sha1:7e6b9db27de9f69a705c1a046d45882c768e16c3</id>
<content type='text'>
Instead of defaulting to patching NOP opcodes at init time, and leaving
it to the architectures to override this if this is not needed, switch
to a model where doing nothing is the default. This is the common case
by far, as only MIPS requires NOP patching at init time. On all other
architectures, the correct encodings are emitted by the compiler and so
no initial patching is needed.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220615154142.1574619-4-ardb@kernel.org
</content>
</entry>
<entry>
<title>jump_label: mips: move module NOP patching into arch code</title>
<updated>2022-06-24T07:48:55+00:00</updated>
<author>
<name>Ard Biesheuvel</name>
<email>ardb@kernel.org</email>
</author>
<published>2022-06-15T15:41:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fdfd42892f311e2b3695852036e5be23661dc590'/>
<id>urn:sha1:fdfd42892f311e2b3695852036e5be23661dc590</id>
<content type='text'>
MIPS is the only remaining architecture that needs to patch jump label
NOP encodings to initialize them at load time. So let's move the module
patching part of that from generic code into arch/mips, and drop it from
the others.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220615154142.1574619-3-ardb@kernel.org
</content>
</entry>
<entry>
<title>jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds</title>
<updated>2022-05-27T10:34:44+00:00</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2022-05-02T10:30:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=656d054e0a15ec327bd82801ccd58201e59f6896'/>
<id>urn:sha1:656d054e0a15ec327bd82801ccd58201e59f6896</id>
<content type='text'>
When building x86_64 with JUMP_LABEL=n it's possible for
instrumentation to sneak into noinstr:

vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_count.constprop.0() leaves .noinstr.text section
vmlinux.o: warning: objtool: syscall_exit_to_user_mode+0x2d: call to static_key_count.constprop.0() leaves .noinstr.text section
vmlinux.o: warning: objtool: irqentry_exit_to_user_mode+0x1b: call to static_key_count.constprop.0() leaves .noinstr.text section

Switch to arch_ prefixed atomic to avoid the explicit instrumentation.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>jump_label: Refactor #ifdef of struct static_key</title>
<updated>2022-02-16T14:57:58+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-02-13T16:57:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cd27ccfc727e99352321c0c75012ab9c5a90321e'/>
<id>urn:sha1:cd27ccfc727e99352321c0c75012ab9c5a90321e</id>
<content type='text'>
Move #ifdef CONFIG_JUMP_LABEL inside the struct static_key.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220213165717.2354046-2-masahiroy@kernel.org
</content>
</entry>
<entry>
<title>jump_label: Avoid unneeded casts in STATIC_KEY_INIT_{TRUE,FALSE}</title>
<updated>2022-02-16T14:57:58+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-02-13T16:57:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fe65deb56e552a8c9bf7f27860dbdeac12a36116'/>
<id>urn:sha1:fe65deb56e552a8c9bf7f27860dbdeac12a36116</id>
<content type='text'>
Commit 3821fd35b58d ("jump_label: Reduce the size of struct static_key")
introduced the union to struct static_key.

It is more natual to set JUMP_TYPE_* to the .type field without casting.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220213165717.2354046-1-masahiroy@kernel.org
</content>
</entry>
<entry>
<title>jump_label: Free jump_entry::key bit1 for build use</title>
<updated>2021-05-12T12:54:55+00:00</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-05-06T19:34:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5af0ea293d78c8b8f0b87ae2b13f7ac584057bc3'/>
<id>urn:sha1:5af0ea293d78c8b8f0b87ae2b13f7ac584057bc3</id>
<content type='text'>
Have jump_label_init() set jump_entry::key bit1 to either 0 ot 1
unconditionally. This makes it available for build-time games.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210506194157.906893264@infradead.org
</content>
</entry>
</feed>
