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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 7A7D3C1975A for ; Tue, 17 Mar 2020 20:08:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F3C520752 for ; Tue, 17 Mar 2020 20:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbgCQUIH (ORCPT ); Tue, 17 Mar 2020 16:08:07 -0400 Received: from www62.your-server.de ([213.133.104.62]:44632 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgCQUIG (ORCPT ); Tue, 17 Mar 2020 16:08:06 -0400 Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1jEIVR-0007qc-6H; Tue, 17 Mar 2020 21:08:05 +0100 Received: from [85.7.42.192] (helo=pc-9.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jEIVQ-0007Ra-Ul; Tue, 17 Mar 2020 21:08:04 +0100 Subject: Re: [PATCH v3 bpf] bpf: Sanitize the bpf_struct_ops tcp-cc name To: Martin KaFai Lau , bpf@vger.kernel.org Cc: Alexei Starovoitov , kernel-team@fb.com, netdev@vger.kernel.org References: <20200314010209.1131542-1-kafai@fb.com> From: Daniel Borkmann Message-ID: Date: Tue, 17 Mar 2020 21:08:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200314010209.1131542-1-kafai@fb.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.2/25754/Tue Mar 17 14:09:15 2020) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 3/14/20 2:02 AM, Martin KaFai Lau wrote: > The bpf_struct_ops tcp-cc name should be sanitized in order to > avoid problematic chars (e.g. whitespaces). > > This patch reuses the bpf_obj_name_cpy() for accepting the same set > of characters in order to keep a consistent bpf programming experience. > A "size" param is added. Also, the strlen is returned on success so > that the caller (like the bpf_tcp_ca here) can error out on empty name. > The existing callers of the bpf_obj_name_cpy() only need to change the > testing statement to "if (err < 0)". For all these existing callers, > the err will be overwritten later, so no extra change is needed > for the new strlen return value. > > v3: > - reverse xmas tree style > > v2: > - Save the orig_src to avoid "end - size" (Andrii) > > Fixes: 0baf26b0fcd7 ("bpf: tcp: Support tcp_congestion_ops in bpf") > Acked-by: Andrii Nakryiko > Signed-off-by: Martin KaFai Lau Applied, thanks!