All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Fix for parsing netlink string attribute
@ 2015-05-08 21:36 Tatyana Nikolova
  2015-05-08 21:53 ` Jason Gunthorpe
  0 siblings, 1 reply; 7+ messages in thread
From: Tatyana Nikolova @ 2015-05-08 21:36 UTC (permalink / raw)
  To: Doug Ledford; +Cc: swise, john.s.lacombe, linux-rdma, stable

The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
Without this fix parsing of the nlmsg by the userspace port mapper service fails
because of unknown attribute length, causing the port mapper service not to
register the client, which has sent the nlmsg.

Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Cc: <stable@vger.kernel.org> #v3.16
---
 drivers/infiniband/core/iwpm_msg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c
index b85ddbc..e5558b2 100644
--- a/drivers/infiniband/core/iwpm_msg.c
+++ b/drivers/infiniband/core/iwpm_msg.c
@@ -33,7 +33,7 @@
 
 #include "iwpm_util.h"
 
-static const char iwpm_ulib_name[] = "iWarpPortMapperUser";
+static const char iwpm_ulib_name[IWPM_ULIBNAME_SIZE] = "iWarpPortMapperUser";
 static int iwpm_ulib_version = 3;
 static int iwpm_user_pid = IWPM_PID_UNDEFINED;
 static atomic_t echo_nlmsg_seq;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] RDMA/core: Fix for parsing netlink string attribute
  2015-05-08 21:36 [PATCH] RDMA/core: Fix for parsing netlink string attribute Tatyana Nikolova
@ 2015-05-08 21:53 ` Jason Gunthorpe
  2015-05-12 17:14   ` Doug Ledford
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Gunthorpe @ 2015-05-08 21:53 UTC (permalink / raw)
  To: Tatyana Nikolova; +Cc: Doug Ledford, swise, john.s.lacombe, linux-rdma, stable

On Fri, May 08, 2015 at 04:36:33PM -0500, Tatyana Nikolova wrote:
> The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
> Without this fix parsing of the nlmsg by the userspace port mapper service fails
> because of unknown attribute length, causing the port mapper service not to
> register the client, which has sent the nlmsg.

Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

This actually will copy some kernel memory to userspace. I think the
overflow is in .text, so probably not a security issue..

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] RDMA/core: Fix for parsing netlink string attribute
  2015-05-08 21:53 ` Jason Gunthorpe
@ 2015-05-12 17:14   ` Doug Ledford
       [not found]     ` <1431450866.43876.65.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Ledford @ 2015-05-12 17:14 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Tatyana Nikolova, swise, john.s.lacombe, linux-rdma, stable

[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]

On Fri, 2015-05-08 at 15:53 -0600, Jason Gunthorpe wrote:
> On Fri, May 08, 2015 at 04:36:33PM -0500, Tatyana Nikolova wrote:
> > The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
> > Without this fix parsing of the nlmsg by the userspace port mapper service fails
> > because of unknown attribute length, causing the port mapper service not to
> > register the client, which has sent the nlmsg.
> 
> Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> This actually will copy some kernel memory to userspace. I think the
> overflow is in .text, so probably not a security issue..

It shouldn't be in the .text section.  This is defined as static const
char array, so it should be in one of the data sections.  And since we
are using an initializer smaller than the specific size of the array, I
would expect all of the unitialized bits to be 0.  But, the proof is in
the pudding.  A quick compile and check show us:

Contents of section .rodata:
 ...
 01e0 69576172 70506f72 744d6170 70657255  iWarpPortMapperU
 01f0 73657200 00000000 00000000 00000000  ser.............

Yep, just right.  It created a 32byte ro element, initialized it to 0,
then put our text in it.  This is exactly what will get copied in the nl
message and is precisely what we want.

Applied, thanks.

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: 0E572FDD


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] RDMA/core: Fix for parsing netlink string attribute
  2015-05-12 17:14   ` Doug Ledford
@ 2015-05-12 17:50         ` Jason Gunthorpe
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2015-05-12 17:50 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Tatyana Nikolova, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	john.s.lacombe-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, stable-u79uwXL29TY76Z2rM5mHXA

On Tue, May 12, 2015 at 01:14:26PM -0400, Doug Ledford wrote:
> On Fri, 2015-05-08 at 15:53 -0600, Jason Gunthorpe wrote:
> > On Fri, May 08, 2015 at 04:36:33PM -0500, Tatyana Nikolova wrote:
> > > The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
> > > Without this fix parsing of the nlmsg by the userspace port mapper service fails
> > > because of unknown attribute length, causing the port mapper service not to
> > > register the client, which has sent the nlmsg.
> > 
> > Reviewed-By: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > 
> > This actually will copy some kernel memory to userspace. I think the
> > overflow is in .text, so probably not a security issue..
> 
> It shouldn't be in the .text section.  

Pedantically, that is right, it is an archaic colloquialism to refer
to the entire set of post-link read-only sections as .text. (typically
the linker used to merge everything into .text)

I realize now I didn't consider modules when looking into this. No
time right now, can you check if there is any chance the read can
overflow past the page allocated to the module's .rodata?

> char array, so it should be in one of the data sections.  And since we
> are using an initializer smaller than the specific size of the array, I
> would expect all of the unitialized bits to be 0.  

I was talking about the situation before the patch. 

C defines a zero fill for incomplete initialization.

Jason
--
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	[flat|nested] 7+ messages in thread

* Re: [PATCH] RDMA/core: Fix for parsing netlink string attribute
@ 2015-05-12 17:50         ` Jason Gunthorpe
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2015-05-12 17:50 UTC (permalink / raw)
  To: Doug Ledford; +Cc: Tatyana Nikolova, swise, john.s.lacombe, linux-rdma, stable

On Tue, May 12, 2015 at 01:14:26PM -0400, Doug Ledford wrote:
> On Fri, 2015-05-08 at 15:53 -0600, Jason Gunthorpe wrote:
> > On Fri, May 08, 2015 at 04:36:33PM -0500, Tatyana Nikolova wrote:
> > > The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
> > > Without this fix parsing of the nlmsg by the userspace port mapper service fails
> > > because of unknown attribute length, causing the port mapper service not to
> > > register the client, which has sent the nlmsg.
> > 
> > Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> > 
> > This actually will copy some kernel memory to userspace. I think the
> > overflow is in .text, so probably not a security issue..
> 
> It shouldn't be in the .text section.  

Pedantically, that is right, it is an archaic colloquialism to refer
to the entire set of post-link read-only sections as .text. (typically
the linker used to merge everything into .text)

I realize now I didn't consider modules when looking into this. No
time right now, can you check if there is any chance the read can
overflow past the page allocated to the module's .rodata?

> char array, so it should be in one of the data sections.  And since we
> are using an initializer smaller than the specific size of the array, I
> would expect all of the unitialized bits to be 0.  

I was talking about the situation before the patch. 

C defines a zero fill for incomplete initialization.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] RDMA/core: Fix for parsing netlink string attribute
  2015-05-12 17:50         ` Jason Gunthorpe
@ 2015-05-12 20:00             ` Doug Ledford
  -1 siblings, 0 replies; 7+ messages in thread
From: Doug Ledford @ 2015-05-12 20:00 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Tatyana Nikolova, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	john.s.lacombe-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, stable-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]

On Tue, 2015-05-12 at 11:50 -0600, Jason Gunthorpe wrote:
> On Tue, May 12, 2015 at 01:14:26PM -0400, Doug Ledford wrote:
> > On Fri, 2015-05-08 at 15:53 -0600, Jason Gunthorpe wrote:
> > > On Fri, May 08, 2015 at 04:36:33PM -0500, Tatyana Nikolova wrote:
> > > > The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
> > > > Without this fix parsing of the nlmsg by the userspace port mapper service fails
> > > > because of unknown attribute length, causing the port mapper service not to
> > > > register the client, which has sent the nlmsg.
> > > 
> > > Reviewed-By: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > > 
> > > This actually will copy some kernel memory to userspace. I think the
> > > overflow is in .text, so probably not a security issue..
> > 
> > It shouldn't be in the .text section.  
> 
> Pedantically, that is right, it is an archaic colloquialism to refer
> to the entire set of post-link read-only sections as .text. (typically
> the linker used to merge everything into .text)
> 
> I realize now I didn't consider modules when looking into this. No
> time right now, can you check if there is any chance the read can
> overflow past the page allocated to the module's .rodata?
> 
> > char array, so it should be in one of the data sections.  And since we
> > are using an initializer smaller than the specific size of the array, I
> > would expect all of the unitialized bits to be 0.  
> 
> I was talking about the situation before the patch. 

Sorry, my misunderstanding.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] RDMA/core: Fix for parsing netlink string attribute
@ 2015-05-12 20:00             ` Doug Ledford
  0 siblings, 0 replies; 7+ messages in thread
From: Doug Ledford @ 2015-05-12 20:00 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Tatyana Nikolova, swise, john.s.lacombe, linux-rdma, stable

[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]

On Tue, 2015-05-12 at 11:50 -0600, Jason Gunthorpe wrote:
> On Tue, May 12, 2015 at 01:14:26PM -0400, Doug Ledford wrote:
> > On Fri, 2015-05-08 at 15:53 -0600, Jason Gunthorpe wrote:
> > > On Fri, May 08, 2015 at 04:36:33PM -0500, Tatyana Nikolova wrote:
> > > > The string iwpm_ulib_name is recorded in a nlmsg as a netlink attribute.
> > > > Without this fix parsing of the nlmsg by the userspace port mapper service fails
> > > > because of unknown attribute length, causing the port mapper service not to
> > > > register the client, which has sent the nlmsg.
> > > 
> > > Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> > > 
> > > This actually will copy some kernel memory to userspace. I think the
> > > overflow is in .text, so probably not a security issue..
> > 
> > It shouldn't be in the .text section.  
> 
> Pedantically, that is right, it is an archaic colloquialism to refer
> to the entire set of post-link read-only sections as .text. (typically
> the linker used to merge everything into .text)
> 
> I realize now I didn't consider modules when looking into this. No
> time right now, can you check if there is any chance the read can
> overflow past the page allocated to the module's .rodata?
> 
> > char array, so it should be in one of the data sections.  And since we
> > are using an initializer smaller than the specific size of the array, I
> > would expect all of the unitialized bits to be 0.  
> 
> I was talking about the situation before the patch. 

Sorry, my misunderstanding.

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: 0E572FDD


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-12 20:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08 21:36 [PATCH] RDMA/core: Fix for parsing netlink string attribute Tatyana Nikolova
2015-05-08 21:53 ` Jason Gunthorpe
2015-05-12 17:14   ` Doug Ledford
     [not found]     ` <1431450866.43876.65.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-12 17:50       ` Jason Gunthorpe
2015-05-12 17:50         ` Jason Gunthorpe
     [not found]         ` <20150512175033.GA15891-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-12 20:00           ` Doug Ledford
2015-05-12 20:00             ` Doug Ledford

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.