Received: by 10.213.65.68 with SMTP id h4csp2203739imn; Sun, 8 Apr 2018 22:25:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+MBuI1Es9ZEzU6zYWHI/b4sR4kt125+rwyw1MB6rXE3we9H553J8CUmCzqYoe54A4gDTq0 X-Received: by 10.98.141.20 with SMTP id z20mr27762459pfd.144.1523251558241; Sun, 08 Apr 2018 22:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523251558; cv=none; d=google.com; s=arc-20160816; b=OLILXh9DvIb/VcVq1JAzjLesiBBPo7n/9EHm2WDgKVKKNiSx67cesz3lYMnRK72K28 5AyUUlsreD79kemZCk+5RRhc9gPYLgmFu9Ymw5SWTcpeUInUzwa+iPAe4psqa7x8s2+1 Mw5lMuIOHgf9YNToCvSbti78Wq62/XvnWN0nwIc+HtVD0qdxFYAeiMXOJ1zP+NYFVGFl 2i6r7hsz6aWCU71Zu1w6tP+GP6rrpfHmOyj5yeZJaBbQhAAi2ko9gQOb9/B6M7kg3lve SK8kvDDqoVB/8UstGTShdUDUb3AaJKNwTN2W9KW7rjIazmACHgSIDzKydcy0viXxO39R IShQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Vy9pj/A1QemqulG8ZMquKm2h1S4BVnlDQBo3d4W3eFQ=; b=iD/PXV+E4DG+764ChO44FMEfikQSmOv1DtKSBraGBFyK8yvzAJbKhu8LVtoYPRuffY ozW6zXDiye42xwfE0DZxAc31swIL1Bd9ehvv/yZYiqZert2s62Wm//gxamLaB4ho4Mb4 VTvfsDwlagB6X80D0xtKVS41E1nHd3GB902UgntID/cqQGMcNe4dS7YKqUQs4sHUKqWb n0VhiUL/hu12GsI/XOMZDI+fBd3y/3vzmgKO0liP0Su0bh1PUrPw7Sz4Immr0puslkYf sXGFP8a2hLyAPXHwArV/lHAW2HnoRDGe5Sy4OG0RxvedpoWTwggqUCzXR3gAqLi9xBQL ef9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=WEwcxZG8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b75si11923764pfj.7.2018.04.08.22.25.21; Sun, 08 Apr 2018 22:25:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=WEwcxZG8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932096AbeDIAYj (ORCPT + 99 others); Sun, 8 Apr 2018 20:24:39 -0400 Received: from mail-by2nam03on0117.outbound.protection.outlook.com ([104.47.42.117]:63840 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932079AbeDIAYg (ORCPT ); Sun, 8 Apr 2018 20:24:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Vy9pj/A1QemqulG8ZMquKm2h1S4BVnlDQBo3d4W3eFQ=; b=WEwcxZG80Y6DaNf7TV0HOd/XHhZhjBrs4qBzeUDIYhgLPfT3ATJU5++UZMrjf7aqyfC3Mod7K2oqh8d5lXRXqIZ7EFuF8yabN//SANoV8MXPHS0wa0E3TGN9fNbF8OJR/+0UtogeheTfduP+wluCxOPsaI9fno9C78QdJiLVP10= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:24:32 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:24:32 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dmitry Vyukov , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 091/161] netfilter: x_tables: fix pointer leaks to userspace Thread-Topic: [PATCH AUTOSEL for 4.14 091/161] netfilter: x_tables: fix pointer leaks to userspace Thread-Index: AQHTz5ik7CTZ42kbI0+7VJQALSjryw== Date: Mon, 9 Apr 2018 00:21:02 +0000 Message-ID: <20180409001936.162706-91-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0984;7:jWtwucZ5SfcHeozTsPPImH5qd0gY7vIBPN9rorKZAYqt/KKjLuSAYhJTDVEYSRRu9J5gziKVM9Slk/nWaBdukT4jAUUKLvC7fpRl19Vb/S6oWBDe3VgYEs3pxwq3NBK1jaxJXaP8KozX5gE9BvqeO94cg1P1aEUgw7CPwgTJl1RdbuHPVOfgRB74vRw43Daptk08TB8nTZM/ETYeuTUBL66h9hrz5W4wZCvSPV8pur16nW1KNetV2fIJBnPKTlhB;20:gYyEdSx08pBYd+eG3s/cQAWUm9gBxg6BRabBrXbiQRE9TWowqoSTYLuHQfB0pbhDrvSkqc6SjSddvVq8jYtnU+UXqMWaf1un40x+abCtrNH0qVqiuRyeCxPebaElc/XJxbmMnwWkJwx4X1g0Yxw8zhfFvLt3fOhGaRBIKcdFPLA= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: f1ce68dd-f4fd-4efc-608f-08d59db04451 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(211936372134217)(153496737603132); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0984;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0984; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(376002)(366004)(39860400002)(396003)(189003)(199004)(5250100002)(2501003)(110136005)(54906003)(6116002)(6436002)(11346002)(1076002)(486006)(25786009)(105586002)(2900100001)(102836004)(86612001)(3846002)(68736007)(107886003)(316002)(10290500003)(5660300001)(86362001)(2616005)(305945005)(4326008)(446003)(6486002)(22452003)(7736002)(476003)(8676002)(81156014)(81166006)(8936002)(6512007)(10090500001)(186003)(3280700002)(106356001)(76176011)(2906002)(99286004)(26005)(97736004)(59450400001)(14454004)(6666003)(478600001)(53936002)(6506007)(36756003)(72206003)(66066001)(3660700001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0984;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: G32CVZBHEsHAdfjQPdcss/94X+khzTVdWVjNUqXiqAS8xOLJVqT13pM0lOOqeXQkBJVcFN9vHlkXNC7NpK1LOCZlgantxiYroxHa6GznxLC93aXhibv57/hHMTJeJechCnXjVsld2DtvBXCNwqrT6LeUQDzXGhJeL7al3Ol/erysq5Yaogz+ylpB1YCS5XjVgzjLv5sryCPmIkoa+I9oTUzQ1SSfHs2oHJ3EL1llYINDbfaPiGPeWlPzu1lHsvX3rszP6xgPFWrFWGzPOFNgKVFtoyFI1MUFvjbFyv9kkIFD6vocz/MHFiQhhW59RvevUHLsd9tx4Z8lA5JeAsCZ3CMGG/MdNpkaGFTLwjyuHRfFavt5FVcgPCVNif6F3fDLF5o/id1XxYZLSC44YvwB31IE270ylFDEUzFhMyu2YfE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1ce68dd-f4fd-4efc-608f-08d59db04451 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:21:02.1751 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Vyukov [ Upstream commit 1e98ffea5a8935ec040ab72299e349cb44b8defd ] Several netfilter matches and targets put kernel pointers into info objects, but don't set usersize in descriptors. This leads to kernel pointer leaks if a match/target is set and then read back to userspace. Properly set usersize for these matches/targets. Found with manual code inspection. Fixes: ec2318904965 ("xtables: extend matches and targets with .usersize") Signed-off-by: Dmitry Vyukov Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/xt_IDLETIMER.c | 1 + net/netfilter/xt_LED.c | 1 + net/netfilter/xt_limit.c | 3 +-- net/netfilter/xt_nfacct.c | 1 + net/netfilter/xt_statistic.c | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c index bb5d6a058fb7..1141f08810b6 100644 --- a/net/netfilter/xt_IDLETIMER.c +++ b/net/netfilter/xt_IDLETIMER.c @@ -256,6 +256,7 @@ static struct xt_target idletimer_tg __read_mostly =3D = { .family =3D NFPROTO_UNSPEC, .target =3D idletimer_tg_target, .targetsize =3D sizeof(struct idletimer_tg_info), + .usersize =3D offsetof(struct idletimer_tg_info, timer), .checkentry =3D idletimer_tg_checkentry, .destroy =3D idletimer_tg_destroy, .me =3D THIS_MODULE, diff --git a/net/netfilter/xt_LED.c b/net/netfilter/xt_LED.c index 0858fe17e14a..2d1c5c169a26 100644 --- a/net/netfilter/xt_LED.c +++ b/net/netfilter/xt_LED.c @@ -198,6 +198,7 @@ static struct xt_target led_tg_reg __read_mostly =3D { .family =3D NFPROTO_UNSPEC, .target =3D led_tg, .targetsize =3D sizeof(struct xt_led_info), + .usersize =3D offsetof(struct xt_led_info, internal_data), .checkentry =3D led_tg_check, .destroy =3D led_tg_destroy, .me =3D THIS_MODULE, diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c index d27b5f1ea619..61403b77361c 100644 --- a/net/netfilter/xt_limit.c +++ b/net/netfilter/xt_limit.c @@ -193,9 +193,8 @@ static struct xt_match limit_mt_reg __read_mostly =3D { .compatsize =3D sizeof(struct compat_xt_rateinfo), .compat_from_user =3D limit_mt_compat_from_user, .compat_to_user =3D limit_mt_compat_to_user, -#else - .usersize =3D offsetof(struct xt_rateinfo, prev), #endif + .usersize =3D offsetof(struct xt_rateinfo, prev), .me =3D THIS_MODULE, }; =20 diff --git a/net/netfilter/xt_nfacct.c b/net/netfilter/xt_nfacct.c index cc0518fe598e..6f92d25590a8 100644 --- a/net/netfilter/xt_nfacct.c +++ b/net/netfilter/xt_nfacct.c @@ -62,6 +62,7 @@ static struct xt_match nfacct_mt_reg __read_mostly =3D { .match =3D nfacct_mt, .destroy =3D nfacct_mt_destroy, .matchsize =3D sizeof(struct xt_nfacct_match_info), + .usersize =3D offsetof(struct xt_nfacct_match_info, nfacct), .me =3D THIS_MODULE, }; =20 diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c index 11de55e7a868..8710fdba2ae2 100644 --- a/net/netfilter/xt_statistic.c +++ b/net/netfilter/xt_statistic.c @@ -84,6 +84,7 @@ static struct xt_match xt_statistic_mt_reg __read_mostly = =3D { .checkentry =3D statistic_mt_check, .destroy =3D statistic_mt_destroy, .matchsize =3D sizeof(struct xt_statistic_info), + .usersize =3D offsetof(struct xt_statistic_info, master), .me =3D THIS_MODULE, }; =20 --=20 2.15.1