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: <VE1PR05MB7327B86C1D232BE0B31CA248F11F9@VE1PR05MB7327.eurprd05.prod.outlook.com>
Date:   Wed, 30 Mar 2022 03:09:11 +0000
From:   Hoang Huu Le <hoang.h.le@...tech.com.au>
To:     Niels Dossche <dossche.niels@...il.com>,
        "tipc-discussion@...ts.sourceforge.net" 
        <tipc-discussion@...ts.sourceforge.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Jon Maloy <jmaloy@...hat.com>,
        Ying Xue <ying.xue@...driver.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Subject: RE: [PATCH net] tipc: use a write lock for keepalive_intv instead of
 a read lock

Hi Niels,

I did consider this function however I guess it is safe to use  tipc_node_read_lock()/unlock() since this value is being apply in this callback function. 

BTW, you must be using tipc_node_write_unlock_fast() instead of tipc_node_write_unlock().
Regards,
Hoang
> -----Original Message-----
> From: Niels Dossche <dossche.niels@...il.com>
> Sent: Tuesday, March 29, 2022 11:12 PM
> To: tipc-discussion@...ts.sourceforge.net
> Cc: netdev@...r.kernel.org; Jon Maloy <jmaloy@...hat.com>; Ying Xue <ying.xue@...driver.com>; David S. Miller
> <davem@...emloft.net>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>; Hoang Huu Le
> <hoang.h.le@...tech.com.au>; Niels Dossche <dossche.niels@...il.com>
> Subject: [PATCH net] tipc: use a write lock for keepalive_intv instead of a read lock
> 
> Currently, n->keepalive_intv is written to while n is locked by a read
> lock instead of a write lock. This seems to me to break the atomicity
> against other readers.
> Change this to a write lock instead to solve the issue.
> 
> Note:
> I am currently working on a static analyser to detect missing locks
> using type-based static analysis as my master's thesis
> in order to obtain my master's degree.
> If you would like to have more details, please let me know.
> This was a reported case. I manually verified the report by looking
> at the code, so that I do not send wrong information or patches.
> After concluding that this seems to be a true positive, I created
> this patch. I have both compile-tested this patch and runtime-tested
> this patch on x86_64. The effect on a running system could be a
> potential race condition in exceptional cases.
> This issue was found on Linux v5.17.
> 
> Fixes: f5d6c3e5a359 ("tipc: fix node keep alive interval calculation")
> Signed-off-by: Niels Dossche <dossche.niels@...il.com>
> ---
>  net/tipc/node.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/tipc/node.c b/net/tipc/node.c
> index 6ef95ce565bd..da867ddb93f5 100644
> --- a/net/tipc/node.c
> +++ b/net/tipc/node.c
> @@ -806,9 +806,9 @@ static void tipc_node_timeout(struct timer_list *t)
>  	/* Initial node interval to value larger (10 seconds), then it will be
>  	 * recalculated with link lowest tolerance
>  	 */
> -	tipc_node_read_lock(n);
> +	tipc_node_write_lock(n);
>  	n->keepalive_intv = 10000;
> -	tipc_node_read_unlock(n);
> +	tipc_node_write_unlock(n);
>  	for (bearer_id = 0; remains && (bearer_id < MAX_BEARERS); bearer_id++) {
>  		tipc_node_read_lock(n);
>  		le = &n->links[bearer_id];
> --
> 2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ