@@ -15198,6 +15198,7 @@ struct tail_call_test {
15198
15198
int flags ;
15199
15199
int result ;
15200
15200
int stack_depth ;
15201
+ bool has_tail_call ;
15201
15202
};
15202
15203
15203
15204
/* Flags that can be passed to tail call test cases */
@@ -15273,6 +15274,7 @@ static struct tail_call_test tail_call_tests[] = {
15273
15274
BPF_EXIT_INSN (),
15274
15275
},
15275
15276
.result = 3 ,
15277
+ .has_tail_call = true,
15276
15278
},
15277
15279
{
15278
15280
"Tail call 3" ,
@@ -15283,6 +15285,7 @@ static struct tail_call_test tail_call_tests[] = {
15283
15285
BPF_EXIT_INSN (),
15284
15286
},
15285
15287
.result = 6 ,
15288
+ .has_tail_call = true,
15286
15289
},
15287
15290
{
15288
15291
"Tail call 4" ,
@@ -15293,6 +15296,7 @@ static struct tail_call_test tail_call_tests[] = {
15293
15296
BPF_EXIT_INSN (),
15294
15297
},
15295
15298
.result = 10 ,
15299
+ .has_tail_call = true,
15296
15300
},
15297
15301
{
15298
15302
"Tail call load/store leaf" ,
@@ -15323,6 +15327,7 @@ static struct tail_call_test tail_call_tests[] = {
15323
15327
},
15324
15328
.result = 0 ,
15325
15329
.stack_depth = 16 ,
15330
+ .has_tail_call = true,
15326
15331
},
15327
15332
{
15328
15333
"Tail call error path, max count reached" ,
@@ -15335,6 +15340,7 @@ static struct tail_call_test tail_call_tests[] = {
15335
15340
},
15336
15341
.flags = FLAG_NEED_STATE | FLAG_RESULT_IN_STATE ,
15337
15342
.result = (MAX_TAIL_CALL_CNT + 1 ) * MAX_TESTRUNS ,
15343
+ .has_tail_call = true,
15338
15344
},
15339
15345
{
15340
15346
"Tail call count preserved across function calls" ,
@@ -15357,6 +15363,7 @@ static struct tail_call_test tail_call_tests[] = {
15357
15363
.stack_depth = 8 ,
15358
15364
.flags = FLAG_NEED_STATE | FLAG_RESULT_IN_STATE ,
15359
15365
.result = (MAX_TAIL_CALL_CNT + 1 ) * MAX_TESTRUNS ,
15366
+ .has_tail_call = true,
15360
15367
},
15361
15368
{
15362
15369
"Tail call error path, NULL target" ,
@@ -15369,6 +15376,7 @@ static struct tail_call_test tail_call_tests[] = {
15369
15376
},
15370
15377
.flags = FLAG_NEED_STATE | FLAG_RESULT_IN_STATE ,
15371
15378
.result = MAX_TESTRUNS ,
15379
+ .has_tail_call = true,
15372
15380
},
15373
15381
{
15374
15382
"Tail call error path, index out of range" ,
@@ -15381,6 +15389,7 @@ static struct tail_call_test tail_call_tests[] = {
15381
15389
},
15382
15390
.flags = FLAG_NEED_STATE | FLAG_RESULT_IN_STATE ,
15383
15391
.result = MAX_TESTRUNS ,
15392
+ .has_tail_call = true,
15384
15393
},
15385
15394
};
15386
15395
@@ -15430,6 +15439,7 @@ static __init int prepare_tail_call_tests(struct bpf_array **pprogs)
15430
15439
fp -> len = len ;
15431
15440
fp -> type = BPF_PROG_TYPE_SOCKET_FILTER ;
15432
15441
fp -> aux -> stack_depth = test -> stack_depth ;
15442
+ fp -> aux -> tail_call_reachable = test -> has_tail_call ;
15433
15443
memcpy (fp -> insnsi , test -> insns , len * sizeof (struct bpf_insn ));
15434
15444
15435
15445
/* Relocate runtime tail call offsets and addresses */
0 commit comments