Bug 472795 - ppc64: missing compat sys_ustat corrupts userspace when sys_ustat called from 32-bit
ppc64: missing compat sys_ustat corrupts userspace when sys_ustat called from...
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
ppc64 Linux
medium Severity medium
: ---
: ---
Assigned To: Kernel Maintainer List
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-11-24 12:32 EST by Eric Sandeen
Modified: 2009-12-14 22:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-12-14 22:11:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Sandeen 2008-11-24 12:32:52 EST
+++ This bug was initially created as a clone of Bug #472426 +++

Found this by running a 32-bit xfs_logprint on a 64-bit kernel:

# xfs_logprint /dev/loop0
*** stack smashing detected ***: xfs_logprint terminated
Aborted (core dumped)

The problem here is that there is no sys_compat_ustat, and the kernel copies out a structure larger than userspace has provided:

32-bit ustat struct from userspace:

struct ustat {
        __daddr_t                  f_tfree;              /*     0     4 */
        __ino_t                    f_tinode;             /*     4     4 */
        char                       f_fname[6];           /*     8     6 */
        char                       f_fpack[6];           /*    14     6 */

        /* size: 20, cachelines: 1 */
        /* last cacheline: 20 bytes */

kernel ustat struct:

struct ustat {
        __kernel_daddr_t           f_tfree;              /*     0     4 */

        /* XXX 4 bytes hole, try to pack */

        __kernel_ino_t             f_tinode;             /*     8     8 */
        char                       f_fname[6];           /*    16     6 */
        char                       f_fpack[6];           /*    22     6 */

        /* size: 32, cachelines: 1 */
        /* sum members: 24, holes: 1, sum holes: 4 */
        /* padding: 4 */
        /* last cacheline: 32 bytes */

... so userspace is corrupted when this syscall is called.

Christoph Hellwig mentioned that he might take a stab at fixing it, since he's done other compat syscalls, but not sure on what schedule, so perhaps I (or our ppc maintainer, if we have one...?) can take a look at the fix.

--- Additional comment from esandeen@redhat.com on 2008-11-20 15:12:27 EDT ---

See also http://rhts.redhat.com/cgi-bin/rhts/test_log.cgi?id=5087037

--- Additional comment from esandeen@redhat.com on 2008-11-20 22:00:46 EDT ---

I've tested the patch in comment #3 on ppc, and it resolves the issue I saw.
Comment 1 Eric Sandeen 2008-11-24 12:33:50 EST
Christoph Hellwig whipped up a patch for this:

[PATCH] generic compat_sys_ustat went to LKML on 11/21
Comment 2 Bug Zapper 2008-11-26 00:52:39 EST
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
Comment 3 Bug Zapper 2009-11-18 03:57:19 EST
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: 
Comment 4 Eric Sandeen 2009-12-14 22:11:50 EST
This is all upstream now.

Note You need to log in before you can comment on or make changes to this bug.