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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <OFB73D0AD1.A2D5DDF4-ON0025845B.00545951-0025845B.00576D84@notes.na.collabserv.com>
Date:   Mon, 19 Aug 2019 15:54:56 +0000
From:   "Bernard Metzler" <BMT@...ich.ibm.com>
To:     "Jason Gunthorpe" <jgg@...pe.ca>
Cc:     "Geert Uytterhoeven" <geert@...ux-m68k.org>,
        "Doug Ledford" <dledford@...hat.com>, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: Re: Re: Re: [PATCH] RDMA/siw: Fix compiler warnings on 32-bit due to
 u64/pointer abuse

-----"Jason Gunthorpe" <jgg@...pe.ca> wrote: -----

>To: "Bernard Metzler" <BMT@...ich.ibm.com>
>From: "Jason Gunthorpe" <jgg@...pe.ca>
>Date: 08/19/2019 05:07PM
>Cc: "Geert Uytterhoeven" <geert@...ux-m68k.org>, "Doug Ledford"
><dledford@...hat.com>, linux-rdma@...r.kernel.org,
>linux-kernel@...r.kernel.org
>Subject: [EXTERNAL] Re: Re: Re: [PATCH] RDMA/siw: Fix compiler
>warnings on 32-bit due to u64/pointer abuse
>
>On Mon, Aug 19, 2019 at 02:52:13PM +0000, Bernard Metzler wrote:
>> 
>> >To: "Bernard Metzler" <BMT@...ich.ibm.com>
>> >From: "Jason Gunthorpe" <jgg@...pe.ca>
>> >Date: 08/19/2019 04:19PM
>> >Cc: "Geert Uytterhoeven" <geert@...ux-m68k.org>, "Doug Ledford"
>> ><dledford@...hat.com>, linux-rdma@...r.kernel.org,
>> >linux-kernel@...r.kernel.org
>> >Subject: [EXTERNAL] Re: Re: Re: [PATCH] RDMA/siw: Fix compiler
>> >warnings on 32-bit due to u64/pointer abuse
>> >
>> >On Mon, Aug 19, 2019 at 02:15:36PM +0000, Bernard Metzler wrote:
>> >> 
>> >> >To: "Bernard Metzler" <BMT@...ich.ibm.com>
>> >> >From: "Jason Gunthorpe" <jgg@...pe.ca>
>> >> >Date: 08/19/2019 03:52PM
>> >> >Cc: "Geert Uytterhoeven" <geert@...ux-m68k.org>, "Doug Ledford"
>> >> ><dledford@...hat.com>, linux-rdma@...r.kernel.org,
>> >> >linux-kernel@...r.kernel.org
>> >> >Subject: [EXTERNAL] Re: Re: [PATCH] RDMA/siw: Fix compiler
>> >warnings
>> >> >on 32-bit due to u64/pointer abuse
>> >> >
>> >> >On Mon, Aug 19, 2019 at 01:36:11PM +0000, Bernard Metzler
>wrote:
>> >> >> >If the value is really a kernel pointer, then it ought to be
>> >> >printed
>> >> >> >with %p. We have been getting demanding on this point lately
>in
>> >> >RDMA
>> >> >> >to enforce the ability to keep kernel pointers secret.
>> >> >> >
>> >> >> >> -			wqe->sqe.sge[0].laddr = (u64)&wqe->sqe.sge[1];
>> >> >> >> +			wqe->sqe.sge[0].laddr = (uintptr_t)&wqe->sqe.sge[1];
>> >> >> >
>> >> >> >[..]
>> >> >> >
>> >> >> >>  			rv = siw_rx_kva(srx,
>> >> >> >> -					(void *)(sge->laddr + frx->sge_off),
>> >> >> >> +					(void *)(uintptr_t)(sge->laddr + frx->sge_off),
>> >> >> >>  					sge_bytes);
>> >> >> >
>> >> >> >Bernard, this is nonsense, what is going on here with
>> >sge->laddr
>> >> >that
>> >> >> >it can't be a void *?
>> >> >> >
>> >> >> siw_sge is defined in siw-abi.h. We make the address u64 to
>keep
>> >> >the ABI
>> >> >> arch independent.
>> >> >
>> >> >Eh? How does the siw-abi.h store a kernel pointer? Sounds like
>> >kernel
>> >> >and user types are being mixed.
>> >> >
>> >> 
>> >> siw-abi.h defines the work queue elements of a siw send queue.
>> >> For user land, the send queue is mmapped. Kernel or user land
>> >> clients write to its send queue when posting work
>> >> (SGE: buffer address, length, local key). 
>> >
>> >Should have different types.. Don't want to accidently mix a laddr
>> >under user control with one under kernel control.
>> >
>> Well we have an unsigned 64bit for both user and kernel
>> application buffer addresses throughout the rdma stack, 
>
>We do not. Kernel addresses are consistenyly void * or dma_addr_t
>
Absolutely. But these addresses are conveyed through the
API as unsigned 64 during post_send(), and land in the siw
send queue as is. During send queue processing, these addresses
must be interpreted according to its context and transformed
(casted) back to the callers intention. I frankly do not
know what we can do differently... The representation of
all addresses as unsigned 64 is given. Sorry for the confusion.


>Most places that consume a data address are using lkeys anyhow, which
>does have a lkey & u64, but that u64 is not a application buffer
>address, but the IOVA of the lkey, which is very different.
>
>I really have no idea why siw needs to mix kernel VAs with user
>pointers, particularly in wqes...
>
>Jason
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ