qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] hw/virtio-9p-local.c: Remove unnecessary null char in symlink file
@ 2010-12-21  5:20 Harsh Prateek Bora
  2010-12-21  7:51 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Harsh Prateek Bora @ 2010-12-21  5:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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.

v2:
- Description updated to mention about LTP lstat testcase 
  failure without this patch.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
---
 hw/virtio-9p-local.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/virtio-9p-local.c b/hw/virtio-9p-local.c
index 656bfb3..3b6447d 100644
--- a/hw/virtio-9p-local.c
+++ b/hw/virtio-9p-local.c
@@ -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);
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw/virtio-9p-local.c: Remove unnecessary null char in symlink file
  2010-12-21  5:20 [Qemu-devel] [PATCH v2] hw/virtio-9p-local.c: Remove unnecessary null char in symlink file Harsh Prateek Bora
@ 2010-12-21  7:51 ` Stefan Hajnoczi
  2010-12-22  0:11   ` Venkateswararao Jujjuri (JV)
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2010-12-21  7:51 UTC (permalink / raw)
  To: Harsh Prateek Bora; +Cc: qemu-devel

On Tue, Dec 21, 2010 at 5:20 AM, Harsh Prateek Bora
<harsh@linux.vnet.ibm.com> wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw/virtio-9p-local.c: Remove unnecessary null char in symlink file
  2010-12-21  7:51 ` Stefan Hajnoczi
@ 2010-12-22  0:11   ` Venkateswararao Jujjuri (JV)
  0 siblings, 0 replies; 3+ messages in thread
From: Venkateswararao Jujjuri (JV) @ 2010-12-22  0:11 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Harsh Prateek Bora, qemu-devel

On 12/20/2010 11:51 PM, Stefan Hajnoczi wrote:
> On Tue, Dec 21, 2010 at 5:20 AM, Harsh Prateek Bora
> <harsh@linux.vnet.ibm.com> wrote:
>> 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, yes. This is a bug we realized .. fix will be on the way shortly. :)

Thanks,
JV

> 
> Stefan
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-22  0:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21  5:20 [Qemu-devel] [PATCH v2] hw/virtio-9p-local.c: Remove unnecessary null char in symlink file Harsh Prateek Bora
2010-12-21  7:51 ` Stefan Hajnoczi
2010-12-22  0:11   ` Venkateswararao Jujjuri (JV)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).