Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mochrul opened this issue Dec 2, 2016 · 0 comments
Open

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

mochrul opened this issue Dec 2, 2016 · 0 comments

Comments

@mochrul
Copy link

mochrul commented Dec 2, 2016

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.

@mochrul mochrul changed the title --no-caps option cause segmentation fault --no-caps option can cause segmentation fault Dec 3, 2016
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

No branches or pull requests

1 participant