Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Yash Shinde" <Yash.Shinde@windriver.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] qemuriscv: Enable Sv39 memory address scheme by default
Date: Tue, 28 Jan 2025 02:28:20 -0800	[thread overview]
Message-ID: <29362.1738060100000717567@lists.openembedded.org> (raw)
In-Reply-To: <20250128101633.3664659-1-Yash.Shinde@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 2735 bytes --]

Tested Asan test as follows with command "runqemu nographic"
(with IMAGE_INSTALL:append = " libasan  libasan-dev"):

root@qemuriscv64:~# gcc -g -fsanitize=address -o asan_test asan_test.c

root@qemuriscv64:~# ./asan_test

Running AddressSanitizer test...

=================================================================

==262==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x003f9380002a at pc 0x002add509b88 bp 0x003ff6510ec0 sp 0x003ff6510e90

WRITE of size 1 at 0x003f9380002a thread T0

#0 0x2add509b86 in cause_buffer_overflow /home/root/a.c:9

#1 0x2add509ca2 in main /home/root/a.c:16

#2 0x3f95a917b4 (/lib/libc.so.6+0x277b4) (BuildId: 89440b2a8f8e9f78366a816e4685a39d6a4de4c5)

#3 0x3f95a9185c in __libc_start_main (/lib/libc.so.6+0x2785c) (BuildId: 89440b2a8f8e9f78366a816e4685a39d6a4de4c5)

#4 0x2add509a1e in _start ../sysdeps/riscv/start.S:67

Address 0x003f9380002a is located in stack of thread T0 at offset 42 in frame

#0 0x2add509ac4 in cause_buffer_overflow /home/root/a.c:5

This frame has 1 object(s):

[32, 42) 'buffer' (line 6) <== Memory access at offset 42 overflows this variable

HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork

(longjmp and C++ exceptions *are* supported)

SUMMARY: AddressSanitizer: stack-buffer-overflow /home/root/a.c:9 in cause_buffer_overflow

Shadow bytes around the buggy address:

0x003f937ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f937ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f937ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f937fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f937fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

=>0x003f93800000: f1 f1 f1 f1 00[02]f3 f3 00 00 00 00 00 00 00 00

0x003f93800080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f93800100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f93800180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f93800200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x003f93800280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Shadow byte legend (one shadow byte represents 8 application bytes):

Addressable: 00

Partially addressable: 01 02 03 04 05 06 07

Heap left redzone: fa

Freed heap region: fd

Stack left redzone: f1

Stack mid redzone: f2

Stack right redzone: f3

Stack after return: f5

Stack use after scope: f8

Global redzone: f9

Global init order: f6

Poisoned by user: f7

Container overflow: fc

Array cookie: ac

Intra object redzone: bb

ASan internal: fe

Left alloca redzone: ca

Right alloca redzone: cb

[-- Attachment #2: Type: text/html, Size: 9403 bytes --]

  reply	other threads:[~2025-01-28 10:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 10:16 [PATCH] qemuriscv: Enable Sv39 memory address scheme by default Yash.Shinde
2025-01-28 10:28 ` Yash Shinde [this message]
2025-01-28 15:51 ` Randy MacLeod
2025-01-28 19:20   ` Khem Raj
2025-01-29  0:38   ` [OE-core] " Alistair Francis
2025-01-29 12:12     ` Yash Shinde
2025-01-29 19:28       ` Randy MacLeod
2025-01-30 12:15         ` Yash Shinde
2025-01-30 16:51         ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29362.1738060100000717567@lists.openembedded.org \
    --to=yash.shinde@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox