From patchwork Fri Jun 21 12:50:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhargava Shastry X-Patchwork-Id: 1120218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YOXQrrdw"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45VdpJ6NfFz9s3l for ; Fri, 21 Jun 2019 22:50:48 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 13B1FE3F; Fri, 21 Jun 2019 12:50:45 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 69C11E3E for ; Fri, 21 Jun 2019 12:50:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E79687DB for ; Fri, 21 Jun 2019 12:50:42 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id n4so5275248wrs.3 for ; Fri, 21 Jun 2019 05:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Z+tjePHRWu1dq+IgbomoWG/vdJgUriSTWBUERBgvjxM=; b=YOXQrrdwWy46W2xpxUSSRHbdYNknJJUyUEAkDLng5OhKjSa6Njjny/HCWIfopbrV2A 1UBcVfPclWQ7PeTsvXmtgcvh8WfLTyxGagRqSYG1XyxWGG2MT+ZEbkNiaU1VVnoK6sxi 4xbNtAY2c7RZp4OdwTaqWRukqmXP8MeepMEiZ7huG9M6HZBmu6v2yNugqqvWjsBUgsAZ qqqJNCmKxoud0qd2GNPUSpYZti/M6hNshDWk8Ys6g2MQNdnSJkiInc8tmbH3bsoN6EiA 4DgorqUvZIcAUbRkHU3ljXVv/dFVDvJj2VIN5MkPhzwU16xvPRAbB3JuRkkLdAsJhRYL Iz1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z+tjePHRWu1dq+IgbomoWG/vdJgUriSTWBUERBgvjxM=; b=XFG8jRIqYxkSHycTockvcVV5f+Cz2cAafJdCxWMFJBmkVU0CFQcoHh74/VIxsa21j4 MdX9MS4Q7Hs8mMsiFYOsvQvLKwKm5Vuc/lhKLdhgWrZSr/8f6wyKgu60TVGSCbwSOiUq rnDrpVG58tlJZf2N9Yzc068zltqaztUrnDnRDGUjljvhdsVEh1Sq3dGAWhlFnGCpCB0N blAYtp57Q+U6lF6E5lpaVUpuT0ZJap3wTszFtdo2GylxnHb8Gj8b3NsbrMw43urTOV1j kC12YJEP5JYI41TLk1cVo69fv8XM0WnH8k0qE7auTiR9S3lRhg9Och1K9hJ9t1TrS1nT KnVQ== X-Gm-Message-State: APjAAAU1LUT9vA/8sqmcBZcOs6TOc6hHDpjCyZ4SVjqc0wsuMauU7G6m Uw9y1s752KwpbvrmDMTh+8epHbNHinM= X-Google-Smtp-Source: APXvYqx3scHrR91mamHsVlgLLyHqE/mWFcjcMjLrOxSVIQbYXnS+sM2Jvk082tx/QXDIqgYsPQb3PQ== X-Received: by 2002:adf:ebc4:: with SMTP id v4mr267611wrn.113.1561121441178; Fri, 21 Jun 2019 05:50:41 -0700 (PDT) Received: from x270.Speedport_W_724V_09011603_06_003 (p200300C0DF0AAA35D10A3706CB741B33.dip0.t-ipconnect.de. [2003:c0:df0a:aa35:d10a:3706:cb74:1b33]) by smtp.gmail.com with ESMTPSA id c15sm3557330wrd.88.2019.06.21.05.50.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 05:50:40 -0700 (PDT) From: bshas3@gmail.com To: ovs-dev@openvswitch.org Date: Fri, 21 Jun 2019 14:50:35 +0200 Message-Id: <20190621125035.17458-1-bshas3@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Bhargava Shastry Subject: [ovs-dev] [PATCH] ossfuzz: Remove duplicate tcp flags parsing in flow extract target X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Bhargava Shastry During a code audit, the flow extraction fuzzer target was seen to be parsing tcp flags from the fuzzer supplied input twice. This is probably a typo since the second call to `parse_tcp_flags()` is identical to the first. Since a call to `parse_tcp_flags()` parses the Ethernet and IP headers contained in the packet, the second (buggy) call to `parse_tcp_flags()` creates an expectation that there is a second set of Ethernet and IP headers beyond the first which is incorrect. This patch fixes this problem by removing the duplicate code in question. Signed-off-by: Bhargava Shastry --- tests/oss-fuzz/flow_extract_target.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/oss-fuzz/flow_extract_target.c b/tests/oss-fuzz/flow_extract_target.c index 4a7451411..869d1e63e 100644 --- a/tests/oss-fuzz/flow_extract_target.c +++ b/tests/oss-fuzz/flow_extract_target.c @@ -60,12 +60,6 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) ignore(tcp_flags); } - /* Parse TCP flags. */ - if (dp_packet_size(&packet) >= ETH_HEADER_LEN) { - uint16_t tcp_flags = parse_tcp_flags(&packet); - ignore(tcp_flags); - } - /* Count headers. */ int count = flow_count_vlan_headers(&flow); ignore(count);