mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 13:19:56 -04:00
crypto: Enable context analysis
Enable context analysis for crypto subsystem. This demonstrates a larger conversion to use Clang's context analysis. The benefit is additional static checking of locking rules, along with better documentation. Note the use of the __acquire_ret macro how to define an API where a function returns a pointer to an object (struct scomp_scratch) with a lock held. Additionally, the analysis only resolves aliases where the analysis unambiguously sees that a variable was not reassigned after initialization, requiring minor code changes. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20251219154418.3592607-36-elver@google.com
This commit is contained in:
committed by
Peter Zijlstra
parent
87335b61a2
commit
dc36d55d4e
@@ -191,11 +191,12 @@ static inline bool crypto_acomp_req_virt(struct crypto_acomp *tfm)
|
||||
void crypto_acomp_free_streams(struct crypto_acomp_streams *s);
|
||||
int crypto_acomp_alloc_streams(struct crypto_acomp_streams *s);
|
||||
|
||||
struct crypto_acomp_stream *crypto_acomp_lock_stream_bh(
|
||||
struct crypto_acomp_streams *s) __acquires(stream);
|
||||
#define crypto_acomp_lock_stream_bh(...) __acquire_ret(_crypto_acomp_lock_stream_bh(__VA_ARGS__), &__ret->lock);
|
||||
struct crypto_acomp_stream *_crypto_acomp_lock_stream_bh(
|
||||
struct crypto_acomp_streams *s) __acquires_ret;
|
||||
|
||||
static inline void crypto_acomp_unlock_stream_bh(
|
||||
struct crypto_acomp_stream *stream) __releases(stream)
|
||||
struct crypto_acomp_stream *stream) __releases(&stream->lock)
|
||||
{
|
||||
spin_unlock_bh(&stream->lock);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct crypto_engine {
|
||||
|
||||
struct list_head list;
|
||||
spinlock_t queue_lock;
|
||||
struct crypto_queue queue;
|
||||
struct crypto_queue queue __guarded_by(&queue_lock);
|
||||
struct device *dev;
|
||||
|
||||
struct kthread_worker *kworker;
|
||||
|
||||
Reference in New Issue
Block a user