From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Cc: Olaf Meeuwissen <paddy-hack@member.fsf.org>
Subject: Re: [musl] [BUG] ioctl: overflow in implicit constant conversion
Date: Mon, 20 Jan 2020 15:57:33 +0300 (MSK) [thread overview]
Message-ID: <alpine.LNX.2.20.13.2001201544180.7204@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20200120120930.GO23985@port70.net>
I'll reiterate points raised previously in https://www.openwall.com/lists/musl/2017/08/30/10
On Mon, 20 Jan 2020, Szabolcs Nagy wrote:
> this is a conformance bug, since posix specifies int.
>
> one could argue that linux requires unsigned long, but
> the correct way to introduce linux specific apis is to
> give them a different name, not something that clashes
> with standard names that have specified semantics.
But _why_ does POSIX specify 'int' there? Checking on freebsd.org
man pages I see that all BSD flavours had 'unsigned long' and Linux
followed that. Did POSIX fail to document prevailing practice in
this case?
I still think the warning points to a bigger problem that with
musl the kernel receives a sign-extended value.
So I think ioctl.c should be fixed to not sign-extend the value,
_IO macros could be changed to use (int)sizeof(c) instead of
sizeof(c), and if silencing -Wsign-conversion is also desired,
#ifdef __GNUC__
#define ioctl(fd, req, ...) ioctl(fd, (int)(req), ##__VA_ARGS__)
#endif
Alexander
next prev parent reply other threads:[~2020-01-20 12:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 10:39 Olaf Meeuwissen
2020-01-20 12:09 ` Szabolcs Nagy
2020-01-20 12:57 ` Alexander Monakov [this message]
2020-01-20 17:14 ` Rich Felker
2020-01-20 13:08 ` Alexander Monakov
2020-01-21 12:27 ` Olaf Meeuwissen
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=alpine.LNX.2.20.13.2001201544180.7204@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--cc=musl@lists.openwall.com \
--cc=paddy-hack@member.fsf.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).