mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Ismael Luceno <ismael@iodev.co.uk>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] ioctl: Fix implicit constant conversion overflow
Date: Tue, 11 Jun 2024 21:02:28 +0200	[thread overview]
Message-ID: <ZmifRCsMf7Y7Wxa6@pirotess> (raw)
In-Reply-To: <20240610160408.GN10433@brightrain.aerifal.cx>

On 10/Jun/2024 12:04, Rich Felker wrote:
> On Mon, Jun 03, 2024 at 03:57:18AM +0200, Ismael Luceno wrote:
<...>
> > An explicit cast at _IOC instead would make sense to me, but what
> > could break in your opinion?
> 
> I'm not sure. It needs investigation. There might have been some
> concern with breakage from kernel headers that define ioctl numbers
> or something. I just remember this hasn't been as simple as it
> sounds from past times it came up..

The following headers use the _IOC macro:
	asm/zcrypt.h (on S390)
	asm-generic/ioctls.h
	linux/hiddev.h
	linux/hidraw.h
	linux/input.h
	linux/joystick.h
	linux/uinput.h
	linux/usbdevice_fs.h
	linux/vboxguest.h
	sound/sb16_csp.h
	xen/evtchn.h
	xen/gntalloc.h
	xen/gntdev.h
	xen/privcmd.h

None of these seem to pose a problem.

The only problem I see is if someone tried to cast it to a larger
signed type, which would be definitely a bug in their code, otherwise,
casting it to any unsigned type and back shoulld be fine.

Probably POSIX is wrong here, and it should be uint32_t for better
compatibility...

Thoughts?

      reply	other threads:[~2024-06-11 19:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01  1:03 Ismael Luceno
2024-06-01  2:34 ` Rich Felker
2024-06-02  3:01   ` Ismael Luceno
2024-06-02 22:50     ` Rich Felker
2024-06-03  1:57       ` Ismael Luceno
2024-06-10 16:04         ` Rich Felker
2024-06-11 19:02           ` Ismael Luceno [this message]

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=ZmifRCsMf7Y7Wxa6@pirotess \
    --to=ismael@iodev.co.uk \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /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).