Summary: | Two subsequent display roundtrips results sendmsg syscall with uninitialized bytes | ||
---|---|---|---|
Product: | Wayland | Reporter: | Jon <eyolfson> |
Component: | wayland | Assignee: | Wayland bug list <wayland-bugs> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | jadahl |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | The bug triggers on the second roundtrip call. |
Description
Jon
2016-02-10 02:24:51 UTC
Note, a normal execution (not with valgrind) results in SIGSEGV (Address boundary error). (In reply to Jon from comment #1) > Note, a normal execution (not with valgrind) results in SIGSEGV (Address > boundary error). Are you sure there is a compositor running when you run your test case? I can only reproduce a SIGSEGV if there is no Wayland compositor to connect to. If it succeeds connecting, I only get the valgrind warning, no SIGSEGV. (In reply to Jonas Ådahl from comment #2) > (In reply to Jon from comment #1) > > Note, a normal execution (not with valgrind) results in SIGSEGV (Address > > boundary error). > > Are you sure there is a compositor running when you run your test case? I > can only reproduce a SIGSEGV if there is no Wayland compositor to connect > to. If it succeeds connecting, I only get the valgrind warning, no SIGSEGV. Oops, sorry. Yeah the SIGSEGV only occurs if there's no compositor. The sendmsg valgrind error still occurs in either case though. (In reply to Jon from comment #3) > (In reply to Jonas Ådahl from comment #2) > > (In reply to Jon from comment #1) > > > Note, a normal execution (not with valgrind) results in SIGSEGV (Address > > > boundary error). > > > > Are you sure there is a compositor running when you run your test case? I > > can only reproduce a SIGSEGV if there is no Wayland compositor to connect > > to. If it succeeds connecting, I only get the valgrind warning, no SIGSEGV. > > Oops, sorry. Yeah the SIGSEGV only occurs if there's no compositor. The > sendmsg valgrind error still occurs in either case though. The reason is that we align the buffers by 4 bytes. So that when we put a string "ab" which is 3 bytes including '\0', we write: 0-3: [sender id] 4-5: [3 bytes long message] 6-7: [op code] 8-10: "ab\0" 11: [uninitialized] The reader will read bytes 4-5 and then not read the uninitialized data. This, is, more or less harmless, accept for the fact that we are sending uninitialized bytes from the one process's memory to another, which I would say is a security issue at least when the closure is sent from the server to the client. I'm sending a patch making the memory initialized to 0, so we avoid padding with uninitialized bytes. Fixed by: commit bf34ac75d0d61609296de1300196c843f4246e7c Author: Jonas Ådahl <jadahl@gmail.com> Date: Wed Feb 10 23:35:44 2016 +0800 connection: Don't add uninitialized memory as 4 byte alignment padding which is now on master. It will be available in version 1.10. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.