public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/fcntl34: Use -D_FILE_OFFSET_BITS=64 for all cases
Date: Tue, 16 Aug 2016 12:02:23 +0200	[thread overview]
Message-ID: <20160816100223.GA24312@rei.lan> (raw)
In-Reply-To: <3ABF60118B9B784CA5BF7C841D2F00EC01000AF3@de02wembxa.internal.synopsys.com>

Hi!
> As far as I know it fails in this case because fcntl always expects
> flock64 for OFD locks but gets 32-bit flock structure with non-zero
> l_pid field (OFD expects that this field contains zero otherwise
> returns EINVAL). The problem is that there are no 32-bit OFD locks in
> the kernel. So there are 2 options:

If you look into fs/fcntl.c in Linux kernel the F_OFD_XXX constants are
inside #if BITS_PER_LONG != 32 in the do_fcntl(). Hence 32bit fcntl()
returns EINVAL since these constants are missing from the switch() when
compiled on 32bit platform.

And the same apply for when you run 32bit binary on 64bit kernel. In
this case the fcntl syscall from fs/compat.c just returns EINVAL if the
cmd is F_OFD_XXX.

Which works fine for glibc, since if you compile without
_FILE_OFFSET_BITS=64 on 32bit it calls 32bit fcntl() syscall that
rightfully returns EINVAL and if you compile with _FILE_OFFSET_BITS=64
both flock structure and fcntl() are 64bit and everything works fine.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2016-08-16 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 17:11 [LTP] [PATCH] syscalls/fcntl34: Use -D_FILE_OFFSET_BITS=64 for all cases Yuriy Kolerov
2016-08-15 12:08 ` Cyril Hrubis
2016-08-16  9:46   ` Yuriy Kolerov
2016-08-16 10:02     ` Cyril Hrubis [this message]
2016-08-16 10:47       ` Yuriy Kolerov
2016-08-16 11:02         ` Peter Maydell
2016-08-16 11:31           ` Cyril Hrubis
2016-08-16 11:30         ` Cyril Hrubis

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=20160816100223.GA24312@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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