crosvm/devices
Chirantan Ekbote be48c252db fs: Fix {GET,SET}FLAGS ioctls on arm
crosvm runs as a 32-bit binary on arm devices but arcvm has a 64-bit
kernel with a 64-bit userspace.  Since the {GET,SET}FLAGS ioctls use a
c_long as part of the encoding, the encoded value changes based on
whether a long is 4 bytes or 8 bytes. This causes a mismatch where the
server expects the 4 byte encoding while the VM sends the 8 byte
encoding.

Check for both encodings when handling ioctls.  The actual flag value
itself is actually just a c_int and not a c_long as you might expect
from the encoding. Since that has the same width on both 32 and 64 bit
systems we don't have to change the actual value that's returned.

BUG=b:163729385
TEST=lsattr and chattr still work inside the VM. Also use a test program
     to check that the 64-bit versions also work inside the VM.

Change-Id: I77e98ea83372306597f7b3eb2bd675035be98d5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2352281
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2020-08-14 17:41:35 +00:00
..
src fs: Fix {GET,SET}FLAGS ioctls on arm 2020-08-14 17:41:35 +00:00
Cargo.toml Use hypervisor abstraction to run VMs 2020-08-11 04:51:34 +00:00