All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cheng Xu <chengyou@linux.alibaba.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: jgg@ziepe.ca, dledford@redhat.com, linux-rdma@vger.kernel.org,
	KaiShen@linux.alibaba.com, tonylu@linux.alibaba.com
Subject: [Please ignore the two former responses]Re: [PATCH rdma-next 00/11] Elastic RDMA Adapter (ERDMA) driver
Date: Sat, 25 Dec 2021 11:03:45 +0800	[thread overview]
Message-ID: <c073d897-369d-6c15-98bc-22fb0534fc1d@linux.alibaba.com> (raw)
In-Reply-To: <YcYQ6WvZuh3hlVKN@unreal>



On 12/25/21 2:26 AM, Leon Romanovsky wrote:
> On Fri, Dec 24, 2021 at 03:07:57PM +0800, Cheng Xu wrote:
>>
>>
>> On 12/23/21 9:44 PM, Leon Romanovsky wrote:
>>> On Thu, Dec 23, 2021 at 08:59:14PM +0800, Cheng Xu wrote:
>>>>
>>>>
>>>> On 12/23/21 6:23 PM, Leon Romanovsky wrote:
>>>>> On Wed, Dec 22, 2021 at 11:35:44AM +0800, Cheng Xu wrote:
>>>>>>
>>>>>
>>>>> <...>
>>>>>
>>>>>>>>
>>>>>>>> For the ECS instance with RDMA enabled, there are two kinds of devices
>>>>>>>> allocated, one for ERDMA, and one for the original netdev (virtio-net).
>>>>>>>> They are different PCI deivces. ERDMA driver can get the information about
>>>>>>>> which netdev attached to in its PCIe barspace (by MAC address matching).
>>>>>>>
>>>>>>> This is very questionable. The netdev part should be kept in the
>>>>>>> drivers/ethernet/... part of the kernel.
>>>>>>>
>>>>>>> Thanks
>>>>>>
>>>>>> The net device used in Alibaba ECS instance is virtio-net device, driven
>>>>>> by virtio-pci/virtio-net drivers. ERDMA device does not need its own net
>>>>>> device, and will be attached to an existed virtio-net device. The
>>>>>> relationship between ibdev and netdev in erdma is similar to siw/rxe.
>>>>>
>>>>> siw/rxe binds through RDMA_NLDEV_CMD_NEWLINK netlink command and not
>>>>> through MAC's matching.
>>>>>
>>>>> Thanks
>>>>
>>>> Both siw/rxe/erdma don't need to implement netdev part, this is what I
>>>> wanted to express when I said 'similar'.
>>>> What you mentioned (the bind mechanism) is one major difference between
>>>> erdma and siw/rxe. For siw/rxe, user can attach ibdev to every netdev if
>>>> he/she wants, but it is not true for erdma. When user buys the erdma
>>>> service, he/she must specify which ENI (elastic network interface) to be
>>>> binded, it means that the attached erdma device can only be binded to
>>>> the specific netdev. Due to the uniqueness of MAC address in our ECS
>>>> instance, we use the MAC address as the identification, then the driver
>>>> knows which netdev should be binded to.
>>>
>>> Nothing prohibits from you to implement this MAC check in RDMA_NLDEV_CMD_NEWLINK.
>>> I personally don't like the idea that bind logic is performed "magically".
>>>
>>
>> OK, I agree with you that using RDMA_NLDEV_CMD_NEWLINK is better. But it
>> means that erdma can not be ready to use like other RDMA HCAs, until
>> user configure the link manually. This way may be not friendly to them.
>> I'm not sure that our current method is acceptable or not. If you
>> strongly recommend us to use RDMA_NLDEV_CMD_NEWLINK, we will change to
>> it.
> 
> Before you are rushing to change that logic, could you please explain
> the security model of this binding?
> 
> I'm as an owner of VM can replace kernel code with any code I want and
> remove your MAC matching (or replace to something different). How will
> you protect from such flow?

(I'm sorry for wrong editing format in the two former responses, please
ignore them.)

I think this topic belongs to anti-attack. One principle of anti-attack
in our cloud is that the attacker MUST NOT have influence on users but
themselves.

Before I answer the question, I want to describe some more details of
our architecture.

In our MOC architecture, virtio-net device (e.g, virtio-net back-end) is
fully offloaded to MOC, not in host hypervisor. One virtio-net device
belongs to a vport, and if it has a peer erdma device, erdma device also
belongs to the vport. The protocol headers of the network flows in the
virtio-net and erdma devices must be consistent with the vport
configurations (mac address, ip, etc. ) by checking the OVS rules.

Back to the question, we can not prevent attackers from modifying the
code, making devices binding wrongly in the front-end, or in some worse
cases, making driver sending invalid commands to devices. If binding
wrongly, the erdma network will be unreachable, because the OVS module
in MOC hardware can distinguish this situation and drop all the invalid
network packets, and this has no influence to other users.

> If you don't trust VM, you should perform binding in hypervisor and
> this erdma driver will work out-of-the-box in the VM.

As mentioned above, we also have the binding configuration in the
back-end (e.g, MOC hardware), only when the configuration is correct of
the front-end, the erdma can work properly.

Thanks,
Cheng Xu

> Thanks
> 

  parent reply	other threads:[~2021-12-25  3:04 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21  2:48 [PATCH rdma-next 00/11] Elastic RDMA Adapter (ERDMA) driver Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 01/11] RDMA: Add ERDMA to rdma_driver_id definition Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 02/11] RDMA/erdma: Add the hardware related definitions Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 03/11] RDMA/erdma: Add main include file Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 04/11] RDMA/erdma: Add cmdq implementation Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 05/11] RDMA/erdma: Add event queue implementation Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 06/11] RDMA/erdma: Add verbs header file Cheng Xu
2021-12-21 13:28   ` Leon Romanovsky
2021-12-22  2:36     ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 07/11] RDMA/erdma: Add verbs implementation Cheng Xu
2021-12-21 13:32   ` Leon Romanovsky
2021-12-21 15:20     ` Bernard Metzler
2021-12-22  3:11       ` Cheng Xu
2021-12-22  4:18         ` Cheng Xu
2021-12-22 12:46         ` Bernard Metzler
2021-12-23  8:38           ` Cheng Xu
2021-12-22  2:50     ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 08/11] RDMA/erdma: Add connection management (CM) support Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 09/11] RDMA/erdma: Add the erdma module Cheng Xu
2021-12-21 13:26   ` Leon Romanovsky
2021-12-22  2:33     ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 10/11] RDMA/erdma: Add the ABI definitions Cheng Xu
2021-12-21 11:57   ` kernel test robot
2021-12-21 11:57     ` kernel test robot
2021-12-22 16:14   ` kernel test robot
2021-12-22 16:14     ` kernel test robot
2021-12-23 15:46   ` Yanjun Zhu
2021-12-23 18:45     ` Leon Romanovsky
2021-12-23 22:55       ` Yanjun Zhu
2021-12-24  6:04         ` Leon Romanovsky
2021-12-24  7:54           ` Yanjun Zhu
2021-12-24 18:11             ` Leon Romanovsky
2021-12-24  7:12         ` Cheng Xu
2021-12-24  8:02           ` Yanjun Zhu
2021-12-24 18:19           ` Leon Romanovsky
2021-12-25  0:03             ` Yanjun Zhu
2021-12-25  3:36             ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 11/11] RDMA/erdma: Add driver to kernel build environment Cheng Xu
2021-12-22  0:58   ` kernel test robot
2021-12-22  0:58     ` kernel test robot
2021-12-21 13:09 ` [PATCH rdma-next 00/11] Elastic RDMA Adapter (ERDMA) driver Leon Romanovsky
2021-12-22  3:35   ` Cheng Xu
2021-12-23 10:23     ` Leon Romanovsky
2021-12-23 12:59       ` Cheng Xu
2021-12-23 13:44         ` Leon Romanovsky
2021-12-24  7:07           ` Cheng Xu
2021-12-24 18:26             ` Leon Romanovsky
2021-12-25  2:54               ` Cheng Xu
2021-12-25  2:57               ` Cheng Xu
2021-12-25  3:03               ` Cheng Xu [this message]
2022-01-07 14:24         ` Jason Gunthorpe
2022-01-10 10:07           ` Cheng Xu

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=c073d897-369d-6c15-98bc-22fb0534fc1d@linux.alibaba.com \
    --to=chengyou@linux.alibaba.com \
    --cc=KaiShen@linux.alibaba.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=tonylu@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.