Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp788468imm; Fri, 28 Sep 2018 06:53:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV60vygkW0hkZgMXevVSSjJTpwwSXJvkJFiR3GDO7LCltG4wOBTdabUW48LgachLMpwhmy2Wa X-Received: by 2002:a17:902:1681:: with SMTP id h1-v6mr16390090plh.262.1538142834373; Fri, 28 Sep 2018 06:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538142834; cv=none; d=google.com; s=arc-20160816; b=S/ARoYF+3mkSFtHc4U11CPLqqQEUMxKnDtPcYS5G5b4YBu6OGP5zN07fyedvNKVvl7 Tgft7cff7L648I91eiApdB0J84B4t74NlV5RcxyCMb/New9CIXwJm08S9nUQp48DO64z Nyzsjf0haRw94kGZBrpCvVnJXA/Erzi4TeeKIMudPU0nw17U4YmkUNDtW1EnnXnUkKhc ZWofAHHpQBB59rQUEDBTccxIPgS2hY9pu1j/6AyUrwRja/b/gN8aGWuGfiEhDaaDM/Vo c8meOmp7jxLxIvENcSQsDwxlyUdrIv2pjNo8vV81YP0wldsxRnGRCEw1iwd72cAQBBSu ILrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=CSPY+UYr69ezv+LPKK7SDwu8FLFar6YjiOHCiaYkfEk=; b=01IfolKqkX7aXYnm6dA8PZjO9oVhxW7nz1DuoMVWUab/Dy+biVl1+hhK2vgIXWtgOh 9leE8NBsQSlSxO1rnF43SNHPUlDCalZvQMSqXp8dFw1LjHih+ZdgIrEoy0RShU2csNgX eo0jPTi+s7nOjDP3tnmKhMuY7ar93QAKnAjAXWLNqxvy2OlhEqxVlogfCsKIRMxzrmwp Ch7dXw/EzeBd8a0K7DgRR3S+CuCf4U9Vf0zfKMOrfI2Zt7G6ksB2gAUlhs2AirYM/dCR hB6ChkMDANM9DrEjci32HdcHpiiYiU1PQdvYBu6umQAOOSSV7UPts/ntgjNyqx4GkAdn ftbA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si4894400plb.249.2018.09.28.06.53.38; Fri, 28 Sep 2018 06:53:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729378AbeI1URG (ORCPT + 99 others); Fri, 28 Sep 2018 16:17:06 -0400 Received: from www62.your-server.de ([213.133.104.62]:46673 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbeI1URF (ORCPT ); Fri, 28 Sep 2018 16:17:05 -0400 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1g5tCh-0002Pp-3A; Fri, 28 Sep 2018 15:53:11 +0200 Received: from [178.197.248.15] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1g5tCg-000C35-U5; Fri, 28 Sep 2018 15:53:10 +0200 Subject: Re: [PATCH bpf] bpf: harden flags check in cgroup_storage_update_elem() To: Roman Gushchin , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, Alexei Starovoitov References: <20180928133321.31121-1-guro@fb.com> From: Daniel Borkmann Message-ID: <2b829425-96c7-aa51-d783-f727c4ef96d6@iogearbox.net> Date: Fri, 28 Sep 2018 15:53:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180928133321.31121-1-guro@fb.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.1/24989/Fri Sep 28 10:53:45 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28/2018 03:33 PM, Roman Gushchin wrote: > cgroup_storage_update_elem() shouldn't accept any flags > argument values except BPF_ANY and BPF_EXIST to guarantee > the backward compatibility, had a new flag value been added. > > Fixes: de9cbbaadba5 ("bpf: introduce cgroup storage maps") > Signed-off-by: Roman Gushchin > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > --- > kernel/bpf/local_storage.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c > index f8746e6a9a35..2a7680106320 100644 > --- a/kernel/bpf/local_storage.c > +++ b/kernel/bpf/local_storage.c > @@ -130,7 +130,7 @@ static int cgroup_storage_update_elem(struct bpf_map *map, void *_key, > struct bpf_cgroup_storage *storage; > struct bpf_storage_buffer *new; > > - if (flags & BPF_NOEXIST) > + if (flags != BPF_ANY && flags != BPF_EXIST) > return -EINVAL; > > storage = cgroup_storage_lookup((struct bpf_cgroup_storage_map *)map, > Applied to bpf, thanks!