Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6363017imm; Mon, 27 Aug 2018 14:33:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYXNzhFTVFR/+Ukg8RUmB/K93oEgH+bn1zdnLej/i8Q1yWElBKBLefw/HwmlhRbVDX/hY83 X-Received: by 2002:a17:902:583:: with SMTP id f3-v6mr14708346plf.115.1535405596478; Mon, 27 Aug 2018 14:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535405596; cv=none; d=google.com; s=arc-20160816; b=odxKAKraeutMj+ewgz3IPtwZYB/OeAlw35ca+ektWDuugfBqg+x+0KjXnvyLSh6n5O liuRJacNeEi+z8TUlwqrDqKZNH0B1WhOK3OB12tHyZNShoLqKMKV2KcGUCz+5a/YtEuu uColQKW+6v2H5izGwAPyyfFbWn+dQWcGFjAfNjqNv0TikMMpnplS+eXZ25iMxexXGXUe iVHRzBDVge95Wmj7r4Fpd8JuZUlNpgpi2+qgoU3CuuspyUn6G0zlb+M6SYZoIw/B7s/m I95zmd/dYDh5Arxd3FMBHyi5b1yeajfptghtvwwOEhoa26yX16CjAFXwErS7fuJTUbvb qfzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=GbfSIyImydTFGymOdqY0NAd+XMaAWMng9Weh3FNmmeg=; b=SkyqtsHqiBJs0umfAt3NPkauzDdak7ToEyCsGuyHl4Ag6+hhCyndWev2YiNioXD23L GPSzSO71m/7odTtfp09jcQiv6uk9+rGkXJgJEoyQUwYi+BwXYpPHE8bUSLt0/XnsnmH5 rknOyjpOZm+k/+1e2xfHk2SheB8RIM4EM0pP4HJcsL3VHmCLkvXjGvpA9rGWLc1U6n7h Wvfjm6KqjoWtSzRqYuOlZYIinn6np55KEYq2bqYGNJbSHz+Wuc1W5OGZm3J/Q5cv57Ym 1xDeYTD+JEYThGGH7WpngI6UG2zJqUVyWXFraRdszOl3bi1UHtcD3iAS5vSE7t+jfgm6 +daQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WwROLiid; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o23-v6si356627pgm.170.2018.08.27.14.33.01; Mon, 27 Aug 2018 14:33:16 -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=@gmail.com header.s=20161025 header.b=WwROLiid; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727291AbeH1BUS (ORCPT + 99 others); Mon, 27 Aug 2018 21:20:18 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33942 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbeH1BUR (ORCPT ); Mon, 27 Aug 2018 21:20:17 -0400 Received: by mail-pg1-f196.google.com with SMTP id d19-v6so115115pgv.1; Mon, 27 Aug 2018 14:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GbfSIyImydTFGymOdqY0NAd+XMaAWMng9Weh3FNmmeg=; b=WwROLiidpded6Cpt7016km0BomkK5Jdg/epWeOic6zde81JPWf4pBPmFzKeNB6aqgN ZgsbO1Azr9NRXQpFhxEMsf8zjEZyApS1xwCPpOamzK81cnAHURL8vxdmbCq3ZTfhV3RY CyI6MVzYvpPThNN2p0N2LmUSorNM9pQFTgveZmxZ1MuCCQxb1xSt8BiRxP0IH6ZR6Wk1 WRxmK7AE+mx778nCWQ3amvk6nChd7bUw+XsBuCqQBeaVqhVlJepwcUiQP1wkvBXzOdTx bz6Sis+zOI5g4tkQEq/Xs/AhJrVJR5OCBdkCWDVOcbZhhUNTx9At3bDT0sZfIDXL0gRt hMFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GbfSIyImydTFGymOdqY0NAd+XMaAWMng9Weh3FNmmeg=; b=HEm3mpWjRuOuA70zdQmSpNL5qfnjgkeux/kKNkNcuZcAjU7wpZL2GbjyCFB+S1Pycd tR/f9YyaLKOgKdE37Pa98ogXGcaq9lusXc/33v6ib82OPbx6rBQrY8Mv1FA/eaPWCAD/ wEsClfxPaeWBLzmk2FxYLfZmdNo33V3G83usQPRaifCbOrosEkLr0cSiPG862M/2iA97 wfHMzQV2lRU4IuVEFFXPUTstLaWBtFBRmW3iEBJ72tEkey1FQAXTeU32BMbSqgDROwvN Nu6bXJuQLtsd215srYGtuXC1eHfvuJHFkfhWl6YIBg8T7ORkeWo2KUNjbquwm9BVNeZj CfEQ== X-Gm-Message-State: APzg51A19RTYFhQY8L0wY5Lo0ynhK828F721W7fSKsiQP+YjZ051C7xq vPPOW06Ymge8mSHUH2JZRiAW210D7QL88G4YfopK1HIW X-Received: by 2002:a63:e14a:: with SMTP id h10-v6mr13684814pgk.358.1535405512755; Mon, 27 Aug 2018 14:31:52 -0700 (PDT) MIME-Version: 1.0 References: <20180826055801.GA42063@beast> <20180826061534.GT6515@ZenIV.linux.org.uk> <20180826173236.GU6515@ZenIV.linux.org.uk> <20180826225749.GY6515@ZenIV.linux.org.uk> In-Reply-To: From: Cong Wang Date: Mon, 27 Aug 2018 14:31:41 -0700 Message-ID: Subject: Re: [PATCH] net: sched: Fix memory exposure from short TCA_U32_SEL To: Jamal Hadi Salim Cc: Al Viro , Kees Cook , LKML , Jiri Pirko , David Miller , Linux Kernel Network Developers Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 27, 2018 at 4:58 AM Jamal Hadi Salim wrote: > > On 2018-08-26 6:57 p.m., Al Viro wrote: > > On Sun, Aug 26, 2018 at 06:32:37PM +0100, Al Viro wrote: > > > >> As far as I can tell, the solution is > > [snip long and painful reasoning] > >> pointers, and not in provably opaque fashion. Theoretically, the three tcf_... > >> inlines above need another look; fortunately, they don't use ->next at all, not to > >> mention not being used anywhere outside of net/sched/*.c > >> > >> The 80 lines above prove that we only need to grep net/sched/*.c for > >> tcf_proto_ops method calls. And only because we don't have (thank $DEITY) > >> anything that could deconstruct types - as soon as some bastard grows means > >> to say "type of the second argument of the function pointed to by p", this > >> kind of analysis, painful as it is, goes out of window. Even as it is, > >> do you really like the idea of newbies trying to get through the exercises > >> like the one above? > > > > BTW, would there be any problem if we took the definitions of tcf_proto and > > tcf_proto_ops to e.g. net/sched/tcf_proto.h (along with the three inlines in > > in pkt_cls.h), left forwards in sch_generic.h and added includes of "tcf_proto.h" > > where needed in net/sched/*.c? > > > > I cant think of any challenges. Cong/Jiri? Would it require development > time classifiers/actions/qdiscs to sit in that directory (I suspect you > dont want them in include/net). > BTW, the idea of improving grep-ability of the code by prefixing the > ops appropriately makes sense. i.e we should have ops->cls_init, > ops->act_init etc. Hmm? Isn't struct tcf_proto_ops used and must be provided by each tc filter module? How does it work if you move it into net/sched/* for out-of-tree modules? Are they supposed to include "..../net/sched/tcf_proto.h"?? Or something else? BTW, we need some grep tool that really understands C syntax, not making each variable friendly to plain grep.