#44 big-endian mkudffs goes boom

open
nobody
None
1
2004-08-12
2004-08-12
Pat LaVarre
No

The released version of mkudffs lacks a
little/big-endian adjustment that the CVS version has.

Low priority until someone expert in sourceforge.net
volunteers to release what now works in CVS.

Discussion

  • Pat LaVarre
    Pat LaVarre
    2004-08-12

    Logged In: YES
    user_id=964855

    Kindly donated offline, from an old human memory, we have the claim:

    ---
    with out the patch, ... mkudffs ... segmentation fault ...
    disc->udf_lvd[0]->numPartitionMaps ... little endian ...
    with the byte swap ...
    the code runs past the end of the udf_lvd[] array.
    ---

     
  • YoungdoLee
    YoungdoLee
    2004-08-25

    Logged In: YES
    user_id=399786

    maybe this problem

    diff -urN ../../udftools-1.0.0b3/mkudffs/mkudffs.c ./mkudffs.c
    --- ../../udftools-1.0.0b3/mkudffs/mkudffs.c 2004-02-23
    12:35:33.000000000 +0900
    +++ ./mkudffs.c 2004-08-25 22:32:08.000000000 +0900
    @@ -250,14 +250,18 @@
    if (size % offsets[PSPACE_SIZE])
    size -= (size % offsets[PSPACE_SIZE]);
    set_extent(disc, PSPACE, start, size);
    - for (i=0; i<disc->udf_lvd[0]->numPartitionMaps; i++)
    +
    +// tifler : bugs on big endian machine
    +// for (i=0; i<disc->udf_lvd[0]->numPartitionMaps; i++)
    + for (i=0; i<le32_to_cpu(disc->udf_lvd[0]-
    >numPartitionMaps); i++)
    {
    if (i == 1)
    disc->udf_lvid->freeSpaceTable[i] =
    cpu_to_le32(0xFFFFFFFF);
    else
    disc->udf_lvid->freeSpaceTable[i] =
    cpu_to_le32(size);
    }
    - for (j=0; j<disc->udf_lvd[0]->numPartitionMaps; j++)
    +// for (j=0; j<disc->udf_lvd[0]->numPartitionMaps; j++)
    + for (j=0; j<le32_to_cpu(disc->udf_lvd[0]-
    >numPartitionMaps); j++)
    {
    if (j == 1)
    disc->udf_lvid->sizeTable[i+j] = cpu_to_le32
    (0xFFFFFFFF);

     
  • Pat LaVarre
    Pat LaVarre
    2004-08-25

    Logged In: YES
    user_id=964855

    Hmmm. I'm not sure I made myself clear.

    Me, I meant to say that we find two versions of mkudffs at linux-udf at
    sourceforge.net. I see both versions work in x86, but I'm told one
    version segfaults in PPC.

    The mkudffs that purportedly segfaults appears in the released version of
    1.0.0.b3 udftools at:

    https://sourceforge.net/project/showfiles.php?
    group_id=295&package_id=38129&release_id=218959

    The mkudffs that works appears in CVS if your firewall lets you supply
    an empty password in response to a command sequence like:

    export CVSROOT=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/
    linux-udf
    cvs login
    cvs co udftools
    cvs logout

    The issue I relayed to here from the friend who discovered it is that ...

    No one knowledgeable and privileged enough to fix this discrepancy has
    fixed it, as yet.

    That issue I don't see your reply addressing. However, yes indeed, the
    diff between the source code of these two versions does include the code
    you kindly highlighted. Specifically today, if I avoid counting absent
    files, I see 179 lines of difference which include the 20 lines:

    diff -urp udftools-1.0.0b3/mkudffs/mkudffs.c udftools-cvs/mkudffs/
    mkudffs.c
    --- udftools-1.0.0b3/mkudffs/mkudffs.c Sun Feb 22 20:35:33 2004
    +++ udftools-cvs/mkudffs/mkudffs.c Mon Mar 1 19:09:39 2004
    @@ -250,14 +250,14 @@ void split_space(struct udf_disc *disc)
    if (size % offsets[PSPACE_SIZE])
    size -= (size % offsets[PSPACE_SIZE]);
    set_extent(disc, PSPACE, start, size);
    - for (i=0; i<disc->udf_lvd[0]->numPartitionMaps; i++)
    + for (i=0; i<le32_to_cpu(disc->udf_lvd[0]->numPartitionMaps); i++)
    {
    if (i == 1)
    disc->udf_lvid->freeSpaceTable[i] =
    cpu_to_le32(0xFFFFFFFF);
    else
    disc->udf_lvid->freeSpaceTable[i] = cpu_to_le32(size);
    }
    - for (j=0; j<disc->udf_lvd[0]->numPartitionMaps; j++)
    + for (j=0; j<le32_to_cpu(disc->udf_lvd[0]->numPartitionMaps); j++)
    {
    if (j == 1)
    disc->udf_lvid->sizeTable[i+j] = cpu_to_le32(0xFFFFFFFF);

     
  • Pat LaVarre
    Pat LaVarre
    2004-08-25

    Logged In: YES
    user_id=964855

    With less than a couple of days of work, I have discovered how to run
    Linux on a (big-endian) (PPC) Mac without sacrificing its hard drive, via
    slightly reconfiguring the version of Gentoo Linux live CD that includes a
    GUI desktop.

    But I still can't build a mkudffs to try there myself because I haven't yet
    figured out how to install gcc and make. My effort to date appears
    detailed at:

    Subject: bugs.gentoo.org
    http://linux-pel.blog-city.com/read/782855.htm