From: Leon Romanovsky <leonro@mellanox.com>
To: Anton Volkov <avolkov@ispras.ru>
Cc: matanb@mellanox.com, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org,
Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: Re: Possible race in mlx5_ib.ko
Date: Sun, 20 Aug 2017 13:15:48 +0300 [thread overview]
Message-ID: <20170820101548.GA1724@mtr-leonro.local> (raw)
In-Reply-To: <64936cc7-12b2-3a8f-b6dc-54f6f7cf7d6a@ispras.ru>
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
On Fri, Aug 18, 2017 at 06:17:15PM +0300, Anton Volkov wrote:
> Hello.
>
> While searching for races in the Linux kernel I've come across
> "drivers/infiniband/hw/mlx5/mlx5_ib.ko" module. Here are questions that I
> came up with while analyzing results. Lines are given using the info from
> Linux v4.12.
>
> Consider the following case:
>
> Thread 1: Thread 2:
> size_write
> ->remove_keys limit_write
> ent->cur--; if (ent->cur < ent->limit)
> (mr.c: line 234) (mr.c: line 335)
> err = add_keys(... ent->limit - ent->cur);
>
> If size_write and limit_write are able to work concurrently with the same
> ent then there is a possibility of a race between the accesses to ent->cur.
> In worst case in limit_write new keys wouldn't be added. Is it feasible from
> your point of view? If so, is it a benign race or a serious one?
Technically yes, it can race, but it gives a little value to protect
the ent->check with lock, because the limit_eize instruction is triggered
by debugfs write and is used for the debug.
Thanks
>
> Thank you for your time.
>
> -- Anton Volkov
> Linux Verification Center, ISPRAS
> web: http://linuxtesting.org
> e-mail: avolkov@ispras.ru
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2017-08-20 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 15:17 Possible race in mlx5_ib.ko Anton Volkov
2017-08-20 10:15 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170820101548.GA1724@mtr-leonro.local \
--to=leonro@mellanox.com \
--cc=avolkov@ispras.ru \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox