Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/811320/?format=api
{ "id": 811320, "url": "http://patchwork.ozlabs.org/api/1.2/patches/811320/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504849138-17427-1-git-send-email-vpai@akamai.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504849138-17427-1-git-send-email-vpai@akamai.com>", "list_archive_url": null, "date": "2017-09-08T05:38:58", "name": "[v2] netfilter: xt_hashlimit: fix build error caused by 64bit division", "commit_ref": null, "pull_url": null, "state": "awaiting-upstream", "archived": true, "hash": "7822ac65e8f5bd90872f0599f9d0f484293db894", "submitter": { "id": 66296, "url": "http://patchwork.ozlabs.org/api/1.2/people/66296/?format=api", "name": "Vishwanath Pai", "email": "vpai@akamai.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504849138-17427-1-git-send-email-vpai@akamai.com/mbox/", "series": [ { "id": 2103, "url": "http://patchwork.ozlabs.org/api/1.2/series/2103/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=2103", "date": "2017-09-08T05:38:58", "name": "[v2] netfilter: xt_hashlimit: fix build error caused by 64bit division", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/2103/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811320/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811320/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=akamai.com header.i=@akamai.com header.b=\"eSHmCH2o\";\n\tdkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpR4X3QBHz9sCZ\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 8 Sep 2017 15:40:44 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754159AbdIHFkb (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 8 Sep 2017 01:40:31 -0400", "from mx0b-00190b01.pphosted.com ([67.231.157.127]:47484 \"EHLO\n\tmx0b-00190b01.pphosted.com\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1750829AbdIHFk3 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 8 Sep 2017 01:40:29 -0400", "from pps.filterd (m0050096.ppops.net [127.0.0.1])\n\tby m0050096.ppops.net-00190b01. (8.16.0.21/8.16.0.21) with SMTP id\n\tv885b31S013474; Fri, 8 Sep 2017 06:39:01 +0100", "from prod-mail-ppoint1 (prod-mail-ppoint1.akamai.com\n\t[184.51.33.18])\n\tby m0050096.ppops.net-00190b01. with ESMTP id 2cukpt0c8x-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=NOT); Fri, 08 Sep 2017 06:39:01 +0100", "from pps.filterd (prod-mail-ppoint1.akamai.com [127.0.0.1])\n\tby prod-mail-ppoint1.akamai.com (8.16.0.17/8.16.0.17) with SMTP id\n\tv885ZOMx014663; Fri, 8 Sep 2017 01:39:00 -0400", "from prod-mail-relay10.akamai.com ([172.27.118.251])\n\tby prod-mail-ppoint1.akamai.com with ESMTP id 2cqqyuxtwe-1;\n\tFri, 08 Sep 2017 01:38:59 -0400", "from bos-lpqrs.kendall.corp.akamai.com\n\t(bos-lpqrs.kendall.corp.akamai.com [172.28.13.81])\n\tby prod-mail-relay10.akamai.com (Postfix) with ESMTP id EA4E41FC74;\n\tFri, 8 Sep 2017 05:38:58 +0000 (GMT)", "from vpai by bos-lpqrs.kendall.corp.akamai.com with local (Exim\n\t4.82) (envelope-from <vpai@akamai.com>)\n\tid 1dqC0I-0004Xd-80; Fri, 08 Sep 2017 01:38:58 -0400" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com;\n\th=from : to : cc :\n\tsubject : date : message-id; s=jan2016.eng;\n\tbh=wCXiJHzKMQXsZVRfqNHbuTLP3XXLuFuJTz0LuXCkIaU=;\n\tb=eSHmCH2oXE+b9AvfuSXp7vry99ELFrVlkArHS9nc5NR7tVulM3TKN4dUB15Kf+YmP0VF\n\t/2s86ExEiZ2tMo2DTtzbG/wTfFW3552nQxaagA/5mhWs6ZsVMV/8PKXH9/IXo056WicN\n\t94PvBo5sM3zrIroc+SgH5AbKYFjDhxdawpOiU1UtgiQCtcWp9B8ywOV3AdhRlW+gZKXg\n\tI/pGPEmdY2h/SISpDAkro8dseGx8CgWUlMTRcZECudBb6ZrGO+rwFlGeQSdM6fSw36BH\n\t4we46mh5YNbAg4AnbYKgZSgFNos8x67KLBl9Ew7g0IrqHhghWQrj12g+pntGcjatzYCM\n\txg== ", "From": "Vishwanath Pai <vpai@akamai.com>", "To": "pablo@netfilter.org, netfilter-devel@vger.kernel.org,\n\ttorvalds@linux-foundation.org, davem@davemloft.net", "Cc": "kadlec@blackhole.kfki.hu, johunt@akamai.com, fw@strlen.de,\n\tnetdev@vger.kernel.org, pai.vishwain@gmail.com, mingo@kernel.org,\n\tilubashe@akamai.com, bp@alien8.de, luto@kernel.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, brgerst@gmail.com,\n\tandrew.cooper3@citrix.com, jgross@suse.com,\n\tboris.ostrovsky@oracle.com, keescook@chromium.org,\n\takpm@linux-foundation.org, arnd@arndb.de", "Subject": "[PATCH v2] netfilter: xt_hashlimit: fix build error caused by 64bit\n\tdivision", "Date": "Fri, 8 Sep 2017 01:38:58 -0400", "Message-Id": "<1504849138-17427-1-git-send-email-vpai@akamai.com>", "X-Mailer": "git-send-email 1.9.1", "X-Proofpoint-Virus-Version": [ "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-08_03:, , signatures=0", "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-08_03:, , signatures=0" ], "X-Proofpoint-Spam-Details": [ "rule=notspam policy=default score=0 spamscore=0\n\tsuspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709080086", "rule=notspam policy=default score=0\n\tpriorityscore=1501 malwarescore=0\n\tsuspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015\n\tlowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam\n\tadjust=0\n\treason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709080087" ], "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "64bit division causes build/link errors on 32bit architectures. It\nprints out error messages like:\n\nERROR: \"__aeabi_uldivmod\" [net/netfilter/xt_hashlimit.ko] undefined!\n\nThe value of avg passed through by userspace in BYTE mode cannot exceed\nU32_MAX. Which means 64bit division in user2rate_bytes is unnecessary.\nTo fix this I have changed the type of param 'user' to u32.\n\nSince anything greater than U32_MAX is an invalid input we error out in\nhashlimit_mt_check_common() when this is the case.\n\nChanges in v2:\n\tMaking return type as u32 would cause an overflow for small\n\tvalues of 'user' (for example 2, 3 etc). To avoid this I bumped up\n\t'r' to u64 again as well as the return type. This is OK since the\n\tvariable that stores the result is u64. We still avoid 64bit\n\tdivision here since 'user' is u32.\n\nFixes: bea74641e378 (\"netfilter: xt_hashlimit: add rate match mode\")\nSigned-off-by: Vishwanath Pai <vpai@akamai.com>\n---\n net/netfilter/xt_hashlimit.c | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)", "diff": "diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c\nindex 10d4823..1c1941e 100644\n--- a/net/netfilter/xt_hashlimit.c\n+++ b/net/netfilter/xt_hashlimit.c\n@@ -35,6 +35,7 @@\n #include <linux/netfilter_ipv6/ip6_tables.h>\n #include <linux/netfilter/xt_hashlimit.h>\n #include <linux/mutex.h>\n+#include <linux/kernel.h>\n \n MODULE_LICENSE(\"GPL\");\n MODULE_AUTHOR(\"Harald Welte <laforge@netfilter.org>\");\n@@ -527,12 +528,12 @@ static u64 user2rate(u64 user)\n \t}\n }\n \n-static u64 user2rate_bytes(u64 user)\n+static u64 user2rate_bytes(u32 user)\n {\n \tu64 r;\n \n-\tr = user ? 0xFFFFFFFFULL / user : 0xFFFFFFFFULL;\n-\tr = (r - 1) << 4;\n+\tr = user ? U32_MAX / user : U32_MAX;\n+\tr = (r - 1) << XT_HASHLIMIT_BYTE_SHIFT;\n \treturn r;\n }\n \n@@ -588,7 +589,8 @@ static void rateinfo_init(struct dsthash_ent *dh,\n \t\tdh->rateinfo.prev_window = 0;\n \t\tdh->rateinfo.current_rate = 0;\n \t\tif (hinfo->cfg.mode & XT_HASHLIMIT_BYTES) {\n-\t\t\tdh->rateinfo.rate = user2rate_bytes(hinfo->cfg.avg);\n+\t\t\tdh->rateinfo.rate =\n+\t\t\t\tuser2rate_bytes((u32)hinfo->cfg.avg);\n \t\t\tif (hinfo->cfg.burst)\n \t\t\t\tdh->rateinfo.burst =\n \t\t\t\t\thinfo->cfg.burst * dh->rateinfo.rate;\n@@ -870,7 +872,7 @@ static int hashlimit_mt_check_common(const struct xt_mtchk_param *par,\n \n \t/* Check for overflow. */\n \tif (revision >= 3 && cfg->mode & XT_HASHLIMIT_RATE_MATCH) {\n-\t\tif (cfg->avg == 0) {\n+\t\tif (cfg->avg == 0 || cfg->avg > U32_MAX) {\n \t\t\tpr_info(\"hashlimit invalid rate\\n\");\n \t\t\treturn -ERANGE;\n \t\t}\n", "prefixes": [ "v2" ] }