hw/virtio-9p-local.c: Remove unnecessary null char in symlink file
PATCH v2 1/1 hw/virtio-9p-local.c: Remove unnecessary null char in symlink file
This patch removes the addition of null char in symlink file which is being appended to file in case of mapped security model. Without this patch, the extra null char causes LTP testcase lstat03 to fail and hence this fix is required.
v2:
- Description updated to mention about LTP lstat testcase failure without this patch.
--- hw/virtio-9p-local.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/virtio-9p-local.c +1 -1
@@ -370,7 +370,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,return fd; }/* Write the oldpath (target) to the file. */ - oldpath_size =strlen (oldpath) +1 ; + oldpath_size =strlen (oldpath);do { write_size =write (fd, (void *)oldpath, oldpath_size); }while (write_size ==-1 && errno ==EINTR );
Signature · 1 line
1.7.1.1
Quoted 4 lines · Harsh Prateek Bora
This patch removes the addition of null char in symlink file which is being appended to file in case of mapped security model. Without this patch, the extra null char causes LTP testcase lstat03 to fail and hence this fix is required.
Looks good.
Related note: local_readlink() with fs_sm == SM_MAPPED reads the contents of *any* file. I don't see a check that the file is actually a symlink. What if an application relies on the EINVAL return value when calling readlink() on something that is not a file (not sure how this maps through to 9p though)?
Stefan
Quoted 7 lines · Stefan Hajnoczi
Quoted 4 lines · Harsh Prateek Bora
This patch removes the addition of null char in symlink file which is being appended to file in case of mapped security model. Without this patch, the extra null char causes LTP testcase lstat03 to fail and hence this fix is required.
Quoted 7 lines
Looks good.
Related note:
local_readlink()withfs_sm==SM_MAPPEDreads the contents of *any* file. I don't see a check that the file is actually a symlink. What if an application relies on the EINVAL return value when callingreadlink()on something that is not a file (not sure how this maps through to 9p though)?
Stefan, yes. This is a bug we realized .. fix will be on the way shortly. :)
Thanks,
JV
Quoted 3 lines
Stefan