Skip to content

vms-1fc: widen the libvmssys raw-syscall path to 64-bit (LLP64 /dev/vms ioctl pointer fix) - #1064

Merged
baron-3dl merged 1 commit into
mainfrom
work/vms-1fc-alpha-syscall-width
Sep 7, 2026
Merged

vms-1fc: widen the libvmssys raw-syscall path to 64-bit (LLP64 /dev/vms ioctl pointer fix)#1064
baron-3dl merged 1 commit into
mainfrom
work/vms-1fc-alpha-syscall-width

Conversation

@baron-3dl

Copy link
Copy Markdown
Contributor

On the alpha-dec-vms C model long/unsigned long are 32 bits while pointers are 64 (LLP64), so the libvmssys raw-syscall path truncated every pointer passed to the /dev/vms transport — the request-block pointer to ioctl(/dev/vms, …, &kif_request) lost its high half and the executive's copy_from_user read a garbage address. A real bug on the alpha VMS-native backend (LIBVMSSYS$SHR → the kif transport → LIBVMSRMS$SHR), latent until a runtime path actually drove an RMS-over-ACP call.

The fix — one guaranteed-64-bit register word

  • vms_syscall.h: __vms_syscall0..6 params + return, every vms_sys_* pointer cast, and vms_sys_ioctl's arg param (unsigned longvms_reg_t), all widened to vms_reg_t (== long long).
  • arch/alpha/syscall_vms.c: the EVAX callsys trampolines match (long long).
  • kif_transport_linux.c: cast the request-block pointer through vms_reg_t, not unsigned long — THIS is the /dev/vms pointer that was truncating.
  • vms_bgsock.c: widen its ioctl pointer casts to match.

3-way safe / non-regressing

  • x86_64 / aarch64 / alpha-linux-gnu are LP64: long long == long in width and ABI, so the codegen is byte-identical — a strict no-op there.
  • The actual fix is only on the alpha-dec-vms cc1 (LLP64).
  • VAX untouched by construction: it takes the __NetBSD__ branch (arch/vax/vms_syscall_netbsd.h) and compiles none of these declarations.

Proven

Compiles clean on x86_64 (-Wall -Wextra); vms_reg_t is 64-bit; the alpha-dec-vms cross build links zero-deferred with it (LIBVMSRMS$SHR + the producer graph + the veneer image). Honest scope: this is build/link/activation-proven and non-regressing across alpha / VAX / x86_64. Its runtime purpose — 64-bit /dev/vms ioctl pointers actually flowing to the ACP — gets its final exercise when the CRTL→RMS veneer image runs on the executive (rung 4, vms-f49, tracked separately in #1063).

🤖 Generated with Claude Code

…pointer fix)

On the alpha-dec-vms C model `long`/`unsigned long` are 32 bits while pointers
are 64 (LLP64), so the libvmssys raw-syscall path TRUNCATED every pointer passed
to the /dev/vms transport: the request-block pointer to ioctl(/dev/vms, ...) lost
its high half and the executive's copy_from_user read a garbage address. This is
a real bug on the alpha VMS-native backend (LIBVMSSYS$SHR / the kif transport /
LIBVMSRMS$SHR), latent until a runtime path actually drove an RMS-over-ACP call.

Widen the whole raw-syscall path to a guaranteed-64-bit `vms_reg_t` (== long long):
 - vms_syscall.h: __vms_syscall0..6 params + return; every vms_sys_* pointer
   cast; and vms_sys_ioctl's `arg` param (unsigned long -> vms_reg_t).
 - arch/alpha/syscall_vms.c: the EVAX callsys trampolines match (long long).
 - kif_transport_linux.c: cast the request-block pointer through vms_reg_t, not
   `unsigned long` -- THIS is the /dev/vms pointer that was truncating.
 - vms_bgsock.c: widen its ioctl pointer casts to match.

3-way safe / non-regressing:
 - x86_64 / aarch64 / alpha-linux-gnu are LP64: `long long` == `long` in width
   and ABI, so the codegen is byte-identical -- a strict no-op there.
 - The actual fix is only on the alpha-dec-vms cc1 (LLP64).
 - VAX is untouched by construction: it takes the __NetBSD__ branch
   (arch/vax/vms_syscall_netbsd.h) and compiles NONE of these declarations.

Proven here: compiles clean on x86_64 (-Wall -Wextra), vms_reg_t is 64-bit, and
the alpha-dec-vms cross build links zero-deferred with it (LIBVMSRMS$SHR + the
producer graph + the veneer image). Its runtime purpose -- 64-bit /dev/vms ioctl
pointers actually flowing to the ACP -- gets its final exercise when the CRTL->RMS
veneer image runs on the executive (rung 4, vms-f49, tracked separately).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJZf62TMXxvy6fXzFQYfLQ
@baron-3dl
baron-3dl merged commit 0ece2a9 into main Sep 7, 2026
106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant