Merge remote-tracking branch 'origin/master' into philip/agent-clay

This commit is contained in:
Philip Monk 2022-11-20 18:48:44 -07:00
commit 1dd993a103
14 changed files with 217 additions and 58 deletions

View File

@ -34,7 +34,7 @@ jobs:
call-vere:
uses: ./.github/workflows/vere.yml
with:
pace: 'often'
pace: 'edge' # XX s/b once?
upload: >-
${{
(github.ref_name == 'next/vere' && github.ref_type == 'branch')

View File

@ -12,11 +12,13 @@ on:
pace:
description: 'release pace'
type: string
default: 'often'
default: 'edge'
required: false
secrets:
CACHIX_AUTH_TOKEN:
required: false
GCP_CREDENTIALS:
required: false
GCS_SERVICE_ACCOUNT_KEY:
required: false
GCS_PROJECT:
@ -33,7 +35,7 @@ on:
description: 'release pace'
type: choice
options:
- often
- edge
- soon
- live
@ -48,8 +50,9 @@ jobs:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest }
- { os: macos-latest }
- { os: ubuntu-latest, type: linux }
- { os: macos-latest, type: macos }
- { os: buildjet-4vcpu-ubuntu-2204-arm, type: linux }
runs-on: ${{ matrix.os }}
@ -64,7 +67,7 @@ jobs:
with:
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
if: ${{ matrix.os == 'ubuntu-latest' }}
if: ${{ matrix.type == 'linux' }}
- uses: cachix/install-nix-action@v16
if: ${{ matrix.os != 'ubuntu-latest' }}
@ -73,6 +76,11 @@ jobs:
name: ares
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
# run unit tests early on linux (x-compilation will skip them)
- name: build dynamic binary (and run tests)
if: ${{ matrix.type == 'linux' }}
run: nix-build -A urbit
- name: build static binary
run: |
nix-build -A urbit \
@ -84,7 +92,7 @@ jobs:
cat ./urbit-derivation
- name: confirm binary is mostly static
if: matrix.os == 'macos-latest'
if: matrix.type == 'macos'
run: |
bin="${{ env.urbit_static }}/bin/urbit"
@ -117,19 +125,20 @@ jobs:
echo -n "$version" > ./version-string
- name: upload version string artifact
if: matrix.os == 'ubuntu-latest'
if: matrix.type == 'linux'
uses: actions/upload-artifact@v3
with:
name: version-string
path: version-string
- uses: google-github-actions/setup-gcloud@v0.2.0
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- uses: google-github-actions/setup-gcloud@v1
if: inputs.upload
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.GCS_PROJECT }}
export_default_credentials: true
- name: upload binary to bootstrap.urbit.org
if: inputs.upload
@ -174,6 +183,7 @@ jobs:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: mingw32-make build/urbit
- run: mingw32-make test
- run: >
build/urbit -l -d -B ../../bin/solid.pill -F bus &&
curl -f --data '{"source":{"dojo":"+hood/exit"},"sink":{"app":"hood"}}'

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:65f2c81d703b83dd6f48f98c071948b41734c5004bbdbddab7e13f8b782b03e2
size 5703567
oid sha256:40bc203b8a2d2ebad81723da6fc946ee32d2f8a204884f50f9710177ae257d08
size 5712264

View File

@ -57,7 +57,10 @@ let
if system == "x86_64-linux" && crossSystem == null && enableStatic then
"x86_64-unknown-linux-musl"
else
crossSystem;
if system == "aarch64-linux" && crossSystem == null && enableStatic then
"aarch64-unknown-linux-musl"
else
crossSystem;
};
# Use nixpkgs' top-level/static overlay if enableStatic = true.

View File

@ -25,6 +25,7 @@ let
(import ./overlays/native.nix)
# Specific overrides guarded by the host platform.
(import ./overlays/musl.nix)
(import ./overlays/arm.nix)
];
};

View File

@ -3,10 +3,11 @@ final: prev:
let
isAarch64 = prev.stdenv.hostPlatform.isAarch64;
isDarwin = prev.stdenv.isDarwin;
in prev.lib.optionalAttrs isAarch64 {
in prev.lib.optionalAttrs (isAarch64 && !isDarwin) {
libsigsegv = prev.libsigsegv.overrideAttrs (attrs: {
preConfigure = (old.preConfigure or "") + ''
preConfigure = (prev.preConfigure or "") + ''
sed -i 's/^CFG_FAULT=$/CFG_FAULT=fault-linux-arm.h/' configure
'';
});

View File

@ -113,8 +113,7 @@
# if defined(U3_OS_linux)
# ifdef __LP64__
# ifdef U3_CPU_aarch64
// XX not yet
//# define U3_OS_ARCH "aarch64-linux"
# define U3_OS_ARCH "aarch64-linux"
# else
# define U3_OS_ARCH "x86_64-linux"
# endif

View File

@ -84,9 +84,14 @@
void
u3e_foul(void);
/* u3e_init(): initialize page tracking.
/* u3e_init(): initialize guard page tracking.
*/
void
u3e_init(void);
/* u3e_ward(): reposition guard page if needed.
*/
void
u3e_ward(u3_post low_p, u3_post hig_p);
#endif /* ifndef U3_EVENTS_H */

View File

@ -226,8 +226,9 @@ _ce_center_guard_page(void)
if ( -1 == mprotect(u3a_into(gar_pag_p), pag_siz_i, PROT_NONE) ) {
fprintf(stderr,
"loom: failed to protect the guard page "
"(base address %p)\r\n",
u3a_into(gar_pag_p));
"(base address %p): %s\r\n",
u3a_into(gar_pag_p),
strerror(errno));
goto fail;
}
@ -353,10 +354,17 @@ _ce_image_open(u3e_image* img_u)
static void
_ce_patch_write_control(u3_ce_patch* pat_u)
{
c3_w len_w = sizeof(u3e_control) +
(pat_u->con_u->pgs_w * sizeof(u3e_line));
ssize_t ret_i;
c3_w len_w = sizeof(u3e_control) +
(pat_u->con_u->pgs_w * sizeof(u3e_line));
if ( len_w != write(pat_u->ctl_i, pat_u->con_u, len_w) ) {
if ( len_w != (ret_i = write(pat_u->ctl_i, pat_u->con_u, len_w)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: patch ctl partial write: %zu\r\n", (size_t)ret_i);
}
else {
fprintf(stderr, "loom: patch ctl write: %s\r\n", strerror(errno));
}
c3_assert(0);
}
}
@ -424,11 +432,17 @@ _ce_patch_delete(void)
{
c3_c ful_c[8193];
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.dir_c);
c3_unlink(ful_c);
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.dir_c);
if ( unlink(ful_c) ) {
fprintf(stderr, "loom: failed to delete control.bin: %s\r\n",
strerror(errno));
}
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.dir_c);
c3_unlink(ful_c);
if ( unlink(ful_c) ) {
fprintf(stderr, "loom: failed to remove memory.bin: %s\r\n",
strerror(errno));
}
}
/* _ce_patch_verify(): check patch data mug.
@ -436,7 +450,8 @@ _ce_patch_delete(void)
static c3_o
_ce_patch_verify(u3_ce_patch* pat_u)
{
c3_w i_w;
ssize_t ret_i;
c3_w i_w;
if ( u3e_version != pat_u->con_u->ver_y ) {
fprintf(stderr, "loom: patch version mismatch: have %u, need %u\r\n",
@ -454,8 +469,13 @@ _ce_patch_verify(u3_ce_patch* pat_u)
fprintf(stderr, "loom: patch seek: %s\r\n", strerror(errno));
return c3n;
}
if ( -1 == read(pat_u->mem_i, mem_w, pag_siz_i) ) {
fprintf(stderr, "loom: patch read: %s\r\n", strerror(errno));
if ( pag_siz_i != (ret_i = read(pat_u->mem_i, mem_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: patch partial read: %zu\r\n", (size_t)ret_i);
}
else {
fprintf(stderr, "loom: patch read fail: %s\r\n", strerror(errno));
}
return c3n;
}
{
@ -542,8 +562,23 @@ _ce_patch_write_page(u3_ce_patch* pat_u,
c3_w pgc_w,
c3_w* mem_w)
{
c3_assert(-1 != lseek(pat_u->mem_i, pgc_w * pag_siz_i, SEEK_SET));
c3_assert(pag_siz_i == write(pat_u->mem_i, mem_w, pag_siz_i));
ssize_t ret_i;
if ( -1 == lseek(pat_u->mem_i, pgc_w * pag_siz_i, SEEK_SET) ) {
fprintf(stderr, "loom: patch page seek: %s\r\n", strerror(errno));
c3_assert(0);
}
if ( pag_siz_i != (ret_i = write(pat_u->mem_i, mem_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: patch page partial write: %zu\r\n",
(size_t)ret_i);
}
else {
fprintf(stderr, "loom: patch page write: %s\r\n", strerror(errno));
}
c3_assert(0);
}
}
/* _ce_patch_count_page(): count a page, producing new counter.
@ -586,6 +621,7 @@ _ce_patch_save_page(u3_ce_patch* pat_u,
pag_siz_i,
PROT_READ) )
{
fprintf(stderr, "loom: patch mprotect: %s\r\n", strerror(errno));
c3_assert(0);
}
@ -613,6 +649,9 @@ _ce_patch_compose(void)
nor_w = (nwr_w + (pag_wiz_i - 1)) >> u3a_page;
sou_w = (swu_w + (pag_wiz_i - 1)) >> u3a_page;
c3_assert( ((gar_pag_p >> u3a_page) >= nor_w)
&& ((gar_pag_p >> u3a_page) <= (u3a_pages - (sou_w + 1))) );
}
#ifdef U3_SNAPSHOT_VALIDATION
@ -714,7 +753,8 @@ _ce_image_resize(u3e_image* img_u, c3_w pgs_w)
static void
_ce_patch_apply(u3_ce_patch* pat_u)
{
c3_w i_w;
ssize_t ret_i;
c3_w i_w;
// resize images
//
@ -748,8 +788,14 @@ _ce_patch_apply(u3_ce_patch* pat_u)
off_w = (u3a_pages - (pag_w + 1));
}
if ( -1 == read(pat_u->mem_i, mem_w, pag_siz_i) ) {
fprintf(stderr, "loom: patch apply read: %s\r\n", strerror(errno));
if ( pag_siz_i != (ret_i = read(pat_u->mem_i, mem_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: patch apply partial read: %zu\r\n",
(size_t)ret_i);
}
else {
fprintf(stderr, "loom: patch apply read: %s\r\n", strerror(errno));
}
c3_assert(0);
}
else {
@ -757,8 +803,14 @@ _ce_patch_apply(u3_ce_patch* pat_u)
fprintf(stderr, "loom: patch apply seek: %s\r\n", strerror(errno));
c3_assert(0);
}
if ( -1 == write(fid_i, mem_w, pag_siz_i) ) {
fprintf(stderr, "loom: patch apply write: %s\r\n", strerror(errno));
if ( pag_siz_i != (ret_i = write(fid_i, mem_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: patch apply partial write: %zu\r\n",
(size_t)ret_i);
}
else {
fprintf(stderr, "loom: patch apply write: %s\r\n", strerror(errno));
}
c3_assert(0);
}
}
@ -779,13 +831,24 @@ _ce_image_blit(u3e_image* img_u,
return;
}
c3_w i_w;
c3_w siz_w = pag_siz_i;
ssize_t ret_i;
c3_w i_w;
c3_w siz_w = pag_siz_i;
if ( -1 == lseek(img_u->fid_i, 0, SEEK_SET) ) {
fprintf(stderr, "loom: image blit seek 0: %s\r\n", strerror(errno));
c3_assert(0);
}
lseek(img_u->fid_i, 0, SEEK_SET);
for ( i_w = 0; i_w < img_u->pgs_w; i_w++ ) {
if ( -1 == read(img_u->fid_i, ptr_w, siz_w) ) {
fprintf(stderr, "loom: image blit read: %s\r\n", strerror(errno));
if ( siz_w != (ret_i = read(img_u->fid_i, ptr_w, siz_w)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: image blit partial read: %zu\r\n",
(size_t)ret_i);
}
else {
fprintf(stderr, "loom: image blit read: %s\r\n", strerror(errno));
}
c3_assert(0);
}
@ -811,15 +874,25 @@ _ce_image_fine(u3e_image* img_u,
c3_w* ptr_w,
c3_ws stp_ws)
{
c3_w i_w;
c3_w buf_w[pag_wiz_i];
ssize_t ret_i;
c3_w i_w;
c3_w buf_w[pag_wiz_i];
if ( -1 == lseek(img_u->fid_i, 0, SEEK_SET) ) {
fprintf(stderr, "loom: image fine seek 0: %s\r\n", strerror(errno));
c3_assert(0);
}
lseek(img_u->fid_i, 0, SEEK_SET);
for ( i_w=0; i_w < img_u->pgs_w; i_w++ ) {
c3_w mem_w, fil_w;
if ( -1 == read(img_u->fid_i, buf_w, pag_siz_i) ) {
fprintf(stderr, "loom: image fine read: %s\r\n", strerror(errno));
if ( pag_siz_i != (ret_i = read(img_u->fid_i, buf_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: image fine partial read: %zu\r\n", (size_t)ret_i);
}
else {
fprintf(stderr, "loom: image fine read: %s\r\n", strerror(errno));
}
c3_assert(0);
}
mem_w = u3r_mug_words(ptr_w, pag_wiz_i);
@ -845,7 +918,8 @@ _ce_image_fine(u3e_image* img_u,
static c3_o
_ce_image_copy(u3e_image* fom_u, u3e_image* tou_u)
{
c3_w i_w;
ssize_t ret_i;
c3_w i_w;
// resize images
//
@ -866,8 +940,14 @@ _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u)
c3_w mem_w[pag_wiz_i];
c3_w off_w = i_w;
if ( -1 == read(fom_u->fid_i, mem_w, pag_siz_i) ) {
fprintf(stderr, "loom: image copy read: %s\r\n", strerror(errno));
if ( pag_siz_i != (ret_i = read(fom_u->fid_i, mem_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: image copy partial read: %zu\r\n",
(size_t)ret_i);
}
else {
fprintf(stderr, "loom: image copy read: %s\r\n", strerror(errno));
}
return c3n;
}
else {
@ -875,8 +955,14 @@ _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u)
fprintf(stderr, "loom: image copy seek: %s\r\n", strerror(errno));
return c3n;
}
if ( -1 == write(tou_u->fid_i, mem_w, pag_siz_i) ) {
fprintf(stderr, "loom: image copy write: %s\r\n", strerror(errno));
if ( pag_siz_i != (ret_i = write(tou_u->fid_i, mem_w, pag_siz_i)) ) {
if ( 0 < ret_i ) {
fprintf(stderr, "loom: image copy partial write: %zu\r\n",
(size_t)ret_i);
}
else {
fprintf(stderr, "loom: image copy write: %s\r\n", strerror(errno));
}
return c3n;
}
}
@ -1006,7 +1092,15 @@ u3e_live(c3_o nuu_o, c3_c* dir_c)
{
// require that our page size is a multiple of the system page size.
//
c3_assert(0 == (1 << (2 + u3a_page)) % sysconf(_SC_PAGESIZE));
{
size_t sys_i = sysconf(_SC_PAGESIZE);
if ( pag_siz_i % sys_i ) {
fprintf(stderr, "loom: incompatible system page size (%zuKB)\r\n",
sys_i >> 10);
exit(1);
}
}
u3P.dir_c = dir_c;
u3P.nor_u.nam_c = "north";
@ -1041,6 +1135,13 @@ u3e_live(c3_o nuu_o, c3_c* dir_c)
_ce_patch_delete();
}
// detect snapshots from a larger loom
//
if ( (u3P.nor_u.pgs_w + u3P.sou_u.pgs_w + 1) >= u3a_pages ) {
fprintf(stderr, "boot: snapshot too big for loom\r\n");
exit(1);
}
// mark all pages dirty (pages in the snapshot will be marked clean)
//
u3e_foul();
@ -1083,9 +1184,18 @@ u3e_yolo(void)
// NB: u3e_save() will reinstate protection flags
//
if ( 0 != mprotect((void *)u3_Loom, u3a_bytes, (PROT_READ | PROT_WRITE)) ) {
// XX confirm recoverable errors
//
fprintf(stderr, "loom: yolo: %s\r\n", strerror(errno));
return c3n;
}
if ( 0 != mprotect(u3a_into(gar_pag_p), pag_siz_i, PROT_NONE) ) {
fprintf(stderr, "loom: failed to protect guard page: %s\r\n",
strerror(errno));
c3_assert(0);
}
return c3y;
}
@ -1097,6 +1207,8 @@ u3e_foul(void)
memset((void*)u3P.dit_w, 0xff, sizeof(u3P.dit_w));
}
/* u3e_init(): initialize guard page tracking.
*/
void
u3e_init(void)
{
@ -1104,3 +1216,15 @@ u3e_init(void)
_ce_center_guard_page();
#endif
}
/* u3e_ward(): reposition guard page if needed.
*/
void
u3e_ward(u3_post low_p, u3_post hig_p)
{
#ifdef U3_GUARD_PAGE
if ( (low_p > gar_pag_p) || (hig_p < gar_pag_p) ) {
_ce_center_guard_page();
}
#endif
}

View File

@ -590,6 +590,11 @@ _find_home(void)
u3H = (void *)((mem_w + len_w) - siz_w);
u3R = &u3H->rod_u;
// this looks risky, but there are no legitimate scenarios
// where it's wrong
//
u3R->cap_p = u3R->mat_p = u3a_words - c3_wiseof(*u3H);
}
/* u3m_pave(): instantiate or activate image.
@ -803,6 +808,7 @@ u3m_leap(c3_w pad_w)
u3R->cap_p -= len_w;
rod_u = _pave_south(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
u3e_ward(rod_u->cap_p, rod_u->hat_p);
#if 0
fprintf(stderr, "leap: from north %p (cap 0x%x), to south %p\r\n",
u3R,
@ -815,6 +821,7 @@ u3m_leap(c3_w pad_w)
u3R->cap_p += len_w;
rod_u = _pave_north(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
u3e_ward(rod_u->hat_p, rod_u->cap_p);
#if 0
fprintf(stderr, "leap: from south %p (cap 0x%x), to north %p\r\n",
u3R,
@ -1856,6 +1863,10 @@ u3m_boot_lite(void)
*/
u3m_pave(c3y);
/* Place the guard page.
*/
u3e_init();
/* Initialize the jet system.
*/
u3j_boot(c3y);

View File

@ -8,6 +8,7 @@ _setup(void)
{
u3m_init();
u3m_pave(c3y);
u3e_init();
}
static void

View File

@ -577,7 +577,7 @@ _boothack_doom(void)
if ( u3_nul == whu ) {
u3l_log("boot: malformed -F ship %s\r\n", u3_Host.ops_u.fak_c);
exit(1);
u3_king_bail();
}
bot = u3nc(c3__fake, u3k(u3t(whu)));

View File

@ -492,8 +492,12 @@ _pier_on_scry_done(void* ptr_v, u3_noun nun)
{
u3_atom puf = u3i_string(u3_Host.ops_u.puf_c);
if ( c3y == u3r_sing(c3__jam, puf) ) {
out = u3qe_jam(res);
c3_d len_d;
c3_y* byt_y;
u3s_jam_xeno(res, &len_d, &byt_y);
out = u3i_bytes(len_d, byt_y);
ext_c = "jam";
free(byt_y);
}
else if ( c3y == u3a_is_atom(res) ) {
out = u3dc("scot", u3k(puf), u3k(res));
@ -670,7 +674,7 @@ _pier_wyrd_fail(u3_pier* pir_u, u3_ovum* egg_u, u3_noun lud)
//
#define VERE_NAME "vere"
#define VERE_ZUSE 417
#define VERE_LULL 329
#define VERE_LULL 328
/* _pier_wyrd_aver(): check for %wend effect and version downgrade. RETAIN
*/

View File

@ -1 +1 @@
1.10
1.12