mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 23:23:03 +00:00
selftests/bpf: fix some typos in selftests
Hi, fix some spelling errors in selftest, the details are as follows: -in the codes: test_bpf_sk_stoarge_map_iter_fd(void) ->test_bpf_sk_storage_map_iter_fd(void) load BTF from btf_data.o->load BTF from btf_data.bpf.o -in the code comments: preample->preamble multi-contollers->multi-controllers errono->errno unsighed/unsinged->unsigned egree->egress shoud->should regsiter->register assummed->assumed conditiona->conditional rougly->roughly timetamp->timestamp ingores->ignores null-termainted->null-terminated slepable->sleepable implemenation->implementation veriables->variables timetamps->timestamps substitue a costant->substitute a constant secton->section unreferened->unreferenced verifer->verifier libppf->libbpf ... Signed-off-by: Lin Yikai <yikai.lin@vivo.com> Link: https://lore.kernel.org/r/20240905110354.3274546-1-yikai.lin@vivo.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
552895afad
commit
5db0ba6766
@ -276,7 +276,7 @@ static void trigger_rawtp_setup(void)
|
||||
* instructions. So use two different targets, one of which starts with nop
|
||||
* and another doesn't.
|
||||
*
|
||||
* GCC doesn't generate stack setup preample for these functions due to them
|
||||
* GCC doesn't generate stack setup preamble for these functions due to them
|
||||
* having no input arguments and doing nothing in the body.
|
||||
*/
|
||||
__nocf_check __weak void uprobe_target_nop(void)
|
||||
|
@ -644,7 +644,7 @@ unsigned long long get_classid_cgroup_id(void)
|
||||
/**
|
||||
* get_cgroup1_hierarchy_id - Retrieves the ID of a cgroup1 hierarchy from the cgroup1 subsys name.
|
||||
* @subsys_name: The cgroup1 subsys name, which can be retrieved from /proc/self/cgroup. It can be
|
||||
* a named cgroup like "name=systemd", a controller name like "net_cls", or multi-contollers like
|
||||
* a named cgroup like "name=systemd", a controller name like "net_cls", or multi-controllers like
|
||||
* "net_cls,net_prio".
|
||||
*/
|
||||
int get_cgroup1_hierarchy_id(const char *subsys_name)
|
||||
|
@ -197,7 +197,7 @@ void __test_map_lookup_and_delete_batch(bool is_pcpu)
|
||||
CHECK(total != max_entries, "delete with steps",
|
||||
"total = %u, max_entries = %u\n", total, max_entries);
|
||||
|
||||
/* check map is empty, errono == ENOENT */
|
||||
/* check map is empty, errno == ENOENT */
|
||||
err = bpf_map_get_next_key(map_fd, NULL, &key);
|
||||
CHECK(!err || errno != ENOENT, "bpf_map_get_next_key()",
|
||||
"error: %s\n", strerror(errno));
|
||||
|
@ -135,7 +135,7 @@ void test_lpm_trie_map_batch_ops(void)
|
||||
CHECK(total != max_entries, "delete with steps",
|
||||
"total = %u, max_entries = %u\n", total, max_entries);
|
||||
|
||||
/* check map is empty, errono == ENOENT */
|
||||
/* check map is empty, errno == ENOENT */
|
||||
err = bpf_map_get_next_key(map_fd, NULL, &key);
|
||||
CHECK(!err || errno != ENOENT, "bpf_map_get_next_key()",
|
||||
"error: %s\n", strerror(errno));
|
||||
|
@ -1218,7 +1218,7 @@ out:
|
||||
bpf_iter_bpf_sk_storage_helpers__destroy(skel);
|
||||
}
|
||||
|
||||
static void test_bpf_sk_stoarge_map_iter_fd(void)
|
||||
static void test_bpf_sk_storage_map_iter_fd(void)
|
||||
{
|
||||
struct bpf_iter_bpf_sk_storage_map *skel;
|
||||
|
||||
@ -1693,7 +1693,7 @@ void test_bpf_iter(void)
|
||||
if (test__start_subtest("bpf_sk_storage_map"))
|
||||
test_bpf_sk_storage_map();
|
||||
if (test__start_subtest("bpf_sk_storage_map_iter_fd"))
|
||||
test_bpf_sk_stoarge_map_iter_fd();
|
||||
test_bpf_sk_storage_map_iter_fd();
|
||||
if (test__start_subtest("bpf_sk_storage_delete"))
|
||||
test_bpf_sk_storage_delete();
|
||||
if (test__start_subtest("bpf_sk_storage_get"))
|
||||
|
@ -4986,7 +4986,7 @@ struct pprint_mapv_int128 {
|
||||
static struct btf_raw_test pprint_test_template[] = {
|
||||
{
|
||||
.raw_types = {
|
||||
/* unsighed char */ /* [1] */
|
||||
/* unsigned char */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1),
|
||||
/* unsigned short */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 16, 2),
|
||||
@ -5053,7 +5053,7 @@ static struct btf_raw_test pprint_test_template[] = {
|
||||
* be encoded with kind_flag set.
|
||||
*/
|
||||
.raw_types = {
|
||||
/* unsighed char */ /* [1] */
|
||||
/* unsigned char */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1),
|
||||
/* unsigned short */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 16, 2),
|
||||
@ -5120,7 +5120,7 @@ static struct btf_raw_test pprint_test_template[] = {
|
||||
* will have both int and enum types.
|
||||
*/
|
||||
.raw_types = {
|
||||
/* unsighed char */ /* [1] */
|
||||
/* unsigned char */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1),
|
||||
/* unsigned short */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 16, 2),
|
||||
|
@ -214,7 +214,7 @@ static void test_isolated(int parent_cgroup_fd, int child_cgroup_fd)
|
||||
/* Attach to parent and child cgroup, trigger packet from child.
|
||||
* Assert that there is six additional runs, parent cgroup egresses and
|
||||
* ingress, child cgroup egresses and ingress.
|
||||
* Assert that egree and ingress storages are separate.
|
||||
* Assert that egress and ingress storages are separate.
|
||||
*/
|
||||
child_egress1_link = bpf_program__attach_cgroup(obj->progs.egress1,
|
||||
child_cgroup_fd);
|
||||
|
@ -160,7 +160,7 @@ static void bpf_prog_load_log_buf(void)
|
||||
opts.log_buf = log_buf;
|
||||
opts.log_size = log_buf_sz;
|
||||
|
||||
/* with log_level == 0 log_buf shoud stay empty for good prog */
|
||||
/* with log_level == 0 log_buf should stay empty for good prog */
|
||||
log_buf[0] = '\0';
|
||||
opts.log_level = 0;
|
||||
fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, "good_prog", "GPL",
|
||||
@ -222,7 +222,7 @@ static void bpf_btf_load_log_buf(void)
|
||||
opts.log_buf = log_buf;
|
||||
opts.log_size = log_buf_sz;
|
||||
|
||||
/* with log_level == 0 log_buf shoud stay empty for good BTF */
|
||||
/* with log_level == 0 log_buf should stay empty for good BTF */
|
||||
log_buf[0] = '\0';
|
||||
opts.log_level = 0;
|
||||
fd = bpf_btf_load(raw_btf_data, raw_btf_size, &opts);
|
||||
|
@ -503,7 +503,7 @@ static const char *op_str(enum op op)
|
||||
|
||||
/* Can register with range [x.a, x.b] *EVER* satisfy
|
||||
* OP (<, <=, >, >=, ==, !=) relation to
|
||||
* a regsiter with range [y.a, y.b]
|
||||
* a register with range [y.a, y.b]
|
||||
* _in *num_t* domain_
|
||||
*/
|
||||
static bool range_canbe_op(enum num_t t, struct range x, struct range y, enum op op)
|
||||
@ -532,7 +532,7 @@ static bool range_canbe_op(enum num_t t, struct range x, struct range y, enum op
|
||||
|
||||
/* Does register with range [x.a, x.b] *ALWAYS* satisfy
|
||||
* OP (<, <=, >, >=, ==, !=) relation to
|
||||
* a regsiter with range [y.a, y.b]
|
||||
* a register with range [y.a, y.b]
|
||||
* _in *num_t* domain_
|
||||
*/
|
||||
static bool range_always_op(enum num_t t, struct range x, struct range y, enum op op)
|
||||
@ -543,7 +543,7 @@ static bool range_always_op(enum num_t t, struct range x, struct range y, enum o
|
||||
|
||||
/* Does register with range [x.a, x.b] *NEVER* satisfy
|
||||
* OP (<, <=, >, >=, ==, !=) relation to
|
||||
* a regsiter with range [y.a, y.b]
|
||||
* a register with range [y.a, y.b]
|
||||
* _in *num_t* domain_
|
||||
*/
|
||||
static bool range_never_op(enum num_t t, struct range x, struct range y, enum op op)
|
||||
@ -1018,11 +1018,11 @@ static int parse_reg_state(const char *s, struct reg_state *reg)
|
||||
* - umin=%llu, if missing, assumed 0;
|
||||
* - umax=%llu, if missing, assumed U64_MAX;
|
||||
* - smin=%lld, if missing, assumed S64_MIN;
|
||||
* - smax=%lld, if missing, assummed S64_MAX;
|
||||
* - smax=%lld, if missing, assumed S64_MAX;
|
||||
* - umin32=%d, if missing, assumed 0;
|
||||
* - umax32=%d, if missing, assumed U32_MAX;
|
||||
* - smin32=%d, if missing, assumed S32_MIN;
|
||||
* - smax32=%d, if missing, assummed S32_MAX;
|
||||
* - smax32=%d, if missing, assumed S32_MAX;
|
||||
* - var_off=(%#llx; %#llx), tnum part, we don't care about it.
|
||||
*
|
||||
* If some of the values are equal, they will be grouped (but min/max
|
||||
@ -1884,7 +1884,7 @@ cleanup:
|
||||
* envvar is not set, this test is skipped during test_progs testing.
|
||||
*
|
||||
* We split this up into smaller subsets based on initialization and
|
||||
* conditiona numeric domains to get an easy parallelization with test_progs'
|
||||
* conditional numeric domains to get an easy parallelization with test_progs'
|
||||
* -j argument.
|
||||
*/
|
||||
|
||||
@ -1938,7 +1938,7 @@ static u64 rand_u64()
|
||||
{
|
||||
/* RAND_MAX is guaranteed to be at least 1<<15, but in practice it
|
||||
* seems to be 1<<31, so we need to call it thrice to get full u64;
|
||||
* we'll use rougly equal split: 22 + 21 + 21 bits
|
||||
* we'll use roughly equal split: 22 + 21 + 21 bits
|
||||
*/
|
||||
return ((u64)random() << 42) |
|
||||
(((u64)random() & RAND_21BIT_MASK) << 21) |
|
||||
|
@ -103,7 +103,7 @@ static int resolve_symbols(void)
|
||||
|
||||
btf = btf__parse_elf("btf_data.bpf.o", NULL);
|
||||
if (CHECK(libbpf_get_error(btf), "resolve",
|
||||
"Failed to load BTF from btf_data.o\n"))
|
||||
"Failed to load BTF from btf_data.bpf.o\n"))
|
||||
return -1;
|
||||
|
||||
nr = btf__type_cnt(btf);
|
||||
|
@ -872,7 +872,7 @@ static void test_tcp_dtime(struct test_tc_dtime *skel, int family, bool bpf_fwd)
|
||||
test_inet_dtime(family, SOCK_STREAM, addr, 50000 + t);
|
||||
|
||||
/* fwdns_prio100 prog does not read delivery_time_type, so
|
||||
* kernel puts the (rcv) timetamp in __sk_buff->tstamp
|
||||
* kernel puts the (rcv) timestamp in __sk_buff->tstamp
|
||||
*/
|
||||
ASSERT_EQ(dtimes[INGRESS_FWDNS_P100], 0,
|
||||
dtime_cnt_str(t, INGRESS_FWDNS_P100));
|
||||
|
@ -51,7 +51,7 @@ static int run_set_secureexec(int map_fd, int secureexec)
|
||||
exit(ret);
|
||||
|
||||
/* If the binary is executed with securexec=1, the dynamic
|
||||
* loader ingores and unsets certain variables like LD_PRELOAD,
|
||||
* loader ignores and unsets certain variables like LD_PRELOAD,
|
||||
* TMPDIR etc. TMPDIR is used here to simplify the example, as
|
||||
* LD_PRELOAD requires a real .so file.
|
||||
*
|
||||
|
@ -72,7 +72,7 @@ static void test_strncmp_ret(void)
|
||||
got = trigger_strncmp(skel);
|
||||
ASSERT_EQ(got, 0, "strncmp: same str");
|
||||
|
||||
/* Not-null-termainted string */
|
||||
/* Not-null-terminated string */
|
||||
memcpy(skel->bss->str, skel->rodata->target, sizeof(skel->bss->str));
|
||||
skel->bss->str[sizeof(skel->bss->str) - 1] = 'A';
|
||||
got = trigger_strncmp(skel);
|
||||
|
@ -867,7 +867,7 @@ static int userns_obj_priv_implicit_token(int mnt_fd, struct token_lsm *lsm_skel
|
||||
}
|
||||
unsetenv(TOKEN_ENVVAR);
|
||||
|
||||
/* now the same struct_ops skeleton should succeed thanks to libppf
|
||||
/* now the same struct_ops skeleton should succeed thanks to libbpf
|
||||
* creating BPF token from /sys/fs/bpf mount point
|
||||
*/
|
||||
skel = dummy_st_ops_success__open_and_load();
|
||||
@ -929,7 +929,7 @@ static int userns_obj_priv_implicit_token_envvar(int mnt_fd, struct token_lsm *l
|
||||
if (!ASSERT_OK(err, "setenv_token_path"))
|
||||
goto err_out;
|
||||
|
||||
/* now the same struct_ops skeleton should succeed thanks to libppf
|
||||
/* now the same struct_ops skeleton should succeed thanks to libbpf
|
||||
* creating BPF token from custom mount point
|
||||
*/
|
||||
skel = dummy_st_ops_success__open_and_load();
|
||||
|
@ -213,7 +213,7 @@ static void uprobe_multi_test_run(struct uprobe_multi *skel, struct child *child
|
||||
|
||||
/*
|
||||
* There are 2 entry and 2 exit probe called for each uprobe_multi_func_[123]
|
||||
* function and each slepable probe (6) increments uprobe_multi_sleep_result.
|
||||
* function and each sleepable probe (6) increments uprobe_multi_sleep_result.
|
||||
*/
|
||||
ASSERT_EQ(skel->bss->uprobe_multi_func_1_result, 2, "uprobe_multi_func_1_result");
|
||||
ASSERT_EQ(skel->bss->uprobe_multi_func_2_result, 2, "uprobe_multi_func_2_result");
|
||||
|
@ -643,7 +643,7 @@ static void test_user_ringbuf_blocking_reserve(void)
|
||||
if (!ASSERT_EQ(err, 0, "deferred_kick_thread\n"))
|
||||
goto cleanup;
|
||||
|
||||
/* After spawning another thread that asychronously kicks the kernel to
|
||||
/* After spawning another thread that asynchronously kicks the kernel to
|
||||
* drain the messages, we're able to block and successfully get a
|
||||
* sample once we receive an event notification.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
/* WARNING: This implemenation is not necessarily the same
|
||||
/* WARNING: This implementation is not necessarily the same
|
||||
* as the tcp_cubic.c. The purpose is mainly for testing
|
||||
* the kernel BPF logic.
|
||||
*
|
||||
@ -314,7 +314,7 @@ static void bictcp_update(struct bpf_bictcp *ca, __u32 cwnd, __u32 acked)
|
||||
* (so time^3 is done by using 64 bit)
|
||||
* and without the support of division of 64bit numbers
|
||||
* (so all divisions are done by using 32 bit)
|
||||
* also NOTE the unit of those veriables
|
||||
* also NOTE the unit of those variables
|
||||
* time = (t - K) / 2^bictcp_HZ
|
||||
* c = bic_scale >> 10
|
||||
* rtt = (srtt >> 3) / HZ
|
||||
@ -507,7 +507,7 @@ void BPF_PROG(bpf_cubic_acked, struct sock *sk, const struct ack_sample *sample)
|
||||
__u32 delay;
|
||||
|
||||
bpf_cubic_acked_called = 1;
|
||||
/* Some calls are for duplicates without timetamps */
|
||||
/* Some calls are for duplicates without timestamps */
|
||||
if (sample->rtt_us < 0)
|
||||
return;
|
||||
|
||||
|
@ -373,7 +373,7 @@ static __always_inline uint64_t read_str_var(struct strobemeta_cfg *cfg,
|
||||
len = bpf_probe_read_user_str(&data->payload[off], STROBE_MAX_STR_LEN, value->ptr);
|
||||
/*
|
||||
* if bpf_probe_read_user_str returns error (<0), due to casting to
|
||||
* unsinged int, it will become big number, so next check is
|
||||
* unsigned int, it will become big number, so next check is
|
||||
* sufficient to check for errors AND prove to BPF verifier, that
|
||||
* bpf_probe_read_user_str won't return anything bigger than
|
||||
* STROBE_MAX_STR_LEN
|
||||
@ -557,7 +557,7 @@ static void *read_strobe_meta(struct task_struct *task,
|
||||
return NULL;
|
||||
|
||||
payload_off = ctx.payload_off;
|
||||
/* this should not really happen, here only to satisfy verifer */
|
||||
/* this should not really happen, here only to satisfy verifier */
|
||||
if (payload_off > sizeof(data->payload))
|
||||
payload_off = sizeof(data->payload);
|
||||
#else
|
||||
|
@ -503,7 +503,7 @@ static ret_t get_next_hop(struct bpf_dynptr *dynptr, __u64 *offset, encap_header
|
||||
*
|
||||
* fill_tuple(&t, foo, sizeof(struct iphdr), 123, 321)
|
||||
*
|
||||
* clang will substitue a costant for sizeof, which allows the verifier
|
||||
* clang will substitute a constant for sizeof, which allows the verifier
|
||||
* to track it's value. Based on this, it can figure out the constant
|
||||
* return value, and calling code works while still being "generic" to
|
||||
* IPv4 and IPv6.
|
||||
|
@ -36,7 +36,7 @@ int handler(void *ctx)
|
||||
return 0;
|
||||
|
||||
/* next pointers for kernel address space have to be initialized from
|
||||
* BPF side, user-space mmaped addresses are stil user-space addresses
|
||||
* BPF side, user-space mmaped addresses are still user-space addresses
|
||||
*/
|
||||
k_probe_in.next = &k_probe_in;
|
||||
__builtin_preserve_access_index(({k_core_in.next = &k_core_in;}));
|
||||
|
@ -44,7 +44,7 @@ __naked int global_func15_tricky_pruning(void)
|
||||
* case we have a valid 1 stored in R0 register, but in
|
||||
* a branch case we assign some random value to R0. So if
|
||||
* there is something wrong with precision tracking for R0 at
|
||||
* program exit, we might erronenously prune branch case,
|
||||
* program exit, we might erroneously prune branch case,
|
||||
* because R0 in fallthrough case is imprecise (and thus any
|
||||
* value is valid from POV of verifier is_state_equal() logic)
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ const volatile size_t data_array_len;
|
||||
int sum = 0;
|
||||
int array[1];
|
||||
|
||||
/* custom data secton */
|
||||
/* custom data section */
|
||||
int my_array[1] SEC(".data.custom");
|
||||
|
||||
/* custom data section which should NOT be resizable,
|
||||
|
@ -1515,7 +1515,7 @@ again:
|
||||
value == key);
|
||||
}
|
||||
|
||||
/* Now let's delete all elemenets in parallel. */
|
||||
/* Now let's delete all elements in parallel. */
|
||||
data[1] = DO_DELETE;
|
||||
run_parallel(TASKS, test_update_delete, data);
|
||||
|
||||
|
@ -1500,7 +1500,7 @@ static void calculate_summary_and_print_errors(struct test_env *env)
|
||||
|
||||
/*
|
||||
* We only print error logs summary when there are failed tests and
|
||||
* verbose mode is not enabled. Otherwise, results may be incosistent.
|
||||
* verbose mode is not enabled. Otherwise, results may be inconsistent.
|
||||
*
|
||||
*/
|
||||
if (!verbose() && fail_cnt) {
|
||||
|
@ -153,7 +153,7 @@
|
||||
.result = REJECT,
|
||||
.errstr = "variable untrusted_ptr_ access var_off=(0x0; 0x7) disallowed",
|
||||
},
|
||||
/* Tests for unreferened PTR_TO_BTF_ID */
|
||||
/* Tests for unreferenced PTR_TO_BTF_ID */
|
||||
{
|
||||
"map_kptr: unref: reject btf_struct_ids_match == false",
|
||||
.insns = {
|
||||
|
Loading…
Reference in New Issue
Block a user