Skip to content

Commit

Permalink
feat: Add cyclone to the stack.
Browse files Browse the repository at this point in the history
Will be used to verify properties of toxcore's memory safety.
  • Loading branch information
iphydf committed Jan 18, 2025
1 parent e7f326c commit 32f3d04
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 20 deletions.
37 changes: 35 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ build --linkopt='-Wl,-z,noexecstack'
build --host_linkopt='-Wl,-z,noexecstack'
build --host_linkopt='-Wl,--warn-execstack'

build:local --linkopt='-Wl,--fatal-warnings'
build:local --host_linkopt='-Wl,--fatal-warnings'
#build:local --linkopt='-Wl,--fatal-warnings'
#build:local --host_linkopt='-Wl,--fatal-warnings'
build:local --linkopt='-fuse-ld=mold'

build:strict --linkopt='-Wl,--detect-odr-violations'
Expand Down Expand Up @@ -371,30 +371,62 @@ build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-unreachable-code-return'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-unused-macros'

# Cyclone.
build --host_per_file_copt='//cyclone[:/]@-w'
build --per_file_copt='//cyclone/stage0[:/]@-w'

build --per_file_copt='//cyclone[:/]@-fno-sanitize=undefined'
build --per_file_copt='//cyclone[:/]@-Wno-bad-function-cast'
build --per_file_copt='//cyclone[:/]@-Wno-bitwise-op-parentheses'
build --per_file_copt='//cyclone[:/]@-Wno-builtin-requires-header'
build --per_file_copt='//cyclone[:/]@-Wno-c++-compat'
build --per_file_copt='//cyclone[:/]@-Wno-c2x-compat'
build --per_file_copt='//cyclone[:/]@-Wno-cast-align'
build --per_file_copt='//cyclone[:/]@-Wno-cast-function-type'
build --per_file_copt='//cyclone[:/]@-Wno-cast-qual'
build --per_file_copt='//cyclone[:/]@-Wno-comma'
build --per_file_copt='//cyclone[:/]@-Wno-conditional-uninitialized'
build --per_file_copt='//cyclone[:/]@-Wno-double-promotion'
build --per_file_copt='//cyclone[:/]@-Wno-extra-semi-stmt'
build --per_file_copt='//cyclone[:/]@-Wno-float-equal'
build --per_file_copt='//cyclone[:/]@-Wno-ignored-attributes'
build --per_file_copt='//cyclone[:/]@-Wno-ignored-qualifiers'
build --per_file_copt='//cyclone[:/]@-Wno-implicit-fallthrough'
build --per_file_copt='//cyclone[:/]@-Wno-incompatible-function-pointer-types-strict'
build --per_file_copt='//cyclone[:/]@-Wno-incompatible-function-pointer-types'
build --per_file_copt='//cyclone[:/]@-Wno-incompatible-library-redeclaration'
build --per_file_copt='//cyclone[:/]@-Wno-incompatible-pointer-types-discards-qualifiers'
build --per_file_copt='//cyclone[:/]@-Wno-incompatible-pointer-types'
build --per_file_copt='//cyclone[:/]@-Wno-int-in-bool-context'
build --per_file_copt='//cyclone[:/]@-Wno-int-to-void-pointer-cast'
build --per_file_copt='//cyclone[:/]@-Wno-logical-op-parentheses'
build --per_file_copt='//cyclone[:/]@-Wno-misleading-indentation'
build --per_file_copt='//cyclone[:/]@-Wno-missing-prototypes'
build --per_file_copt='//cyclone[:/]@-Wno-missing-variable-declarations'
build --per_file_copt='//cyclone[:/]@-Wno-pedantic'
build --per_file_copt='//cyclone[:/]@-Wno-pointer-sign'
build --per_file_copt='//cyclone[:/]@-Wno-pointer-to-int-cast'
build --per_file_copt='//cyclone[:/]@-Wno-return-type'
build --per_file_copt='//cyclone[:/]@-Wno-shadow'
build --per_file_copt='//cyclone[:/]@-Wno-shift-op-parentheses'
build --per_file_copt='//cyclone[:/]@-Wno-sign-compare'
build --per_file_copt='//cyclone[:/]@-Wno-sometimes-uninitialized'
build --per_file_copt='//cyclone[:/]@-Wno-strict-prototypes'
build --per_file_copt='//cyclone[:/]@-Wno-switch-enum'
build --per_file_copt='//cyclone[:/]@-Wno-tautological-type-limit-compare'
build --per_file_copt='//cyclone[:/]@-Wno-undef'
build --per_file_copt='//cyclone[:/]@-Wno-unreachable-code-break'
build --per_file_copt='//cyclone[:/]@-Wno-unreachable-code'
build --per_file_copt='//cyclone[:/]@-Wno-unused-but-set-parameter'
build --per_file_copt='//cyclone[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='//cyclone[:/]@-Wno-unused-function'
build --per_file_copt='//cyclone[:/]@-Wno-unused-macros'
build --per_file_copt='//cyclone[:/]@-Wno-unused-value'
build --per_file_copt='//cyclone[:/]@-Wno-unused-variable'
build --per_file_copt='//cyclone[:/]@-Wno-variadic-macros'
build --per_file_copt='//cyclone[:/]@-Wno-void-pointer-to-int-cast'

build --per_file_copt='cyclone/testsuite/tests/@-Wno-infinite-recursion'
build --per_file_copt='cyclone/testsuite/tests/@-Wno-uninitialized'

build --host_per_file_copt='//cyclone[:/]@-Wno-incompatible-function-pointer-types'

Expand Down Expand Up @@ -586,6 +618,7 @@ build --per_file_copt='external/ffmpeg[:/]@-Wno-unused-but-set-variable'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused-const-variable'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused-function'
build --per_file_copt='external/ffmpeg[:/]@-Wno-unused'
build --per_file_copt='external/libbacktrace[:/]@-Wno-atomic-implicit-seq-cst'
build --per_file_copt='external/libcap[:/]@-Wno-gnu-zero-variadic-macro-arguments'
build --per_file_copt='external/libcap[:/]@-Wno-sign-compare'
build --per_file_copt='external/libcap[:/]@-Wno-tautological-unsigned-enum-zero-compare'
Expand Down
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[submodule "btox"]
path = btox
url = https://github.com/TokTok/bTox
[submodule "ci-tools"]
path = ci-tools
url = https://github.com/TokTok/ci-tools
[submodule "c-toxcore"]
path = c-toxcore
url = https://github.com/TokTok/c-toxcore
[submodule "ci-tools"]
path = ci-tools
url = https://github.com/TokTok/ci-tools
[submodule "cyclone"]
path = cyclone
url = https://github.com/TokTok/cyclone
[submodule "dockerfiles"]
path = dockerfiles
url = https://github.com/TokTok/dockerfiles
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
8 changes: 8 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,14 @@ http_archive(
urls = ["https://github.com/libunwind/libunwind/releases/download/v1.8.1/libunwind-1.8.1.tar.gz"],
)

# https://github.com/ianlancetaylor/libbacktrace
new_github_archive(
name = "libbacktrace",
integrity = "sha256-khG7h63XzNymJax129Tp9XJvHpnaVMTxWD0Poh44DJs=",
repo = "ianlancetaylor/libbacktrace",
version = "1db85642e3fca189cf4e076f840a45d6934b2456",
)

new_github_archive(
name = "kimageformats",
integrity = "sha256-tetGe5OFkjjrsse9CPfCoqIUKYa6flCzYbd3ERDBoSo=",
Expand Down
27 changes: 14 additions & 13 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
version: "0.2"
ignorePaths:
- "c-toxcore/**"
- c-toxcore/**
- "*bazelrc*"
words:
- "asan"
- "bazel"
- "bazelisk"
- "buildx"
- "fastbuild"
- "libfuzzer"
- "nixpkgs"
- "mypy"
- "patchelf"
- "toktok"
- "toxchat"
- "toxcore"
- asan
- bazel
- bazelisk
- buildx
- fastbuild
- LIBC
- libfuzzer
- mypy
- nixpkgs
- patchelf
- toktok
- toxchat
- toxcore
1 change: 1 addition & 0 deletions cyclone
Submodule cyclone added at d7f623
2 changes: 1 addition & 1 deletion hs-github-tools
54 changes: 54 additions & 0 deletions third_party/libbacktrace.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

genrule(
name = "regen_config",
srcs = [
"Makefile.in",
"backtrace.h",
"backtrace-supported.h.in",
"config.guess",
"config.h.in",
"config.sub",
"configure",
"install-debuginfo-for-buildid.sh.in",
"install-sh",
"missing",
],
outs = [
"backtrace-supported.h",
"config.h",
],
cmd = """
SRCDIR="$$(dirname $(location configure))"
"$$SRCDIR/configure" CC="$(CC)" CXX="$(CC)" AR="$(AR)" \
|| (cat config.log && false)
sed -i -e 's/#define BACKTRACE_ELF_SIZE unused/#define BACKTRACE_ELF_SIZE 64/' config.h

cp "backtrace-supported.h" "$(location backtrace-supported.h)"
cp "config.h" "$(location config.h)"
""",
toolchains = ["@rules_cc//cc:current_cc_toolchain"],
)

cc_library(
name = "libbacktrace",
srcs = [
"alloc.c",
"atomic.c",
"backtrace.c",
"backtrace.h",
"backtrace-supported.h",
"config.h",
"dwarf.c",
"elf.c",
"fileline.c",
"filenames.h",
"internal.h",
"posix.c",
"print.c",
"read.c",
"sort.c",
"state.c",
],
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ workspace(projects = [
"btox",
"c-toxcore",
"ci-tools",
"cyclone",
"dockerfiles",
"experimental",
"go-toxcore-c",
Expand Down
4 changes: 4 additions & 0 deletions tools/git-remotes
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ our %REPOS = (
repo 'iphydf',
repo 'camgunz',
}],
'cyclone' => ['cyclone', {
upstream => 'toktok',
repo 'iphydf',
}],
'dockerfiles' => ['dockerfiles', {
upstream => 'toktok',
repo 'iphydf',
Expand Down

0 comments on commit 32f3d04

Please sign in to comment.