New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ioctl: possible memory corruption error on formerly valid code #8280
Comments
From chowes@kirk.clients.pkts.caCreated by chperl@pkts.caHi... I have a program that uses ioctl to check the status of a serial Possible memory corruption: ioctl overflowed 3rd argument at dotemp line I then got an example program for ioctl, from the man page perlfaq8, Possible memory corruption: ioctl overflowed 3rd argument at dowinsize #!/usr/bin/perl The example program works fully under perl 5.8.0. Perl Info
|
From @gisleCharles Howes (via RT) <perlbug-followup@perl.org> writes:
On my Gentoo box this program also breaks with blead. I tracked it I suggest that we contiue to provide as least 256 byte buffer to --Gisle Change 25852 by rgs@bloom on 2005/10/26 09:37:25 Subject: [perl #37535] [PATCH] ioctl IOCPARM_LEN(x) should be _IOC_SIZE(x) on Linux, not 256 Affected files ... ... //depot/perl/perl.h#638 edit Differences ... ==== //depot/perl/perl.h#638 (text) ==== Inline Patch--- perl/perl.h.~1~ Fri Jan 13 12:26:06 2006
+++ perl/perl.h Fri Jan 13 12:26:06 2006
@@ -2959,11 +2959,16 @@
#ifndef IOCPARM_LEN
# ifdef IOCPARM_MASK
- /* on BSDish systes we're safe */
+ /* on BSDish systems we're safe */
# define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
# else
+# if defined(_IOC_SIZE) && defined(__GLIBC__)
+ /* on Linux systems we're safe */
+# define IOCPARM_LEN(x) _IOC_SIZE(x)
+# else
/* otherwise guess at what's safe */
-# define IOCPARM_LEN(x) 256
+# define IOCPARM_LEN(x) 256
+# endif
# endif
#endif
End of Patch. |
The RT System itself - Status changed from 'new' to 'open' |
From @rgsGisle Aas wrote:
Well, this patch comes from Fedora : https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=171111
OK, but that looks like working around a glibc bug. |
From @gisleRafael Garcia-Suarez <rgarciasuarez@mandriva.com> writes:
Perhaps. Is _IOC_SIZE() supposed to be part of the public API? The TIOCGWINSZ constant is 0x5413 on my system. _IOC_SIZE() basically --Gisle |
From @gisleGisle Aas <gisle@ActiveState.com> writes:
I've now applied the following patch to blead, and I do recommend it An alternative could be to only grow IOCPARM_LEN() when _IOC_SIZE --Gisle Change 26815 by gisle@gisle-ask on 2006/01/13 12:10:28 Fix [perl #38223]; _IOC_SIZE() not always safe. Affected files ... ... //depot/perl/perl.h#657 edit Differences ... ==== //depot/perl/perl.h#657 (text) ==== Inline Patch--- perl/perl.h.~1~ Fri Jan 13 04:10:49 2006
+++ perl/perl.h Fri Jan 13 04:10:49 2006
@@ -2977,8 +2977,8 @@
# define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
# else
# if defined(_IOC_SIZE) && defined(__GLIBC__)
- /* on Linux systems we're safe */
-# define IOCPARM_LEN(x) _IOC_SIZE(x)
+ /* on Linux systems we're safe; except when we're not [perl #38223] */
+# define IOCPARM_LEN(x) (_IOC_SIZE(x) < 256 ? 256 : _IOC_SIZE(x))
# else
/* otherwise guess at what's safe */
# define IOCPARM_LEN(x) 256
End of Patch. |
@rgs - Status changed from 'open' to 'resolved' |
From iankko@mail.muni.cz
Have run the test script: (from this page) #!/usr/bin/perl on 3 systems with 3 format of the "perl.h" file: 1, perl 5.8.8 ./test.perl Form of the patch: #ifndef IOCPARM_LEN 2, perl 5.8.6 ./test.perl Form of the patch: #ifndef IOCPARM_LEN => seems it's enough to hardly set the value of IOCPARM_LEN(x) to 256 3, perl 5.8.6 ./test.perl => FAIL Form of the patch: #ifndef IOCPARM_LEN This patch doesn't work. So the solution is either to use patch without the linux branch, and hardly |
Migrated from rt.perl.org#38223 (status was 'resolved')
Searchable as RT38223$
The text was updated successfully, but these errors were encountered: