Skip to contentSkip to conversation

PATCH Nicolas George 2 participants 2 messages Aug 14, 2007 – Aug 27, 2007 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

Cc:
Bcc:
Subject: Re: UML/man: BLKGETSIZE takes a long, not an int Reply-To:
In-Reply-To: <[email protected]>

Hi.

I fear that my bug-report yesterday was very badly written, with me writing to the wrong mailing-list and all.

I was saying:

Quoted 6 lines

I found a type mismatch in UML that makes host block devices unusable as ubd devices on x86_64 and other 64 bits systems (segfault of the mm subsystem):

In block/ioctl.c, the following lines show that the BLKGETSIZE ioctl expects a pointer to a long:

Quoted 8 lines
	case BLKGETSIZE:
		if ((bdev->bd_inode->i_size >> 9) > ~0UL)
			return -EFBIG;
		return put_ulong(arg, bdev->bd_inode->i_size >> 9);

In arch/um/os-Linux/file.c, os_file_size calls it with an int.

The ioctl_list man page should be fixed as well.

I add that the bug was still there yesterday in the git repository.

I join the patch to file.c.

Regards,

Signature · 1 line
  Nicolas George
arch/um/os-Linux/file.c +2 -1
index 6f92f73..c3ecc2a 100644
@@ -320,7 +320,8 @@ int os_file_size(char *file, unsigned long long *size_out)
 	}
 
 	if(S_ISBLK(buf.ust_mode)){
-		int fd, blocks;
+		int fd;
+		long blocks;
 
 		fd = os_open_file(file, of_read(OPENFLAGS()), 0);
 		if(fd < 0){
#1 lore raw

Re: UML/man: BLKGETSIZE takes a long, not an int

Hello Nicolas,

Quoted 19 lines

I fear that my bug-report yesterday was very badly written, with me writing to the wrong mailing-list and all.

I was saying:

Quoted 14 lines

I found a type mismatch in UML that makes host block devices unusable as ubd devices on x86_64 and other 64 bits systems (segfault of the mm subsystem):

In block/ioctl.c, the following lines show that the BLKGETSIZE ioctl expects a pointer to a long:

	case BLKGETSIZE:
		if ((bdev->bd_inode->i_size >> 9) > ~0UL)
			return -EFBIG;
		return put_ulong(arg, bdev->bd_inode->i_size >> 9);

In arch/um/os-Linux/file.c, os_file_size calls it with an int.

The ioctl_list man page should be fixed as well.

manual page changed for 2.65:

ioctl_list.2 (working copy) renamed from ioctl_list.2 +1 -1
@@ -243,7 +243,7 @@
 0x0000125D  BLKROSET                   const int *
 0x0000125E  BLKROGET                   int *
 0x0000125F  BLKRRPART                  void
-0x00001260  BLKGETSIZE                 int *
+0x00001260  BLKGETSIZE                 unsigned long *
 0x00001261  BLKFLSBUF                  void
 0x00001262  BLKRASET                   int
 0x00001263  BLKRAGET                   int *

Thanks,

Michael

Signature · 6 lines
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7

Want to help with man page maintenance?  Grab the latest tarball at
http://www.kernel.org/pub/linux/docs/manpages/
read the HOWTOHELP file and grep the source files for 'FIXME'.