<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/closure.h, branch stable/6.9.y</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=stable%2F6.9.y</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=stable%2F6.9.y'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2023-11-24T05:29:58Z</updated>
<entry>
<title>closures: CLOSURE_CALLBACK() to fix type punning</title>
<updated>2023-11-24T05:29:58Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2023-11-18T00:13:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d4e3b928ab487a8aecd1f6a140b40ac365116cfb'/>
<id>urn:sha1:d4e3b928ab487a8aecd1f6a140b40ac365116cfb</id>
<content type='text'>
Control flow integrity is now checking that type signatures match on
indirect function calls. That breaks closures, which embed a work_struct
in a closure in such a way that a closure_fn may also be used as a
workqueue fn by the underlying closure code.

So we have to change closure fns to take a work_struct as their
argument - but that results in a loss of clarity, as closure fns have
different semantics from normal workqueue functions (they run owning a
ref on the closure, which must be released with continue_at() or
closure_return()).

Thus, this patc introduces CLOSURE_CALLBACK() and closure_type() macros
as suggested by Kees, to smooth things over a bit.

Suggested-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Coly Li &lt;colyli@suse.de&gt;
Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
</content>
</entry>
<entry>
<title>closures: Fix race in closure_sync()</title>
<updated>2023-10-31T01:48:22Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2023-10-24T18:46:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ee526b88caaa4b4182144bf2576af2c3b1e9c759'/>
<id>urn:sha1:ee526b88caaa4b4182144bf2576af2c3b1e9c759</id>
<content type='text'>
As pointed out by Linus, closure_sync() was racy; we could skip blocking
immediately after a get() and a put(), but then that would skip any
barrier corresponding to the other thread's put() barrier.

To fix this, always do the full __closure_sync() sequence whenever any
get() has happened and the closure might have been used by other
threads.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
</content>
</entry>
<entry>
<title>closures: Better memory barriers</title>
<updated>2023-10-31T01:48:22Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2023-10-24T18:46:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2bce6368c46b835a133f7f4946eea9c4513828dd'/>
<id>urn:sha1:2bce6368c46b835a133f7f4946eea9c4513828dd</id>
<content type='text'>
atomic_(dec|sub)_return_release() are a thing now - use them.

Also, delete the useless barrier in set_closure_fn(): it's redundant
with the memory barrier in closure_put(0.

Since closure_put() would now otherwise just have a release barrier, we
also need a new barrier when the ref hits 0 -
smp_acquire__after_ctrl_dep().

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
</content>
</entry>
<entry>
<title>closures: closure_nr_remaining()</title>
<updated>2023-10-19T18:47:33Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2023-03-04T07:39:39Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=48b7935722b8403fec0469ba3dafc5a0af08225d'/>
<id>urn:sha1:48b7935722b8403fec0469ba3dafc5a0af08225d</id>
<content type='text'>
Factor out a new helper, which returns the number of events outstanding.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
</content>
</entry>
<entry>
<title>closures: closure_wait_event()</title>
<updated>2023-10-19T18:47:33Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@gmail.com</email>
</author>
<published>2017-12-09T17:42:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ced58fc7ab9f2d4b3d8aaeb859321a61aa884f66'/>
<id>urn:sha1:ced58fc7ab9f2d4b3d8aaeb859321a61aa884f66</id>
<content type='text'>
Like wait_event() - except, because it uses closures and closure
waitlists it doesn't have the restriction on modifying task state inside
the condition check, like wait_event() does.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Acked-by: Coly Li &lt;colyli@suse.de&gt;
</content>
</entry>
<entry>
<title>bcache: move closures to lib/</title>
<updated>2023-10-19T18:47:33Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@gmail.com</email>
</author>
<published>2017-03-18T00:35:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8c8d2d9670e813d623d8a2cbc881cb57344f4d37'/>
<id>urn:sha1:8c8d2d9670e813d623d8a2cbc881cb57344f4d37</id>
<content type='text'>
Prep work for bcachefs - being a fork of bcache it also uses closures

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Acked-by: Coly Li &lt;colyli@suse.de&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
</content>
</entry>
</feed>
