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>] [day] [month] [year] [list]
Message-ID: <edd8f7978f674449bca8c436207c34f5@h3c.com>
Date:   Fri, 1 Jan 2021 09:03:11 +0000
From:   Gaoyan <gao.yanB@....com>
To:     Greg KH <gregkh@...uxfoundation.org>
CC:     "jirislaby@...nel.org" <jirislaby@...nel.org>,
        "paulus@...ba.org" <paulus@...ba.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [v2]net:ppp: remove disc_data_lock in ppp line discipline

Hi Greg KH:

We have a potential race on dereferencing tty->disc_data, so we should use some locks to avoid the competition.
In the current version, it defines disc_data_lock to protect the race of ppp_asynctty_receive and ppp_asynctty_close.
However, I think when cpu A is running ppp_asynctty_receive, another cpu B will not run ppp_asynctty_close at the same time.
The reasons are as follows:

Cpu A will hold tty->ldisc_sem before running ppp_asynctty_receive. If cpu B wants to run ppp_asynctty_close, it must 
wait until cpu A release tty->ldisc_sem after ppp_asynctty_receive.

So I think tty->ldisc_sem already can protect the tty->disc_data.

About your question:
What changed from v1?
==>just change some description.
And how did you test this?  Why remove this lock, is it causing problems somewhere for it to be here?
==>Somedays ago, There is a problem in n_tty line discipline. Specific description is here:
https://lkml.org/lkml/2020/12/9/339
At the beginning I tried to add a lock in the layer of n_tty, until I find the patch 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.9-rc4&id=83d817f41070c48bc3eb7ec18e43000a548fca5c
About the patch, Specific description is here:
https://lkml.org/lkml/2018/8/29/555


Thanks
Gao Yan




----- Original mail -----

On Fri, Jan 01, 2021 at 11:37:18AM +0800, Gao Yan wrote:
> In tty layer, it provides tty->ldisc_sem to protect all tty_ldisc_ops 
> including ppp_sync_ldisc. So I think tty->ldisc_sem can also protect 
> tty->disc_data, and the disc_data_lock is not necessary.
> 
> Signed-off-by: Gao Yan <gao.yanB@....com>
> ---
>  drivers/net/ppp/ppp_async.c   | 11 ++---------
>  drivers/net/ppp/ppp_synctty.c | 12 ++----------
>  2 files changed, 4 insertions(+), 19 deletions(-)

What changed from v1?

And how did you test this?  Why remove this lock, is it causing problems somewhere for it to be here?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ