Skip to content

Build with bazel on linux-x86_64#10

Merged
mcevoypeter merged 19 commits into
issue/1/bazel-buildfrom
issue/2/build-linux-x86_64
Nov 8, 2022
Merged

Build with bazel on linux-x86_64#10
mcevoypeter merged 19 commits into
issue/1/bazel-buildfrom
issue/2/build-linux-x86_64

Conversation

@mcevoypeter

@mcevoypeter mcevoypeter commented Oct 31, 2022

Copy link
Copy Markdown

Description

Resolves #2.

Testing

Ran the following commands on a ThinkPad (x86_64) running Arch Linux:

$ bazel build //...
$ bazel test //...
$ ln -s bazel-bin/pkg/vere/urbit urbit
$ ./urbit -F zod

See build.log for the output of the above commands.

@mcevoypeter mcevoypeter added feature New feature or feature request build Related to the build system labels Oct 31, 2022
@mcevoypeter mcevoypeter changed the base branch from master to issue/1/bazel-build November 8, 2022 17:48
@mcevoypeter mcevoypeter linked an issue Nov 8, 2022 that may be closed by this pull request
@mcevoypeter

Copy link
Copy Markdown
Author

After explicitly configuring the C/C++ toolchain in Bazel (instead of letting Bazel auto-detect existing toolchains), the commands are now:

$ bazel build //... --host_platform=//:gcc-linux_x86_64
$ bazel test //... --host_platform=//:gcc-linux-x86_64
$ ln -s bazel-bin/pkg/vere/urbit urbit
$ ./urbit -F zod

I also added support for clang:

$ bazel build //... --host_platform=//:clang-linux-x86_64
$ bazel test //... --host_platform=//:clang-linux-x86_64
$ ./urbit -F bus

@mcevoypeter mcevoypeter marked this pull request as ready for review November 8, 2022 18:03
@mcevoypeter mcevoypeter merged commit 0602873 into issue/1/bazel-build Nov 8, 2022
@mcevoypeter mcevoypeter deleted the issue/2/build-linux-x86_64 branch November 8, 2022 18:07
mcevoypeter added a commit that referenced this pull request Dec 15, 2022
Co-authored-by: Peter McEvoy <git@mcevoypeter.com>
@matthew-levan

Copy link
Copy Markdown
Contributor

When branching this runtime-specific repo off from the urbit monorepo, we initially based off of next/vere in the monorepo. However, during the course of fall 2022, buggy work ended up on next/vere. Because of this, the release branch for version 1.14 of the runtime branched off of master, not next/vere, leading to a non-trivial divergence between next/vere and master. To that end, we have to rewrite the history of this repo, which will potentially obfuscate the commit SHAs and diffs of the already merged PRs in this repo. To provide a trail of breadcrumbs, attached is a patch of the diff represented by this PR before history was rewritten.

PR10.patch

pkova added a commit that referenced this pull request May 26, 2025
Reverts #827

This PR causes an instant segfault in the serf after upgrading on
`~dinleb-rambep`, `~norsyr-torryn` and probably all pre-existing ships.
The segfault has the following stacktrace:

```
urbit 3.4-0969b6de10
boot: home is /root/dinleb-rambep
disk: loaded epoch 0i575532513
loom: mapped 2048MB
boot: protected loom
live: mapped: GB/1.945.878.528
live: loaded: KB/16.384
boot: installed 1362 jets
loom: image backup complete
disk: created epoch 575532513
loom: mapped 2048MB
lite: arvo formula 4ce68411
lite: core 641296f
lite: final state 641296f
disk: loaded epoch 0i575532513
loom: mapped 2048MB
boot: protected loom
live: mapped: GB/1.945.878.528
live: loaded: KB/16.384
boot: installed 1362 jets
vere: checking version compatibility
loom: external fault: 0 (0x200000000 : 0x280000000)

Breakpoint 1, u3m_fault (adr_v=0x0, ser_i=<optimized out>) at pkg/noun/manage.c:1967
1967	pkg/noun/manage.c: No such file or directory.
(gdb) bt
#0  u3m_fault (adr_v=0x0, ser_i=<optimized out>) at pkg/noun/manage.c:1967
#1  0x00000000014b9544 in sigsegv_handler (sig=<optimized out>, sip=<optimized out>, ucp=0x1840b40 <Sigstk+6896>) at /home/runner/.cache/zig/p/N-V-__8AAHQhHwCCMyKUtQhO0AMsY182In-wQIwXVhenOql5/src/handler-unix.c:269
#2  <signal handler called>
#3  _n_burn (pog_u=0x1ffffe121ffffe5a, bus=<optimized out>, mov=1 '\001', off=-1 '\377') at pkg/noun/nock.c:2100
#4  0x0000000001273653 in _n_burn_out (bus=1950065936, pog_u=0x1fffffff4) at pkg/noun/nock.c:2814
#5  _n_burn_on (bus=1950065936, bus@entry=3460980861, fol=<optimized out>) at pkg/noun/nock.c:2837
#6  u3n_nock_on (bus=1950065936, bus@entry=3460980861, fol=<optimized out>) at pkg/noun/nock.c:2851
#7  0x0000000001271938 in u3v_poke_raw (sam=50403342) at pkg/noun/vortex.c:293
#8  u3v_poke (ovo=ovo@entry=3459182210) at pkg/noun/vortex.c:285
#9  0x0000000001262948 in u3m_soft_top (mil_w=mil_w@entry=0, pad_w=pad_w@entry=1048576, fun_f=0x12718d0 <u3v_poke>, arg=3459182210) at pkg/noun/manage.c:1311
#10 0x00000000012630ad in u3m_soft (mil_w=4294967284, mil_w@entry=0, fun_f=0x1d0ee947, arg=1950064560) at pkg/noun/manage.c:1577
#11 0x000000000161888d in _serf_poke (sef_u=<optimized out>, cap_c=<optimized out>, mil_w=0, job=job@entry=3455400141) at pkg/vere/serf.c:556
#12 0x0000000001617804 in _serf_work (sef_u=0x183ec20 <u3V>, mil_w=0, job=3455400141) at pkg/vere/serf.c:604
#13 u3_serf_work (sef_u=sef_u@entry=0x183ec20 <u3V>, mil_w=mil_w@entry=0, job=3455400141) at pkg/vere/serf.c:692
#14 0x0000000001618666 in u3_serf_writ (sef_u=0x183ec20 <u3V>, wit=3462698097, pel=pel@entry=0x7fffffff9a0c) at pkg/vere/serf.c:1160
#15 0x000000000126141d in _cw_serf_writ (vod_p=<optimized out>, len_d=113, byt_y=0x7ffff7ff8780 "\001\377\356Mn\235\001\b") at pkg/vere/main.c:1079
#16 0x00000000014ddf08 in _newt_meat_poke (mot_u=0x183ed90 <inn_u>, met_u=0x7ffff7ff8770) at pkg/vere/newt.c:62
#17 _newt_meat_next_sync (mot_u=0x183ed90 <inn_u>) at pkg/vere/newt.c:75
#18 _newt_read_sync_cb (str_u=0x183ed90 <inn_u>, len_i=<optimized out>, buf_u=<optimized out>) at pkg/vere/newt.c:236
#19 0x00000000014ccfe7 in uv__read (stream=0x183ed90 <inn_u>) at /home/runner/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/stream.c:1148
#20 uv__stream_io (loop=<optimized out>, w=0x183ee18 <inn_u+136>, events=1) at /home/runner/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/stream.c:1208
#21 0x00000000014c6b94 in uv__io_poll (loop=loop@entry=0x1864148 <default_loop_struct>, timeout=-1) at /home/runner/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/linux.c:1565
#22 0x00000000014c31f1 in uv_run (loop=loop@entry=0x1864148 <default_loop_struct>, mode=mode@entry=UV_RUN_DEFAULT) at /home/runner/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/core.c:460
#23 0x000000000125e791 in _cw_serf_commence (argc=<optimized out>, argv=<optimized out>) at pkg/vere/main.c:1299
#24 _cw_utils (argc=argc@entry=11, argv=argv@entry=0x7fffffffdf08) at pkg/vere/main.c:3250
#25 0x000000000125c7d9 in main (argc=11, argv=0x7fffffffdf08) at pkg/vere/main.c:3275
```

@quodss @joemfb
pkova added a commit that referenced this pull request Jan 9, 2026
On develop, if a malformed scry URL is queried, we get a leak that ASAN
can detect. For example, after hitting F5 ten times at
`http://localhost:8080/_~_/=` and then pressing ctrl-D:

```
Direct leak of 240 byte(s) in 10 object(s) allocated from:
    #0 0x798dcccf6cbf in malloc (/usr/lib/clang/18/lib/linux/libclang_rt.asan-x86_64.so+0xf6cbf) (BuildId: 4cd39e6608b20f2f5a148a941cd434e0cadcd3dc)
    #1 0x1cd2706 in _http_req_dispatch /home/kirill/work/urbit-repos/vere/pkg/vere/io/http.c:983:29
    #2 0x1cd0dc6 in _http_rec_accept /home/kirill/work/urbit-repos/vere/pkg/vere/io/http.c:1676:7
    #3 0x1ce0378 in call_handlers /home/kirill/.cache/zig/p/N-V-__8AAJ2XqALM9jST2Gu4TIdjPNY2QB8rnmKeepeqr076/lib/core/request.c:155:13
    #4 0x1ea55ca in handle_incoming_request /home/kirill/.cache/zig/p/N-V-__8AAJ2XqALM9jST2Gu4TIdjPNY2QB8rnmKeepeqr076/lib/http1.c:470:13
    #5 0x1bdd68e in uv__read /home/kirill/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/stream.c:1148:7
    #6 0x1bdb3b7 in uv__stream_io /home/kirill/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/stream.c:1208:5
    #7 0x1bcfc3c in uv__io_poll /home/kirill/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/linux.c:1565:11
    #8 0x1bca927 in uv_run /home/kirill/.cache/zig/p/N-V-__8AAH34QwB6wi5eQK_lFbfDGSN3hRE8l-6Ep198ZsGg/src/unix/core.c:460:5
    #9 0x1bbe425 in u3_king_commence /home/kirill/work/urbit-repos/vere/pkg/vere/king.c:1061:3
    #10 0x1323f4e in main /home/kirill/work/urbit-repos/vere/pkg/vere/main.c:3320:5
    #11 0x798dcc829d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

This PR factors out scry-over-HTTP handling into a separate function
`_http_peek_dispatch` with semitransfer semantics for `req_u->peq_u` and
the contained noun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Related to the build system feature New feature or feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build with bazel on linux-x86_64

2 participants