reading usb memory on x86_64 ltsp client fails

Bug #415952 reported by John Ellson on 2009-08-19
70
This bug affects 10 people
Affects Status Importance Assigned to Milestone
LTSP
Medium
Scott Balneaves
ltspfs (Fedora)
Won't Fix
Medium
ltspfs (Ubuntu)
Medium
Unassigned

Bug Description

Problem existed in fedora-10, and still exists in a freshly installed fedora-11 x86_64 server with x86_64 ltsp clients running x86_64 images.

Reading/writing USB memory sticks on i386 ltsp clients works fine, but on x86_64 clients
it always gets a malloc failure.

    ellson@bock:usbdisk-sda1> cat foo
    cat: foo: Cannot allocate memory

Probable cause is bad casts in ltspfsd_functions.c which generate warnings during make.

Original problem report at: https://bugzilla.redhat.com/show_bug.cgi?id=484580

Description of problem:
I can plugin a usb memory stick into a client, can open a nautilus window on the mount, and can see icons for the folders and files on the mount, can open folders, but attempting to read any file with any application results in an error.

The problem is always a failure to allocate memory during read()

Version-Release number of selected component (if applicable):
ltspfs-0.5.8-1.fc10.x86_64

How reproducible:
100%

Steps to Reproduce:
1. strace cat /media/ellson/FEDORA/syslinux/boot.cat
2.
3.

Actual results:
...
open("/media/ellson/FEDORA/syslinux/boot.cat", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=2048, ...}) = 0
read(3, 0x2580000, 4096) = -1 ENOMEM (Cannot allocate memory)
write(2, "cat: "..., 5cat: ) = 5
write(2, "/media/ellson/FEDORA/syslinux/boo"..., 38/media/ellson/FEDORA/syslinux/boot.cat) = 38
open("/usr/share/locale/locale.alias", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=2512, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2088524000
read(4, "# Locale name alias data base.\n# "..., 4096) = 2512
read(4, ""..., 4096) = 0
close(4) = 0
munmap(0x7f2088524000, 4096) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Cannot allocate memory"..., 24: Cannot allocate memory) = 24
write(2, "\n"..., 1
) = 1
close(3) = 0
close(1) = 0
close(2) = 0
exit_group(1) = ?

Expected results:
ability to open files on usb memory sticks

Additional info:

This is extremely bizarre. Ryan, any ideas?

We still have this problem on the school system. On my home sytstem, USB memory sticks work just fine. I've reloaded the ltsp-client software on both systems to be sure they are identical. I've checked everything I can think of on the servers, but can't find any differences.

The symptoms are:
- Plugin a USB stick and it shows on the desktop, but attempting to read or write a file to it results in a gui popup:

    Error reading from file: cannot allocate memory

- The mount point is weird, even root can't access it:

    root@sol:~# cd /media/test3
    root@sol:test3# ls -l
    ls: cannot access CANON_DC: Permission denied
    total 0
    d????????? ? ? ? ? ? CANON_DC

- Mount on the server shows:

    gvfs-fuse-daemon on /home/test3/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=test3)
    ltspfs on /media/test3/CANON_DC type fuse.ltspfs (rw,nosuid,nodev,user=test3)

Any ideas? What should I investigate for permissions problems on gvfs mounts?

I cannot prioritize looking at this. did you ask upstream? they wrote and understand this part of the code.

Download full text (5.6 KiB)

Tried completely fresh install of fedora-11 and still the same problem,
but finally some new information.

This bug affects x86_64 ltsp clients only! i386 clients work fine.

Mounting the memory stick works, but trying to read or write to it fails with:

    ellson@bock:usbdisk-sda1> cat foo
    cat: foo: Cannot allocate memory

I suspect this code in ltspfsd (also the similar malloc in ltspfs_write() )

void ltspfs_read(int sockfd, XDR * in)
{
    XDR out;
    char path[PATH_MAX];
    char output[LTSP_MAXBUF];
    int i;
    int fd;
    int result;
    size_t size;
    off_t offset;
    char *buf;

    if (!xdr_u_int(in, &size)) { /* Get the size */
        eacces(sockfd);
        return;
    }

    if (!xdr_longlong_t(in, &offset)) { /* Get the offset */
        eacces(sockfd);
        return;
    }

    if (get_fn(sockfd, in, path)) { /* Get the path */
        eacces(sockfd);
        return;
    }

    buf = malloc(size);

    /*
     * Check result of malloc
     */

    if (!buf) {
        status_return(sockfd, FAIL);
        return;
    }

Partularly since this code is generating these build warnings!

ake[2]: Entering directory `/home/ellson/rpmbuild/BUILD/ltspfs-0.5.8/src'
/usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=22 -D_REENTRANT -g -O2 -MT ltspfs-ltspfs.o -MD -MP -MF .deps/ltspfs-ltspfs.Tpo -c -o ltspfs-ltspfs.o `test -f 'ltspfs.c' || echo './'`ltspfs.c
ltspfs.c: In function ‘ltspfs_getattr’:
ltspfs.c:312: warning: passing argument 2 of ‘xdr_u_int’ from incompatible pointer type
/usr/include/rpc/xdr.h:289: note: expected ‘u_int *’ but argument is of type ‘__nlink_t *’
ltspfs.c: In function ‘ltspfs_read’:
ltspfs.c:766: warning: passing argument 2 of ‘xdr_u_int’ from incompatible pointer type
/usr/include/rpc/xdr.h:289: note: expected ‘u_int *’ but argument is of type ‘size_t *’
ltspfs.c: In function ‘ltspfs_write’:
ltspfs.c:823: warning: passing argument 2 of ‘xdr_u_int’ from incompatible pointer type
/usr/include/rpc/xdr.h:289: note: expected ‘u_int *’ but argument is of type ‘size_t *’
ltspfs.c: In function ‘ltspfs_statfs’:
ltspfs.c:882: warning: passing argument 2 of ‘xdr_int’ from incompatible pointer type
/usr/include/rpc/xdr.h:288: note: expected ‘int *’ but argument is of type ‘long int *’
ltspfs.c:883: warning: passing argument 2 of ‘xdr_int’ from incompatible pointer type
/usr/include/rpc/xdr.h:288: note: expected ‘int *’ but argument is of type ‘long int *’
ltspfs.c:889: warning: passing argument 2 of ‘xdr_int’ from incompatible pointer type
/usr/include/rpc/xdr.h:288: note: expected ‘int *’ but argument is of type ‘long int *’
mv -f .deps/ltspfs-ltspfs.Tpo .deps/ltspfs-ltspfs.Po
/usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=22 -D_REENTRANT -g -O2 -MT ltspfs-common.o -MD -MP -MF .deps/ltspfs-common.Tpo -c -o ltspfs-common.o `test -f 'common.c' || echo './'`common.c
mv -f .deps/ltspfs-common.Tpo .deps/ltspfs-common.Po
/usr/bin/gcc -Wall -W -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=22 -D_REENTRANT -g -O2 -o ltspfs ltspfs-ltspfs.o ltspfs-common.o -pthread -L/lib64 -lfuse -lrt -ldl -lX11...

Read more...

I think I found the right place to report it:

https://bugs.launchpad.net/ltsp/+bug/415952

Vagrant Cascadian (vagrantc) wrote :

seems like all 64-bit debian buildd's issue warnings similar to those mentioned in the fedora bugreport:

https://buildd.debian.org/fetch.cgi?pkg=ltspfs&arch=amd64&ver=0.5.13-1&stamp=1247828018&file=log&as=raw

one example from the build log:

make[3]: Entering directory `/build/buildd/ltspfs-0.5.13/src'
gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=22 -D_REENTRANT -g -O2 -c -o ltspfs-ltspfs.o `test -f 'ltspfs.c' || echo './'`ltspfs.c
ltspfs.c: In function 'ltspfs_getattr':
ltspfs.c:327: warning: passing argument 2 of 'xdr_u_int' from incompatible pointer type
ltspfs.c: In function 'ltspfs_read':
ltspfs.c:781: warning: passing argument 2 of 'xdr_u_int' from incompatible pointer type
ltspfs.c: In function 'ltspfs_write':
ltspfs.c:838: warning: passing argument 2 of 'xdr_u_int' from incompatible pointer type
ltspfs.c: In function 'ltspfs_statfs':

Hosed (liveonaware) wrote :

Yes, I agree with this, but a user named, Gadi, in irc.freenode.net #ltsp, told me just to use i386, now it's working fine for me, thank you Gadi!

Stéphane Graber (stgraber) wrote :

Was anyone able to reproduce that with another distro ?
Just to make sure it's actually ltspfs that's broken and not something else ?

Changed in ltsp:
status: New → Incomplete
importance: Undecided → Medium
Changed in ltsp:
assignee: nobody → Scott Balneaves (sbalneav)

This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 10 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Wim Muskee (wimmuskee) wrote :

Seeing the same warnings on Gentoo for ltspfs-0.5.13 on amd64.

This problem still exists in Fedora 11.

Luke Faraone (lfaraone) wrote :

I am also experiencing this problem on Ubuntu 9.10 "Karmic". Please let me know if there is any additional information I can provide.

Changed in ltsp:
status: Incomplete → Confirmed
Changed in ltspfs (Ubuntu):
status: New → Triaged
importance: Undecided → Medium

This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 11 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Hi,

I could confirm the problem on an ubuntu amd64 10.04 installation (server + client).
It was not possible to mount the usb drives although the kernel detected them correctly.
I changed the casting and then it worked!
I attach the changes.

Regards,

Kosmas.

tags: added: patch
john_s (lists-john) wrote :

I can also confirm this problem with Ubuntu Lucid 10.04 with 64 bit clients. Scott are you planning on using the above patch to fix this issue for Ubuntu LTS?

Thanks!

John

luthr (luther-mailinator) wrote :

Problem exists with Maverick 10.10 64bit.

I applied Kosmas' patch, recompiled ltspfs, rebuilt the image, but.... problem still exists. No usb drive shows up

Łukasz Wiśniewski (fr-luksus) wrote :

Problem exists also on Ubuntu 11.04 x64 clients. ltspfs 0.7-2

Alkis Georgopoulos (alkisg) wrote :
Changed in ltsp:
status: Confirmed → Fix Released
Changed in ltspfs (Ubuntu):
status: Triaged → Fix Released
Changed in ltspfs (Fedora):
importance: Unknown → Medium
status: Unknown → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.