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

software hang at printk with "CONFIG_STACK_CANARIES=y" #1603

Closed
zephyrbot opened this issue Feb 10, 2016 · 6 comments
Closed

software hang at printk with "CONFIG_STACK_CANARIES=y" #1603

zephyrbot opened this issue Feb 10, 2016 · 6 comments
Assignees
Labels
area: Kernel bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Milestone

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Feb 10, 2016

Reported by Javier B Perez:

Configuration

x86
arduino_101
micro

Bug detailed description

Run sample test code "zephyr/tests/kernel/test_stackprot/microkernel" @Arduino_101 board, software hang at printk.
NOTE1: If disable "CONFIG_STACK_CANARIES=y", issue is not observed.
NOTE2: The issue is not observed with qemu_x86, even with "CONFIG_STACK_CANARIES=y"

Testcase to Reproduce

sample test code "zephyr/tests/kernel/test_stackprot/microkernel"

Steps to Reproduce

  1. cd zephyr
  2. source zephyr-env.sh
  3. cd tests/kernel/test_stackprot/microkernel
  4. make pristine;make BOARD=arduino_101 flash
  5. verify from UART output nothing.
(gdb) b RegressionTask 
Breakpoint 1 at 0x400332af: file /home/sharron/workspace/views/iot/forto-collab/samples/microkernel/test/test_stackprot/src/stackprot.c, line 145. 
(gdb) c 
Continuing. 
target running 
target is still running! 
hit hardware breakpoint (hwreg=0) at 0x400332af 

Breakpoint 1, RegressionTask () 
at /home/sharron/workspace/views/iot/forto-collab/samples/microkernel/test/test_stackprot/src/stackprot.c:145 
145 { 
(gdb) c 

software hang here. Press ctrl+c to stop, and check from gdb:

^C 
Program received signal SIGINT, Interrupt. 
_vprintk (ap=0xa800a000 <__REGRESSIONTASK_stack+2024> "\353\067\003@\020\240", 
fmt=0x40033816 "%s\n") 
at /home/sharron/workspace/views/iot/forto-collab/misc/printk.c:79 
79 while (*fmt) { 
(gdb) l 
74 { 
75 int might_format = 0; /* 1 if encountered a '%' */ 
76 
77 /* fmt has already been adjusted if needed */ 
78 
79 while (*fmt) { 
80 if (!might_format) { 
81 if (*fmt != '%') { 
82 _char_out((int)*fmt); 
83 } else { 
(gdb) p *fmt 
$1 = 37 '%' 
(gdb) bt 
Python Exception <type 'exceptions.ImportError'> No module named gdb.frames: 
<span>#</span>0 _vprintk ( 
ap=0xa800a000 <__REGRESSIONTASK_stack+2024> "\353\067\003@\020\240", 
fmt=0x40033816 "%s\n") 
at /home/sharron/workspace/views/iot/forto-collab/misc/printk.c:79 
<span>#</span>1 printk (fmt=0x0) 
at /home/sharron/workspace/views/iot/forto-collab/misc/printk.c:165 
<span>#</span>2 0x400332af in AlternateTask () 
at /home/sharron/workspace/views/iot/forto-collab/samples/microkernel/test/test_stackprot/src/stackprot.c:126 
<span>#</span>3 0xa800a004 in __REGRESSIONTASK_stack () 
<span>#</span>4 0x400332c1 in RegressionTask () 
at /home/sharron/workspace/views/iot/forto-collab/samples/microkernel/test/test_stackprot/src/stackprot.c:146 
<span>#</span>5 0x400337eb in ?? () 
Backtrace stopped: previous frame inner to this frame (corrupt stack?) 
(gdb) 

Expected Result

UART output:
PROJECT EXECUTION SUCCESSFUL

Actual Result

UART output nothing, software hang at printk.

User Impact

When app call printk with stack protection enabled, software hang.

(Imported from Jira ZEP-3)

@zephyrbot
Copy link
Collaborator Author

by Sharron LIU:

Still observe this with v1.1.0 build + SDK v0.7.2

@zephyrbot
Copy link
Collaborator Author

by Hirally Santiago:

Anas Nashif suggested I assign this task to you.

@zephyrbot
Copy link
Collaborator Author

by Anas Nashif:

This is IAMCU related and Andrew Boie is the most experienced with this ABI

@zephyrbot
Copy link
Collaborator Author

by Andrew Boie:

Per Hirally this bug affects some of our deliverables and needs to be fixed or mitigated by WW16. Raising priority.

@zephyrbot
Copy link
Collaborator Author

by Andrew Boie:

https://gerrit.zephyrproject.org/r/#/c/798/

@zephyrbot
Copy link
Collaborator Author

by changru fan:

Test with build zephyr-kernel-1.1.0-160311-f9d1d56, issue was fixed.
tests.microkernel.stackprot.test_functional_stackprot.testcase can pass now.

@zephyrbot zephyrbot added priority: high High impact/importance bug area: Kernel bug The issue is a bug, or the PR is fixing a bug labels Sep 23, 2017
@zephyrbot zephyrbot added this to the v1.2.0 milestone Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants