From: Daniel Gollub <dgollub-l3A5Bk7waGM@public.gmane.org>
To: Kai Henningsen <kai.extern-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
mtk.manpages-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ltp-list-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
"A.E. Brouwer" <aeb-ek1Qb6IBo2Pz+pZb47iToQ@public.gmane.org>
Subject: Re: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall?
Date: Fri, 31 Oct 2008 16:37:23 +0100 [thread overview]
Message-ID: <200810311637.25371.dgollub@suse.de> (raw)
In-Reply-To: <20081031160248.2b95d0e8-r49W/1Cwd2f9tVrXfjCyDJqJBGhVce5bs0AfqQuZ5sE@public.gmane.org>
On Friday 31 October 2008 16:02:48 Kai Henningsen wrote:
> Am Fri, 24 Oct 2008 17:53:25 -0500
>
> schrieb "Michael Kerrisk" <mtk.manpages-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>:
> > Hi Daniel,
> >
> > On Thu, Oct 23, 2008 at 9:50 AM, Daniel Gollub <dgollub-l3A5Bk7waGM@public.gmane.org>
> >
> > wrote:
> > > EINVAL bufsiz is not positive.
> >
> > The EINVAL error was added to man-pages-1.18 in 1997 (even though, as
> > you note, the type was "size_t"). I suspect (this was well before I
> > had any association with man-pages) that was done to reflect kernel
> > reality (since one could bypass glibc invoke the syscall directly),
> > but obviously it is inconsistent with the prototype.
>
> Actually, it's not inconsistent as described, though perhaps that is
> unintentional. "Not positive" isn't the same as "negative", as zero
> isn't positive either, and zero is certainly a possible value of an
> unsigned type
True.
But there is still the problem for the ltp syscall test "readlink03", when
using the glibc "readlink" interface, by calling readlink with a buffer size
of "-1".
Calling "-1" seems to be a valid code/error-path in the linux syscall
"readlink", since there is a check for less-equal zero.
But the less zero, condition can't be reached via the glibc "readlink"
interface since this would cause fortify-check to fail (when buliding with -
D_FORITFY_SOURCE=2).
To "workaround" the fortify check, by not compiling the testcase with -
D_FORTIFY_SOURCE=2, or trying to test the linux readlink interface by calling
directly syscall() in the testcase ... both suggestion are just workarounds -
no real solutions.
We could also just remove the testcase of buffer size "-1".
The problem is still, how to test the "readlink" syscall in LTP?
best regards,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Gollub <dgollub@suse.de>
To: Kai Henningsen <kai.extern@googlemail.com>
Cc: mtk.manpages@gmail.com, mtk.manpages@googlemail.com,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
linux-man@vger.kernel.org, ltp-list@lists.sourceforge.net,
"A.E. Brouwer" <aeb@win.tue.nl>
Subject: Re: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall?
Date: Fri, 31 Oct 2008 16:37:23 +0100 [thread overview]
Message-ID: <200810311637.25371.dgollub@suse.de> (raw)
In-Reply-To: <20081031160248.2b95d0e8@desktop.khms.westfalen.de>
On Friday 31 October 2008 16:02:48 Kai Henningsen wrote:
> Am Fri, 24 Oct 2008 17:53:25 -0500
>
> schrieb "Michael Kerrisk" <mtk.manpages@googlemail.com>:
> > Hi Daniel,
> >
> > On Thu, Oct 23, 2008 at 9:50 AM, Daniel Gollub <dgollub@suse.de>
> >
> > wrote:
> > > EINVAL bufsiz is not positive.
> >
> > The EINVAL error was added to man-pages-1.18 in 1997 (even though, as
> > you note, the type was "size_t"). I suspect (this was well before I
> > had any association with man-pages) that was done to reflect kernel
> > reality (since one could bypass glibc invoke the syscall directly),
> > but obviously it is inconsistent with the prototype.
>
> Actually, it's not inconsistent as described, though perhaps that is
> unintentional. "Not positive" isn't the same as "negative", as zero
> isn't positive either, and zero is certainly a possible value of an
> unsigned type
True.
But there is still the problem for the ltp syscall test "readlink03", when
using the glibc "readlink" interface, by calling readlink with a buffer size
of "-1".
Calling "-1" seems to be a valid code/error-path in the linux syscall
"readlink", since there is a check for less-equal zero.
But the less zero, condition can't be reached via the glibc "readlink"
interface since this would cause fortify-check to fail (when buliding with -
D_FORITFY_SOURCE=2).
To "workaround" the fortify check, by not compiling the testcase with -
D_FORTIFY_SOURCE=2, or trying to test the linux readlink interface by calling
directly syscall() in the testcase ... both suggestion are just workarounds -
no real solutions.
We could also just remove the testcase of buffer size "-1".
The problem is still, how to test the "readlink" syscall in LTP?
best regards,
Daniel
next prev parent reply other threads:[~2008-10-31 15:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-23 14:50 [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall? Daniel Gollub
2008-10-23 14:50 ` Daniel Gollub
2008-10-23 14:50 ` [patch 1/3] [RFC] Change sys_readlink/sys_readlinkat buffer size parameter to size_t (POSIX mismatch) Daniel Gollub
2008-10-23 14:50 ` Daniel Gollub
2008-10-23 14:50 ` [patch 2/3] [man-pages] Remove "bufsize is not positive" from readlink(2) error section Daniel Gollub
2008-10-23 14:50 ` Daniel Gollub
2008-10-23 14:50 ` [patch 3/3] [ltp] Remove testcase for "Buffer size is not positive" in kernel/syscalls/readlink/readlink03 Daniel Gollub
2008-10-23 14:50 ` Daniel Gollub
[not found] ` <20081023145054.998439866-MHjlv9skyARbpigZmTR7Iw@public.gmane.org>
2008-10-24 22:53 ` [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall? Michael Kerrisk
2008-10-24 22:53 ` Michael Kerrisk
[not found] ` <cfd18e0f0810241553x77194611o11655a89871dc210-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-28 9:11 ` Andries E. Brouwer
2008-10-28 9:11 ` Andries E. Brouwer
2008-10-31 15:02 ` Kai Henningsen
2008-10-31 15:02 ` Kai Henningsen
[not found] ` <20081031160248.2b95d0e8-r49W/1Cwd2f9tVrXfjCyDJqJBGhVce5bs0AfqQuZ5sE@public.gmane.org>
2008-10-31 15:37 ` Daniel Gollub [this message]
2008-10-31 15:37 ` Daniel Gollub
[not found] ` <200810311637.25371.dgollub-l3A5Bk7waGM@public.gmane.org>
2008-11-04 16:20 ` Michael Kerrisk
2008-11-04 16:20 ` Michael Kerrisk
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=200810311637.25371.dgollub@suse.de \
--to=dgollub-l3a5bk7wagm@public.gmane.org \
--cc=aeb-ek1Qb6IBo2Pz+pZb47iToQ@public.gmane.org \
--cc=kai.extern-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ltp-list-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=mtk.manpages-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.