From patchwork Sun Jan 13 10:04:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 10761233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00F4813BF for ; Sun, 13 Jan 2019 10:04:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D817528420 for ; Sun, 13 Jan 2019 10:04:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC21A28ACE; Sun, 13 Jan 2019 10:04:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75BA428420 for ; Sun, 13 Jan 2019 10:04:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726449AbfAMKEb (ORCPT ); Sun, 13 Jan 2019 05:04:31 -0500 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:57376 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbfAMKEb (ORCPT ); Sun, 13 Jan 2019 05:04:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1547373871; x=1578909871; h=from:to:cc:subject:date:message-id:mime-version; bh=prMIGsJXEouGZ/fHYjmaIE5+s0rgCAcV6wRxNmhcB4w=; b=rVzPL09PdVZ1AVR6zMSX1Eiyx0hQi/eE+wXtMr2hqdRgTq53wfi6EVwp tKD7CDfLnQWmLEB9/7FX7VZSZw1/RE+6zqJ0qIhJJrmpC/o6dI6xPIhzz hSLXXZsDRPIU+CheMZEsjyKvhykctCcjymTrYyeQDzLoh9CemZCenS8Px 4=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="781184066" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1d-37fd6b3d.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Jan 2019 10:04:28 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-37fd6b3d.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id x0DA4NxU070585 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 13 Jan 2019 10:04:25 GMT Received: from EX13D19EUB001.ant.amazon.com (10.43.166.229) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 13 Jan 2019 10:04:25 +0000 Received: from EX13MTAUEE001.ant.amazon.com (10.43.62.200) by EX13D19EUB001.ant.amazon.com (10.43.166.229) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 13 Jan 2019 10:04:23 +0000 Received: from galpress-VirtualBox.hfa16.amazon.com (10.218.62.29) by mail-relay.amazon.com (10.43.62.226) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sun, 13 Jan 2019 10:04:21 +0000 From: Gal Pressman To: Yishai Hadas , Jason Gunthorpe , Doug Ledford , Leon Romanovsky CC: , Yossi Leybovich , "Gal Pressman" , Yuval Shaia Subject: [PATCH rdma-core] verbs: Fix UD pingpong buffer validation Date: Sun, 13 Jan 2019 12:04:19 +0200 Message-ID: <1547373859-4725-1-git-send-email-galpress@amazon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Account for UD's 40 bytes offset when doing buffer validation. Fixes: 099c5aa50bc8 ("libibverb/examples: Add command line option to enable buffer validation") Cc: Yuval Shaia Signed-off-by: Gal Pressman --- libibverbs/examples/ud_pingpong.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libibverbs/examples/ud_pingpong.c b/libibverbs/examples/ud_pingpong.c index a89fbe3148ad..fa1e59ab2cc9 100644 --- a/libibverbs/examples/ud_pingpong.c +++ b/libibverbs/examples/ud_pingpong.c @@ -747,7 +747,7 @@ int main(int argc, char *argv[]) if (servername) { if (validate_buf) for (int i = 0; i < size; i += page_size) - ctx->buf[i] = i / page_size % sizeof(char); + ctx->buf[i + 40] = i / page_size % sizeof(char); if (pp_post_send(ctx, rem_dest->qpn)) { fprintf(stderr, "Couldn't post send\n"); @@ -860,7 +860,8 @@ int main(int argc, char *argv[]) if ((!servername) && (validate_buf)) { for (int i = 0; i < size; i += page_size) - if (ctx->buf[i] != i / page_size % sizeof(char)) + if (ctx->buf[i + 40] != + i / page_size % sizeof(char)) printf("invalid data in page %d\n", i / page_size); }