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

setting debug_level to trace crashes your RIOT #231

Open
mfrey opened this issue Apr 25, 2018 · 3 comments
Open

setting debug_level to trace crashes your RIOT #231

mfrey opened this issue Apr 25, 2018 · 3 comments
Labels

Comments

@mfrey
Copy link
Collaborator

mfrey commented Apr 25, 2018

Hi,

I probably should find a job where the main task is to break things. Anyway, enabling logging by setting debug_level to TRACE crashes RIOT. I'm using RIOTs ccn-lite-relay example and simply added a line which enables the log messages. While this seem to be a silly endeavour, it should work. Right? I'm trying to get more details, but my tmux session was flooded with "ISR stack overflowed by at least 16 bytes." at some point.

Originally, I wanted to understand why the RIOT example works using tapsetup, but fails every time in a single hop scenario in our testbed. The following looks "suspicious"

image

At some point the stdout seems to be redirect to stdin (?) which is something I noticed before in other cases using RIOTs pyterm.

Can somebody confirm this behaviour?

TIA
Michael

@mfrey
Copy link
Collaborator Author

mfrey commented May 3, 2018

The issue is triggered by

236     DEBUGMSG_CFWD(INFO, "  incoming interest=<%s>%s nonce=%"PRIi32" from=%s\n",
237                   ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
238                   ccnl_suite2str((*pkt)->suite), nonce,
239                   ccnl_addr2ascii(from ? &from->peer : NULL));

in file ccnl_fwd.c.

@mfrey
Copy link
Collaborator Author

mfrey commented May 4, 2018

The problem is quite simple. RIOT maps the logging macros to "printf" (see ./core/include/log.h in RIOT and ccnl-riot-logging.h in ccn-lite). Passing NULL to %s in printf is undefined behaviour and this is apparently messing up the output of the shell.

I'll open a dedicated issue for the printf/logging problem.

@mfrey
Copy link
Collaborator Author

mfrey commented May 4, 2018

The function ccnl_addr2ascii is called with a loopback face, i.e.

122 static struct ccnl_face_s *loopback_face;

which was initialised as a local face

467 loopback_face = ccnl_get_face_or_create(&ccnl_relay, -1, NULL, 0);

Hence, the call of

239                   ccnl_addr2ascii(from ? &from->peer : NULL));

is

239                   ccnl_addr2ascii(0);

since sock->peer is 0 and since it is none of the socket types in the switch statement (AF_*) it returns NULL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant