From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD295C3A5A2 for ; Mon, 19 Aug 2019 15:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B20F020651 for ; Mon, 19 Aug 2019 15:07:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="mwjGdyFn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbfHSPHZ (ORCPT ); Mon, 19 Aug 2019 11:07:25 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:37275 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbfHSPHZ (ORCPT ); Mon, 19 Aug 2019 11:07:25 -0400 Received: by mail-qk1-f193.google.com with SMTP id s14so1675101qkm.4 for ; Mon, 19 Aug 2019 08:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pYG07FQXinRxulmKHOMsg40sZWME3PdnJpDYcJpltkI=; b=mwjGdyFnrfMnbo4xepP5VDv4cV810K0v/nwltdU9hB6YmpGhEZ56PUqqfO8z88Oda0 yvgi0mfqOc1Sq+XUKoBBmEmsB709wKk/MrINiAPdg90ZHjACST9Gw2Tm1av+57lv2+d0 CDOJncwdS+/KNy5SS4ejwTHRo/z2YWyKnx75ihJuc1ezRt9sA2F1t0Row2IkgQM+VZ0V Srdg+irL0vWbrzbquTSmaQcCy//SxScfUTrmogfcI40bZc/qPoQ/IJPbCO+5Vg+9v0LK n9ocKDUniz0Drq46+nzenO/SaBGtODwwI/ShaHa5CmBjhYPZRn8h1UGJ3NE3ms9xBCwQ ZjjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pYG07FQXinRxulmKHOMsg40sZWME3PdnJpDYcJpltkI=; b=NgP3p7UW49gKGNKewL6/G/8sTQ0WzQo3SEqLIGf/5LaynoHr07n8u1DW34MIl6CMOs 3nU3UUruZNXXtMPQobFg4+jVUsFcC1SdSZoaJkrTVEigMm7/Dh66wxsruGHcZmwnoUCB baDKr4D7j1CQ0GPVwAXI3W5nsWXvwvIcKHIjk2NrrYymx30SD8RI8Fm0D3EjN+wrFqsf 3hfxqqsFIWNOh2y9gJerQJPviGThJBrG6fPx3592lZXupvj2qo3Jrh6yZUj6E/t08/zt M34p8hHwi0qIkiPzLjwZ0ExyCeZySO9ovu1HLoPLz9P2LclJuYzDQhPNaGVpwxLFhg9c TMlQ== X-Gm-Message-State: APjAAAWF2HaWFgO6DJl8y6ATiTfYC4KOWuieYmlbpS65+yfO7tRIupNS 7yxJtvbW4i5qPW8eD7jxf75llQ== X-Google-Smtp-Source: APXvYqw1y3jYMmvxJOlP9VxdzBIRPZnY3jaTAKfEBX5WHmI1u1LjD3CAWBGFEEgq5D2r4VA9EhPXQw== X-Received: by 2002:a37:9f07:: with SMTP id i7mr18332057qke.485.1566227244160; Mon, 19 Aug 2019 08:07:24 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id b127sm7103473qkc.22.2019.08.19.08.07.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 08:07:23 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hzjFj-0004zq-Cl; Mon, 19 Aug 2019 12:07:23 -0300 Date: Mon, 19 Aug 2019 12:07:23 -0300 From: Jason Gunthorpe To: Bernard Metzler Cc: Geert Uytterhoeven , Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Re: Re: [PATCH] RDMA/siw: Fix compiler warnings on 32-bit due to u64/pointer abuse Message-ID: <20190819150723.GH5058@ziepe.ca> References: <20190819141856.GG5058@ziepe.ca> <20190819135213.GF5058@ziepe.ca> <20190819122456.GB5058@ziepe.ca> <20190819100526.13788-1-geert@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 19, 2019 at 02:52:13PM +0000, Bernard Metzler wrote: > > >To: "Bernard Metzler" > >From: "Jason Gunthorpe" > >Date: 08/19/2019 04:19PM > >Cc: "Geert Uytterhoeven" , "Doug Ledford" > >, linux-rdma@vger.kernel.org, > >linux-kernel@vger.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" > >> >From: "Jason Gunthorpe" > >> >Date: 08/19/2019 03:52PM > >> >Cc: "Geert Uytterhoeven" , "Doug Ledford" > >> >, linux-rdma@vger.kernel.org, > >> >linux-kernel@vger.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 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