QuarkContainer / Quark

A secure container runtime with CRI/OCI interface
Apache License 2.0
303 stars 47 forks source link

aarch64: userspace fails to parse vdso through auxv #1324

Open shrik3 opened 2 weeks ago

shrik3 commented 2 weeks ago

test code (note: should be GPL but I forgot where the code was from).

https://paste.sr.ht/blob/2bd3b5a16686b99fe4790d298d90d6a38c90f3a8

on native aarch64 (kernel 5.15)

$ ./test
VDSO @ 0xffff871d8000
__kernel_rt_sigreturn  @ (nil) 
__kernel_clock_getres  @ 0xffff871d8760 
__kernel_clock_gettime @ 0xffff871d8720 
__kernel_gettimeofday  @ 0xffff871d8740

with Quark:

docker run --rm --runtime=quark_d test
VDSO @ 0xa000001000
__kernel_rt_sigreturn  @ (nil) 
__kernel_clock_getres  @ (nil) 
__kernel_clock_gettime @ (nil) 
__kernel_gettimeofday  @ (nil)

(note: I didn't include @chl337 's vdso patch as it has nothing to do with userspace and auxv)

shrik3 commented 2 weeks ago

Note: regarding vdso symbols see man vDSO (7)

chl337 commented 2 weeks ago

Interesting, I will give it a look later.

QuarkContainer commented 2 weeks ago

I can repro similar issue happened in x86.

shrik3 commented 2 weeks ago

On Tue Jul 9, 2024 at 5:01 PM CEST, QuarkSoft wrote:

I can repro similar issue happened in x86.

For x86, are you using arch specify vdso symbol names? i.e. instead of

kernel_rt_sigreturn kernel_gettimeofday kernel_clock_gettime kernel_clock_getres

use

vdso_clock_gettime vdso_getcpu __vdso_gettimeofday __vdso_time

QuarkContainer commented 2 weeks ago

Yes. I did the change.


From: Tianhao Wang @.***> Sent: Tuesday, July 9, 2024 8:24 AM To: QuarkContainer/Quark Cc: Yulin Sun; Assign Subject: Re: [QuarkContainer/Quark] aarch64: userspace fails to parse vdso through auxv (Issue #1324)

On Tue Jul 9, 2024 at 5:01 PM CEST, QuarkSoft wrote:

I can repro similar issue happened in x86.

For x86, are you using arch specify vdso symbol names? i.e. instead of

kernel_rt_sigreturn kernel_gettimeofday kernel_clock_gettime kernel_clock_getres

use

vdso_clock_gettime vdso_getcpu __vdso_gettimeofday __vdso_time

— Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_QuarkContainer_Quark_issues_1324-23issuecomment-2D2218012267&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=DlVd8EA60eTawMXHolu8r3SI1kM4__hdCe61U_easzU&m=p0FBFjvdqF74dcfSeVh3n2MquzGtLIFo5rrQn-GCb4079mlgZu1fWcipZmu9fh2f&s=foEkgOVlQZ6_mznmXimUkLoqUdO4lzVzcISdvH6T1m4&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ATC5KBHBITFY7S7VC4DUMGTZLP6DLAVCNFSM6AAAAABKSOBW5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJYGAYTEMRWG4&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=DlVd8EA60eTawMXHolu8r3SI1kM4__hdCe61U_easzU&m=p0FBFjvdqF74dcfSeVh3n2MquzGtLIFo5rrQn-GCb4079mlgZu1fWcipZmu9fh2f&s=M_SWwVBPUty6cxwJvGwRbNWwiFeEl4od69BIFzMvZ4Q&e=. You are receiving this because you were assigned.Message ID: @.***>

QuarkContainer commented 2 weeks ago

Looks like our vdso binary build has issue. I tried to use https://github.com/enarx/vdso to parse our vdso.so and get wrong result.

QuarkContainer commented 2 weeks ago

for x86, we need to change the test code

vdso_sym("LINUX_2.6", "vdso_clock_gettime")) instead of vdso_sym("LINUX_2.6.39", "vdso_clock_gettime"))

Then it will work.

So it is false alarm for x86.