[Bug 276809] SEGFAULTs using libjail
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276809] SEGFAULTs using libjail"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 03 Feb 2024 17:53:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276809 Bug ID: 276809 Summary: SEGFAULTs using libjail Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: freebsd-bugs@aliases.systohc.net I'm constantly getting SEGFAULTs using libjail from C as well as from Python. Is it my fault or am I triggering a bug? === listjailparams.c === #include <stdio.h> #include <jail.h> int main(int argc, char *argv[]) { struct jailparam *params; int nparams = jailparam_all(¶ms); printf("number of params: %d\n", nparams); for (int i=0; i<nparams; i++) { printf("jailparam: %s\n", jailparam_export(¶ms[i])); } jailparam_free(params, nparams); return 0; } === listjailparams.c === === listjailparams.py === #!/usr/local/bin/python3 from ctypes import Structure, c_char_p, CDLL, POINTER, c_int, byref class JailParam(Structure): _fields_ = [ ("name", c_char_p), ("value", c_char_p), ] JailParam_PTR = POINTER(JailParam) lib = CDLL("libjail.so") jailparam_all = lib.jailparam_all jailparam_all.argtypes = [POINTER(JailParam_PTR)] jailparam_all.restype = c_int jailparam_free = lib.jailparam_free jailparam_free.argtypes = [JailParam_PTR, c_int] params = JailParam_PTR() nparams = jailparam_all(byref(params)) print(f'nparams: {nparams}') for i in range(nparams): param = params[i] name = param.name.decode('utf-8') value = param.value if param.value is None else param.value.decode('utf-8') print(f'Name: {name}, Value: {value}') jailparam_free(params, nparams) === listjailparams.py === -- You are receiving this mail because: You are the assignee for the bug.