Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/tools/testing/selftests/bpf/progs/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Quelle  verifier_bpf_trap.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include "bpf_misc.h"

#if __clang_major__ >= 21 && 0
SEC("socket")
__description("__builtin_trap with simple c code")
__failure __msg("unexpected __bpf_trap() due to uninitialized variable?")
void bpf_builtin_trap_with_simple_c(void)
{
 __builtin_trap();
}
#endif

SEC("socket")
__description("__bpf_trap with simple c code")
__failure __msg("unexpected __bpf_trap() due to uninitialized variable?")
void bpf_trap_with_simple_c(void)
{
 __bpf_trap();
}

SEC("socket")
__description("__bpf_trap as the second-from-last insn")
__failure __msg("unexpected __bpf_trap() due to uninitialized variable?")
__naked void bpf_trap_at_func_end(void)
{
 asm volatile (
 "r0 = 0;"
 "call %[__bpf_trap];"
 "exit;"
 :
 : __imm(__bpf_trap)
 : __clobber_all);
}

SEC("socket")
__description("dead code __bpf_trap in the middle of code")
__success
__naked void dead_bpf_trap_in_middle(void)
{
 asm volatile (
 "r0 = 0;"
 "if r0 == 0 goto +1;"
 "call %[__bpf_trap];"
 "r0 = 2;"
 "exit;"
 :
 : __imm(__bpf_trap)
 : __clobber_all);
}

SEC("socket")
__description("reachable __bpf_trap in the middle of code")
__failure __msg("unexpected __bpf_trap() due to uninitialized variable?")
__naked void live_bpf_trap_in_middle(void)
{
 asm volatile (
 "r0 = 0;"
 "if r0 == 1 goto +1;"
 "call %[__bpf_trap];"
 "r0 = 2;"
 "exit;"
 :
 : __imm(__bpf_trap)
 : __clobber_all);
}

char _license[] SEC("license") = "GPL";

Messung V0.5
C=98 H=65 G=83

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.