Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Peter Seebach <peter.seebach@windriver.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] pseudo: Use fxstatat64 in unlinkat
Date: Thu, 2 Aug 2012 16:35:07 -0500	[thread overview]
Message-ID: <20120802163507.2b8de099@e6410-2> (raw)
In-Reply-To: <1343938089.9756.98.camel@ted>

On Thu, 2 Aug 2012 21:08:09 +0100
Richard Purdie <richard.purdie@linuxfoundation.org> wrote:

> Adding seebs to the cc since I suspect he may prefer to merge this
> upstream or he may have feedback?

Ooh, thanks. Yeah, we need to fix this in upstream, but the patch as
provided will likely cause Strange Experiences.

See, if you look at a bit more of unlinkat:

#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
        rc = real_lstat(path, &buf);
#else  
        rc = real___fxstatat(_STAT_VER, dirfd, path, &buf,
                             AT_SYMLINK_NOFOLLOW);
#endif 
        if (rc == -1) {
                return rc;
        }
        msg = pseudo_client_op_plain(OP_MAY_UNLINK, 0, -1, dirfd, path,
                                     &buf);

So, what's pseudo_client_op_plain? Well. On systems that don't
distinguish between stat64 and stat, it's just a #define for
pseudo_client_op. But on Linux, at least:

#define PSEUDO_STATBUF_64 1
#define PSEUDO_STATBUF struct stat64

And then pseudo_client_op_plain does:

                pseudo_stat64_from32(&buf64, buf);
                return pseudo_client_op(op, access, fd, dirfd, path,
                                        &buf64, oldpath); 

So unless it happens that the 'struct stat' and 'struct stat64'
structures have the same layout, this is going to end badly.
We need a more comprehensive fix. But the unlinkat() code is in
the unix port, which tries not to rely on the knowledge that it
can rely on a stat64 existing. (It gets complicated, because on
Darwin, file sizes have always been 64-bit, but inode sizes
changed, but their solution does not involve making everyone refer
to stat64 objects...)

So I'm pretty sure we have to do something a little fancier here,
but I am not 100% sure what the right answer is. Of course, the
Darwin support, which was put in because of all the people telling
me that oe-core would run on OS X as soon as pseudo ran there, has
become a little less exciting of late. :)

Alternatives:
* Check for errno 75 and treat it as harmless.
* Ensure that pseudo is built with -D_FILE_OFFSET_BITS=64 on Linux.

I am not sure whether that latter would work when using pseudo with
other applications not built that way. Or, alternatively, whether
it would work to use pseudo NOT built that way with 32 bit
applications which were; I hadn't realized it was a setting.  :)

So I'm all for fixing this, but the proposed patch looks to me like
it might break things, just because I have low confidence that
treating a stat64 structure as a stat32 would be safe...

-s
-- 
Listen, get this.  Nobody with a good compiler needs to be justified.



  reply	other threads:[~2012-08-02 21:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 20:00 [PATCH 0/1] Fix Bug 2881 Andrei Gherzan
2012-08-02 20:00 ` [PATCH 1/1] pseudo: Use fxstatat64 in unlinkat Andrei Gherzan
2012-08-02 20:08   ` Richard Purdie
2012-08-02 21:35     ` Peter Seebach [this message]
2012-08-02 22:48   ` Peter Seebach
2012-08-06 18:44     ` Peter Seebach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120802163507.2b8de099@e6410-2 \
    --to=peter.seebach@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox