Skip to content

Commit

Permalink
temp debug
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Jul 14, 2020
1 parent 526a862 commit 8f872aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libcontainer/nsenter/nsexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ enum sync_t {
#define STAGE_INIT 2

/* Stores the current stage of nsexec. */
int current_stage = STAGE_SETUP;
volatile int current_stage = STAGE_SETUP;

/* Assume the stack grows down, so arguments should be above it. */
struct clone_t {
/*
* Reserve some space for clone() to locate arguments
* and retcode in this place
*/
char stack[4096] __attribute__ ((aligned(16)));
char stack[4096*4] __attribute__ ((aligned(16)));
char stack_ptr[0];

/* There's two children. This is used to execute the different code. */
Expand Down Expand Up @@ -1030,6 +1030,8 @@ void nsexec(void)
*/
enum sync_t s;

write_log(DEBUG, "~> nsexec stage-2 0");

/* We're in a child and thus need to tell the parent if we die. */
syncfd = sync_grandchild_pipe[0];
close(sync_grandchild_pipe[1]);
Expand Down
2 changes: 2 additions & 0 deletions signals.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func (h *signalHandler) forward(process *libcontainer.Process, tty *tty, detach
return e.status, nil
}
}
case unix.SIGURG:
// ignore as it's used by golang runtime
default:
logrus.Debugf("sending signal to process %s", s)
if err := unix.Kill(pid1, s.(unix.Signal)); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/debug.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ load helpers
function setup() {
teardown_hello
setup_hello
export GODEBUG=asyncpreemptoff=1
}

function teardown() {
Expand Down Expand Up @@ -33,10 +34,12 @@ function teardown() {

# check expected debug output was sent to log.out
run cat log.out
echo "$output" >&2
[ "$status" -eq 0 ]
[[ "${output}" == *"level=debug"* ]]
[[ "${output}" == *"nsexec container setup"* ]]
[[ "${output}" == *"child process in init()"* ]]
#false
}

@test "global --debug to --log --log-format 'text'" {
Expand All @@ -54,6 +57,7 @@ function teardown() {
[[ "${output}" == *"level=debug"* ]]
[[ "${output}" == *"nsexec container setup"* ]]
[[ "${output}" == *"child process in init()"* ]]
#false
}

@test "global --debug to --log --log-format 'json'" {
Expand Down

0 comments on commit 8f872aa

Please sign in to comment.