* [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault.
[not found] ` <20171013184347.28410.87093.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
@ 2017-10-13 18:43 ` Michael J. Ruhl
[not found] ` <20171013184352.28410.32200.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Michael J. Ruhl @ 2017-10-13 18:43 UTC (permalink / raw)
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb
From: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
When using the ibacm from rdma-core commit bf03566e0aa976afc5df,
setting the provider keyword in the ibacm_opts.cfg file to something
other than 'default' will cause ibacm to segfault on startup:
ibacm[32739]: segfault at 302e40 ip 000000000040432d
sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]
To re-produce the segfault, change the provider keyword in
ibacm_opts.cfg from:
provider ibacmp default
to:
provider ibacmp 0xFE80000000000000
When adding subnets to a provider subnet list, the incorrect list is
used. The list used is the provider_list (list of all providers)
rather than the (specific) provider subnet list.
This corrupts the provider_list, and causes ibacm to crash with the
above segfault.
Use the correct list when adding subnet information to a provider.
Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
ibacm/src/acm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index 1ccef94..a67001d 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void)
return;
}
subnet->subnet_prefix = htobe64(prefix);
- list_add_after(&provider_list, &prov->entry,
- &subnet->entry);
+ list_add_tail(&prov->subnet_list,
+ &subnet->entry);
}
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault.
[not found] ` <20171013184352.28410.32200.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
@ 2017-10-16 4:58 ` Leon Romanovsky
0 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2017-10-16 4:58 UTC (permalink / raw)
To: Michael J. Ruhl
Cc: sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb
[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]
On Fri, Oct 13, 2017 at 02:43:52PM -0400, Michael J. Ruhl wrote:
> From: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> When using the ibacm from rdma-core commit bf03566e0aa976afc5df,
That commit is unrelated to ibacm. I think that we can remove this line.
> setting the provider keyword in the ibacm_opts.cfg file to something
> other than 'default' will cause ibacm to segfault on startup:
>
> ibacm[32739]: segfault at 302e40 ip 000000000040432d
> sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]
>
> To re-produce the segfault, change the provider keyword in
> ibacm_opts.cfg from:
>
> provider ibacmp default
>
> to:
>
> provider ibacmp 0xFE80000000000000
>
> When adding subnets to a provider subnet list, the incorrect list is
> used. The list used is the provider_list (list of all providers)
> rather than the (specific) provider subnet list.
>
> This corrupts the provider_list, and causes ibacm to crash with the
> above segfault.
>
> Use the correct list when adding subnet information to a provider.
>
> Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> ibacm/src/acm.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
> index 1ccef94..a67001d 100644
> --- a/ibacm/src/acm.c
> +++ b/ibacm/src/acm.c
> @@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void)
> return;
> }
> subnet->subnet_prefix = htobe64(prefix);
> - list_add_after(&provider_list, &prov->entry,
> - &subnet->entry);
> + list_add_tail(&prov->subnet_list,
> + &subnet->entry);
> }
> }
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast()
@ 2017-10-16 14:19 Michael J. Ruhl
[not found] ` <20171016141945.11276.1068.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Michael J. Ruhl @ 2017-10-16 14:19 UTC (permalink / raw)
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb
From: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
The MLID value passed to ibv_attach/detach_mcast() must be in host
byte order.
acmp.c incorrectly uses the big endian format when doing a multicast
attach/detach (join). Multicast packets are used to do name resolution
by the libibacmp library.
There are two possible results because of this issue.
If a kernel has commit 8561eae60ff9, the attach will fail with an
EINVAL. ibacm will log this as a failure during the multicast join.
If a kernel does not have commit 8561eae60ff9, the attach will
complete successfully. Packets sent to this address will be dropped
because the packet dlid value and the multicast address information
given by the attach will not match.
Update MLID usage to use the correct byte order.
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
ibacm/prov/acmp/src/acmp.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
index aa78416..78d9a29 100644
--- a/ibacm/prov/acmp/src/acmp.c
+++ b/ibacm/prov/acmp/src/acmp.c
@@ -732,7 +732,7 @@ static void acmp_process_join_resp(struct acm_sa_mad *sa_mad)
acm_log(0, "ERROR - unable to create ah\n");
goto out;
}
- ret = ibv_attach_mcast(ep->qp, &mc_rec->mgid, mc_rec->mlid);
+ ret = ibv_attach_mcast(ep->qp, &dest->mgid, dest->av.dlid);
if (ret) {
acm_log(0, "ERROR - unable to attach QP to multicast group\n");
ibv_destroy_ah(dest->ah);
@@ -1429,7 +1429,7 @@ static void acmp_ep_join(struct acmp_ep *ep)
if (ep->mc_dest[0].state == ACMP_READY && ep->mc_dest[0].ah) {
ibv_detach_mcast(ep->qp, &ep->mc_dest[0].mgid,
- be16toh(ep->mc_dest[0].av.dlid));
+ ep->mc_dest[0].av.dlid);
ibv_destroy_ah(ep->mc_dest[0].ah);
ep->mc_dest[0].ah = NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault
[not found] ` <20171016141945.11276.1068.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
@ 2017-10-16 14:19 ` Michael J. Ruhl
[not found] ` <20171016141950.11276.59779.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 14:24 ` [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast() Ruhl, Michael J
1 sibling, 1 reply; 6+ messages in thread
From: Michael J. Ruhl @ 2017-10-16 14:19 UTC (permalink / raw)
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb
From: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Setting the provider keyword in the ibacm_opts.cfg file to something
other than 'default' will cause ibacm to segfault on startup:
ibacm[32739]: segfault at 302e40 ip 000000000040432d
sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]
To re-produce the segfault, change the provider keyword in
ibacm_opts.cfg from:
provider ibacmp default
to:
provider ibacmp 0xFE80000000000000
When adding subnets to a provider subnet list, the incorrect list is
used. The list used is the provider_list (list of all providers)
rather than the (specific) provider subnet list.
This corrupts the provider_list, and causes ibacm to crash with the
above segfault.
Use the correct list when adding subnet information to a provider.
Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
ibacm/src/acm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index 1ccef94..a67001d 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void)
return;
}
subnet->subnet_prefix = htobe64(prefix);
- list_add_after(&provider_list, &prov->entry,
- &subnet->entry);
+ list_add_tail(&prov->subnet_list,
+ &subnet->entry);
}
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault
[not found] ` <20171016141950.11276.59779.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
@ 2017-10-16 14:22 ` Ruhl, Michael J
0 siblings, 0 replies; 6+ messages in thread
From: Ruhl, Michael J @ 2017-10-16 14:22 UTC (permalink / raw)
To: Ruhl, Michael J; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Missed the versioning information. Please ignore these two patches.
Resending with the correct information.
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> owner@vger.kernel.org] On Behalf Of Michael J. Ruhl
> Sent: Monday, October 16, 2017 10:20 AM
> To: Hefty, Sean <sean.hefty@intel.com>
> Cc: linux-rdma@vger.kernel.org; hal@dev.mellanox.co.il
> Subject: [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a
> segfault
>
> From: Michael J. Ruhl <michael.j.ruhl@intel.com>
>
> Setting the provider keyword in the ibacm_opts.cfg file to something
> other than 'default' will cause ibacm to segfault on startup:
>
> ibacm[32739]: segfault at 302e40 ip 000000000040432d
> sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]
>
> To re-produce the segfault, change the provider keyword in
> ibacm_opts.cfg from:
>
> provider ibacmp default
>
> to:
>
> provider ibacmp 0xFE80000000000000
>
> When adding subnets to a provider subnet list, the incorrect list is
> used. The list used is the provider_list (list of all providers)
> rather than the (specific) provider subnet list.
>
> This corrupts the provider_list, and causes ibacm to crash with the
> above segfault.
>
> Use the correct list when adding subnet information to a provider.
>
> Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> ---
> ibacm/src/acm.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
> index 1ccef94..a67001d 100644
> --- a/ibacm/src/acm.c
> +++ b/ibacm/src/acm.c
> @@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void)
> return;
> }
> subnet->subnet_prefix = htobe64(prefix);
> - list_add_after(&provider_list, &prov->entry,
> - &subnet->entry);
> + list_add_tail(&prov->subnet_list,
> + &subnet->entry);
> }
> }
> }
>
> --
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast()
[not found] ` <20171016141945.11276.1068.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 14:19 ` [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault Michael J. Ruhl
@ 2017-10-16 14:24 ` Ruhl, Michael J
1 sibling, 0 replies; 6+ messages in thread
From: Ruhl, Michael J @ 2017-10-16 14:24 UTC (permalink / raw)
To: Ruhl, Michael J; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2863 bytes --]
Missed the versioning information, please ignore this patch.
Resending with correct info.
Mike
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> owner@vger.kernel.org] On Behalf Of Michael J. Ruhl
> Sent: Monday, October 16, 2017 10:20 AM
> To: Hefty, Sean <sean.hefty@intel.com>
> Cc: linux-rdma@vger.kernel.org; hal@dev.mellanox.co.il
> Subject: [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID
> attach/detach_mcast()
>
> From: Michael J. Ruhl <michael.j.ruhl@intel.com>
>
> The MLID value passed to ibv_attach/detach_mcast() must be in host
> byte order.
>
> acmp.c incorrectly uses the big endian format when doing a multicast
> attach/detach (join). Multicast packets are used to do name resolution
> by the libibacmp library.
>
> There are two possible results because of this issue.
>
> If a kernel has commit 8561eae60ff9, the attach will fail with an
> EINVAL. ibacm will log this as a failure during the multicast join.
>
> If a kernel does not have commit 8561eae60ff9, the attach will
> complete successfully. Packets sent to this address will be dropped
> because the packet dlid value and the multicast address information
> given by the attach will not match.
>
> Update MLID usage to use the correct byte order.
>
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> ---
> ibacm/prov/acmp/src/acmp.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c
> index aa78416..78d9a29 100644
> --- a/ibacm/prov/acmp/src/acmp.c
> +++ b/ibacm/prov/acmp/src/acmp.c
> @@ -732,7 +732,7 @@ static void acmp_process_join_resp(struct
> acm_sa_mad *sa_mad)
> acm_log(0, "ERROR - unable to create ah\n");
> goto out;
> }
> - ret = ibv_attach_mcast(ep->qp, &mc_rec->mgid, mc_rec-
> >mlid);
> + ret = ibv_attach_mcast(ep->qp, &dest->mgid, dest->av.dlid);
> if (ret) {
> acm_log(0, "ERROR - unable to attach QP to multicast
> group\n");
> ibv_destroy_ah(dest->ah);
> @@ -1429,7 +1429,7 @@ static void acmp_ep_join(struct acmp_ep *ep)
>
> if (ep->mc_dest[0].state == ACMP_READY && ep->mc_dest[0].ah) {
> ibv_detach_mcast(ep->qp, &ep->mc_dest[0].mgid,
> - be16toh(ep->mc_dest[0].av.dlid));
> + ep->mc_dest[0].av.dlid);
> ibv_destroy_ah(ep->mc_dest[0].ah);
> ep->mc_dest[0].ah = NULL;
> }
>
> --
> 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
N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·¥{±Ù{ayº\x1dÊÚë,j\a¢f£¢·h»öì\x17/oSc¾Ú³9uÀ¦æåÈ&jw¨®\x03(éÝ¢j"ú\x1a¶^[m§ÿïêäz¹Þàþf£¢·h§~m
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-16 14:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16 14:19 [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast() Michael J. Ruhl
[not found] ` <20171016141945.11276.1068.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 14:19 ` [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault Michael J. Ruhl
[not found] ` <20171016141950.11276.59779.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 14:22 ` Ruhl, Michael J
2017-10-16 14:24 ` [PATCH 1/2] ibacm: Incorrect usage of BE byte order of MLID attach/detach_mcast() Ruhl, Michael J
-- strict thread matches above, loose matches on Subject: below --
2017-10-13 18:43 Michael J. Ruhl
[not found] ` <20171013184347.28410.87093.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-13 18:43 ` [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a segfault Michael J. Ruhl
[not found] ` <20171013184352.28410.32200.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2017-10-16 4:58 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox