lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181203222942.zkvwdws5qmkhfuhw@ltop.local>
Date:   Mon, 3 Dec 2018 23:29:43 +0100
From:   Luc Van Oostenryck <luc.vanoostenryck@...il.com>
To:     Todd Kjos <tkjos@...roid.com>
Cc:     tkjos@...gle.com, gregkh@...uxfoundation.org, arve@...roid.com,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        maco@...gle.com, joel@...lfernandes.org, kernel-team@...roid.com
Subject: Re: [PATCH] binder: fix sparse warnings on locking context

On Mon, Dec 03, 2018 at 12:24:54PM -0800, Todd Kjos wrote:
> Add __acquire()/__release() annnotations to fix warnings
> in sparse context checking
> 
> There is one case where the warning was due to a lack of
> a "default:" case in a switch statement where a lock was
> being released in each of the cases, so the default
> case was added.
> 
> Signed-off-by: Todd Kjos <tkjos@...gle.com>
> ---
>  drivers/android/binder.c       | 43 +++++++++++++++++++++++++++++++++-
>  drivers/android/binder_alloc.c |  1 +
>  2 files changed, 43 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 9f1000d2a40c7..9f2059d24ae2d 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -751,12 +757,16 @@ _binder_node_unlock(struct binder_node *node, int line)
>  #define binder_node_inner_lock(node) _binder_node_inner_lock(node, __LINE__)
>  static void
>  _binder_node_inner_lock(struct binder_node *node, int line)
> +	__acquires(&node->lock) __acquires(&node->proc->inner_lock)
>  {
>  	binder_debug(BINDER_DEBUG_SPINLOCKS,
>  		     "%s: line=%d\n", __func__, line);
>  	spin_lock(&node->lock);
>  	if (node->proc)
>  		binder_inner_proc_lock(node->proc);
> +	else
> +		/* annotation for sparse */
> +		__acquire(&node->proc->inner_lock);

This one is questionnable because:
1) if !node->proc, then '&node->proc->inner_lock' is not acquired
   since it doesn't even exist.
2) OTOH, the function can't have the annotation 100% right because
   it semantics allows unbalanced locking depending on node->proc
   being null or not.
But I see very well the intent and maybe it's a right solution.
I dunno.

Same for most of the following ones.


Best regards,
-- Luc Van Oostenryck

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ