Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2631718rwi; Tue, 1 Nov 2022 09:50:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WWgRJpb6ccpWF5f0ndoYJKI16BD5gATf9+ajKBzAUvJnZfx7JvuhE+WFtPCjhFODWopyy X-Received: by 2002:a17:907:970b:b0:78d:8d70:e4e8 with SMTP id jg11-20020a170907970b00b0078d8d70e4e8mr18326010ejc.614.1667321420622; Tue, 01 Nov 2022 09:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667321420; cv=none; d=google.com; s=arc-20160816; b=S9eOrvlOeHIQOHL4DBCN2P6MUkFx/oKCy4ZNPL2RPtNxxhVl6b8fIocC6SsybGOzuj sHgB0sqJ4Y7SXEhqzUfRRuZccx7RZxU5O6PkjZHGrx2BKcdJkFkxPBMZsDV5yMCkNafR Sf67qZXee2zitHsOEWbu60fHmOoSw+vK724SfoMT0pF1Sj4hFo3SL98sKqF8O6Hha+hC V0fJ+7kdr1k9wQ0Wu5ShIQcp7yLtR5n76h65+jKPq9Z5D+sBv10VueZznjxmSeGr8APz pdDvVYAhox7D7gBIMGKNQUQpxFCaMWasubxVXnpN2nrAJDEiMkXnafdCq+jokwADonWA 4KBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Nxmcs1XGl2gW9RCS/tUkl65pyauva0FypJqjOanVy98=; b=WqlEvT9mMwMoz5jq476nwN3DixMoTTw4bYDlmQCxJS9kYKDrbQU5hk/3kVZyqv6kFM pUGDfmPx+5Ii3OcrLG+janhD7Ibhc8gaqYf6mfjHRttBbk2mKQYLrVqLioKYmIuX6EnU VXcrj1ghnASSSyVZzksspAT2NrnzNuO/3YxouKXkZiltqEPceri6fYb98PjiEkr5ZWQu HIwJmQ7cGrO2xydfLEF9NDnOqPjS4ZpsDcUU4+90x5cbA6RUWAZvbyU6XxoMtjQE4kPE Yku6iRx9k6mZznRrJx6LeWqvRt/qwS5m9W42Nu01rOUebqio8iWpEFfV0v10oqjzfz+c Ayrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a50eaca000000b0045d0c00ead2si10254389edp.157.2022.11.01.09.49.57; Tue, 01 Nov 2022 09:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229814AbiKAQ15 (ORCPT + 97 others); Tue, 1 Nov 2022 12:27:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbiKAQ1z (ORCPT ); Tue, 1 Nov 2022 12:27:55 -0400 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF511CFC9; Tue, 1 Nov 2022 09:27:52 -0700 (PDT) Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1optT4-0009B8-27; Tue, 01 Nov 2022 16:46:22 +0100 Received: from [85.1.206.226] (helo=linux.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1optT3-000TRb-I0; Tue, 01 Nov 2022 16:46:21 +0100 Subject: Re: [PATCH bpf-next] selftests/bpf: Fix strncpy() fortify warning To: Rong Tao Cc: andrii.nakryiko@gmail.com, andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, david.laight@aculab.com, haoluo@google.com, john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, martin.lau@linux.dev, mykolal@fb.com, rongtao@cestc.cn, sdf@google.com, shuah@kernel.org, song@kernel.org, yhs@fb.com References: From: Daniel Borkmann Message-ID: Date: Tue, 1 Nov 2022 16:46:20 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.6/26706/Tue Nov 1 08:52:34 2022) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/1/22 3:23 PM, Rong Tao wrote: > From: Rong Tao > > move libbpf_strlcpy() to bpf_util.h, and replace strncpy() with > libbpf_strlcpy(), fix compile warning. > > Compile samples/bpf, warning: > $ cd samples/bpf > $ make > ... > cgroup_helpers.c: In function ‘__enable_controllers’: > cgroup_helpers.c:80:17: warning: ‘strncpy’ specified bound 4097 equals destination size [-Wstringop-truncation] > 80 | strncpy(enable, controllers, sizeof(enable)); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Signed-off-by: Rong Tao Nope, BPF CI fails once again with: https://github.com/kernel-patches/bpf/actions/runs/3370230622/jobs/5590876906 [...] TEST-OBJ [test_progs-no_alu32] connect_ping.test.o TEST-OBJ [test_progs-no_alu32] map_kptr.test.o In file included from /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/perf_branches.c:7: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_internal.h:200:20: error: redefinition of 'libbpf_strlcpy' static inline void libbpf_strlcpy(char *dst, const char *src, size_t sz) ^ /tmp/work/bpf/bpf/tools/testing/selftests/bpf/bpf_util.h:29:20: note: previous definition is here static inline void libbpf_strlcpy(char *dst, const char *src, size_t sz) ^ 1 error generated. TEST-OBJ [test_progs-no_alu32] hash_large_key.test.o make: *** [Makefile:539: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/no_alu32/perf_branches.test.o] Error 1 make: *** Waiting for unfinished jobs.... make: Leaving directory '/tmp/work/bpf/bpf/tools/testing/selftests/bpf' Error: Process completed with exit code 2. Please do not send broken stuff that was not even compile tested. Here's a small howto for running BPF selftests: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/README.rst#n48