From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11875 Path: news.gmane.org!.POSTED!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: RTC_RD_TIME Date: Wed, 30 Aug 2017 15:55:17 +0300 (MSK) Message-ID: References: <20170830014328.GB19925@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1504097736 27042 195.159.176.226 (30 Aug 2017 12:55:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 12:55:36 +0000 (UTC) User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) To: musl@lists.openwall.com Original-X-From: musl-return-11888-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 30 14:55:29 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dn2Wi-0006Qu-LH for gllmg-musl@m.gmane.org; Wed, 30 Aug 2017 14:55:24 +0200 Original-Received: (qmail 24119 invoked by uid 550); 30 Aug 2017 12:55:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 24098 invoked from network); 30 Aug 2017 12:55:29 -0000 In-Reply-To: <20170830014328.GB19925@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:11875 Archived-At: On Tue, 29 Aug 2017, Rich Felker wrote: > I don't know any good fix. The problem is that the glibc (and others') > ioctl function has a signature mismatching the standard one, with an > unsigned argument instead of signed, and the macro values are outside > the range of signed int. Fortunately the warning is harmless but > obviously it can impact builds with -Werror or policy about warnings.. Type confusion causes musl to wrongly pass sign-extended value to the kernel (instead of zero-extended). That's a real issue, and it's a bit disappointing you have not mentioned it. (BSD flavours as well as Linux have 'unsigned long' there, so I don't understand why it was ok for POSIX to document request type as 'int'; wouldn't it be appropriate for musl to just follow existing practice here rather than the letter of the standard?) Without changing the prototype, I think a possible fix is #ifdef __GNUC__ #define ioctl(fd, req, ...) ioctl(fd, (int)(req), ##__VA_ARGS__) #endif (plus a fix in ioctl.c for the sign extension issue) although I don't understand how the quoted warning appears; I can produce another one with -Wsign-conversion, but not this. Alexander