getresuid and getresgid in sb-posix are borked. Always causes memory fault
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
getresuid and getresgid function in the sb-contrib modules are incorrectly defined.
They are meant to be:
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
but sb-contrib things they are:
uid_t getresuid(void)
git_d getresgid(void)
This results in a Memory fault error...
One may be able to continue, but the system has probably trashed stuff that was pointed to on the stack... :/
How to verify:
(require :sb-posix)
(sb-posix:
OR
(require :sb-posix)
(sb-posix:
Tested on both latest stable 1.3.7 and on git master.
Just to meet guidelines here is my info:
Linux kieran-desktop 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
*features*:
(:64-BIT :64-BIT-REGISTERS :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS
:C-STACK-
:COMPLEX-
:FP-AND-
:INTEGER-EQL-VOP :LARGEFILE :LINKAGE-TABLE :LINUX :LITTLE-ENDIAN
:MEMORY-
:OS-PROVIDES-
:OS-PROVIDES-POLL :OS-PROVIDES-PUTWC :OS-PROVIDES-
:PACKAGE-
:SB-AFTER-XC-CORE :SB-CORE-
:SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-
:SB-UNICODE :SB-XREF-
:STACK-
:STACK-
:UNIX :UNWIND-
I'll attach a patch. To use the getresuid and getresgid with this patch use must use the likes of with-alien like so:
(require :sb-posix)
(with-alien ((ruid sb-posix::uid-t) (euid sb-posix::uid-t) (suid sb-posix::uid-t))
(sb-posix:getresuid (addr ruid) (addr euid) (addr suid))
(values ruid euid suid))
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
returns 0 without a crash on sbcl-1. 2.4.debian- linux-x64
but it crashes 1.3.4.104. hu.dwim. 4-a36628d (x64)