From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D55F6C43381 for ; Tue, 19 Feb 2019 16:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE55321773 for ; Tue, 19 Feb 2019 16:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729193AbfBSQvP (ORCPT ); Tue, 19 Feb 2019 11:51:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728201AbfBSQvP (ORCPT ); Tue, 19 Feb 2019 11:51:15 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C36F52F5D; Tue, 19 Feb 2019 16:51:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.32.181.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4990660C54; Tue, 19 Feb 2019 16:51:13 +0000 (UTC) Message-ID: <7adbb8cbf7cbc5bced0e3235d3ca10faa29b55c3.camel@redhat.com> Subject: Re: [PATCH RFC 0/5] net/sched: validate the control action with all the other parameters From: Davide Caratti To: Cong Wang Cc: Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , Vlad Buslov , Paolo Abeni , Linux Kernel Network Developers In-Reply-To: References: Organization: red hat Content-Type: text/plain; charset="UTF-8" Date: Tue, 19 Feb 2019 17:51:12 +0100 Mime-Version: 1.0 User-Agent: Evolution 3.30.3 (3.30.3-1.fc29) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 19 Feb 2019 16:51:15 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, 2019-02-18 at 22:42 -0800, Cong Wang wrote: > On Fri, Feb 15, 2019 at 3:06 PM Davide Caratti wrote: > > currently, the kernel checks for bad values of the control action in > > tcf_action_init_1(), after a successful call to the action's init() > > function. This causes three bad behaviors: > > Yeah, I have been complaining about this for a long time, > although slightly differently. The problem here is the lack of > "copy" in RCU mechanism, which makes it nearly impossible > to rollback to the previous state of an action on failure path > of an update, which also makes RCU readers reading a partially > updated action too. thanks for looking at this code. by the way, I see that act_mirred has an error path after the assignment of tcfm_eaction and tcfa_action, and this is again causing a fail in the 'replace with bad action' tests ('half write', issue #1). Since it's the same problem, I will fix this in the same patch (moving the assignment after the 'if' test on the value of parm->ifindex. > Before I fix the "copy" part, your fixes make sense to me. There > might be some other way to expose the action-specific tcfa_action > opcode, but it might not be better than yours. > > BTW, please fold these bad behaviors into each appropriate > patch, and keep the cover letter as an overview of the whole > patchset rather than showing any details. > > [...] Ok, and I plan to add a selftest for each action - so that it's possible to verify functionality (at least problem #1) before and after each ommit. > > all these three problems can be fixed if we validate the control action > > in the init() function, in the same way as we are already doing for all > > the other parameters. > > > > - patch 1 is a temporary fix for problem 2), but it's reverted at the > > end of the series > > Please drop patch 1, it is very unlikely only patch 1 will be backported, > I think the whole patchset should be, therefore we have no reason > to carry a temporary fix here. sure, I will do that. thanks! -- davide