From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fcntl.2: F_OFD_XXX needs flock64
Date: Tue, 16 Aug 2016 16:34:53 +0200 [thread overview]
Message-ID: <20160816143453.GA26323@rei.lan> (raw)
In-Reply-To: <20160816115506.GA25201@rei.lan>
Hi!
> If we pass struct flock to the F_OFD_XXX fcntl() it will fail with
> EINVAL with a 32bit binary. That is because glibc uses fcntl64() by
> default but the struct flock uses 32bit off_t for 32bit binaries (unless
> _FILE_OFFSET_BITS=64) and kernel always expect flock64 for F_OFD_XXX in
> fcntl64(). Hence kernel will read some garbage that is a few bytes after
> the 32bit flock structure in this case which will likely end up with the
> syscall returning EINVAL.
Here is also a commit that fixes the corresponding LTP testcase:
https://github.com/linux-test-project/ltp/commit/ae09800dfed8630f67796501bef3a88bb4fd3daa
Before this the fcntl34 test was failing on 32bit platform or with
CFLAGS=-m32 LDFLAGS=-m32 passed to configure.
Before:
testcases/kernel/syscalls/fcntl $./fcntl34
tst_test.c:756: INFO: Timeout per run is 0h 05m 00s
fcntl34.c:104: INFO: write to a file inside threads with OFD locks
fcntl34.c:48: INFO: spawning '12' threads
fcntl34.c:79: BROK: fcntl() failed: EINVAL
Summary:
passed 0
failed 0
skipped 0
warnings 0
After:
testcases/kernel/syscalls/fcntl $./fcntl34
tst_test.c:756: INFO: Timeout per run is 0h 05m 00s
fcntl34.c:104: INFO: write to a file inside threads with OFD locks
fcntl34.c:48: INFO: spawning '12' threads
fcntl34.c:57: INFO: waiting for '12' threads
fcntl34.c:113: INFO: verifying file's data
fcntl34.c:141: PASS: OFD locks synchronized access between threads
Summary:
passed 1
failed 0
skipped 0
warnings 0
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-08-16 14:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-16 11:55 [LTP] [PATCH] fcntl.2: F_OFD_XXX needs flock64 Cyril Hrubis
2016-08-16 14:34 ` Cyril Hrubis [this message]
2016-08-16 20:04 ` Michael Kerrisk
2016-08-16 23:41 ` Jeff Layton
2016-08-17 1:08 ` Michael Kerrisk
2016-08-17 8:10 ` Cyril Hrubis
2016-08-17 11:44 ` Jeff Layton
2016-08-17 11:53 ` Cyril Hrubis
2016-08-17 13:14 ` Jeff Layton
2016-08-17 13:19 ` Cyril Hrubis
2016-08-17 13:34 ` Jeff Layton
2016-08-17 13:34 ` Cyril Hrubis
2016-08-17 19:44 ` Michael Kerrisk
2016-08-17 7:44 ` 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=20160816143453.GA26323@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