Skip to content

--no-caps option can cause segmentation fault #9

Description

@mochrul

It wasn't easy to debug, but it seems, something changed and the size of gboolean is not equal to the size of gpointer.

And this cause that the following expression is bogus:
{ "caps", 'C', 0, G_OPTION_ARG_STRING, &process_opts.caps, "Set default capability set", "" },
{ "no-caps", 'N', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &process_opts.caps, "Disable managing Linux capabilities", NULL },

Because it only clear the half of the process_opts.caps variable in case --no-caps is set.

I do not know what changed (glib, gcc or something else) but currently it cause segmentation fault.

(gdb) p process_opts
$1 = {mode = Z_PM_FOREGROUND, argc = 8, argv = 0x7fffd1977da8, argv_start = 0x7fffd1978583 "/tmp/autopkgtest-virt-lxc.shared._3v453n5/downtmp/build.f7b/real-tree/zorp/.libs/zorp", argv_env_len = 2589,
use_fdlimit_settings = 1, fd_limit_threshold = -1, fd_limit_min = 1024, check_period = 60, check_fn = 0x55591f6fbe70 <zorp_deadlock_checker()>, restart_max = 5, restart_interval = 60, notify_interval = 600,
pid_removed = 0, name = 0x55592003c100 "zorp", user = 0x0, group = 0x0, chroot_dir = 0x0, pidfile = 0x7fffd1977c30 "zorp-zorp.pid", pidfile_dir = 0x55591f6fc622 "/var/run/zorp/",
cwd = 0x55591f6fc631 "/var/lib/zorp/cores", caps = 0x555900000000 <error: Cannot access memory at address 0x555900000000>,
argv_orig = 0x55592003ac50 "/tmp/autopkgtest-virt-lxc.shared._3v453n5/downtmp/build.f7b/real-tree/zorp/.libs/zorp", core = 0}
(gdb) x/40x &process_opts
0x7f2fb6c153c0 <_ZL12process_opts>: 0x00000000 0x00000008 0xd1977da8 0x00007fff
0x7f2fb6c153d0 <_ZL12process_opts+16>: 0xd1978583 0x00007fff 0x00000a1d 0x00000000
0x7f2fb6c153e0 <_ZL12process_opts+32>: 0x00000001 0xffffffff 0x00000400 0x0000003c
0x7f2fb6c153f0 <_ZL12process_opts+48>: 0x1f6fbe70 0x00005559 0x00000005 0x0000003c
0x7f2fb6c15400 <_ZL12process_opts+64>: 0x00000258 0x00000000 0x2003c100 0x00005559
0x7f2fb6c15410 <_ZL12process_opts+80>: 0x00000000 0x00000000 0x00000000 0x00000000
0x7f2fb6c15420 <_ZL12process_opts+96>: 0x00000000 0x00000000 0xd1977c30 0x00007fff
0x7f2fb6c15430 <_ZL12process_opts+112>: 0x1f6fc622 0x00005559 0x1f6fc631 0x00005559
0x7f2fb6c15440 <_ZL12process_opts+128>: 0x00000000 0x00005559 0x2003ac50 0x00005559
0x7f2fb6c15450 <_ZL12process_opts+144>: 0x00000000 0x00000000 0x00000001 0x00000000
(gdb) p sizeof(gboolean)
$2 = 4
(gdb) p sizeof(gint)
$3 = 4
(gdb) p sizeof(gpointer)
$4 = 8

This cause that all tests within tests/python in zorp fails.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions