Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Mistakes in glibc-2.0.7 includes
@ 1998-09-16  7:14 B. James Phillippe
  1998-09-17  4:58 ` Rui-Tao Dong ~{6-HpLN~}
  0 siblings, 1 reply; 4+ messages in thread
From: B. James Phillippe @ 1998-09-16  7:14 UTC (permalink / raw)
  To: Linux GNU libc list; +Cc: RedHat AXP list

Hello,

	I posted this information quite a while back but never got any
response.  I'd like to know what other folks think about this, if anyone
can please comment.

The problem is that some files in the glibc includes specify fixed-size
variables (u_int32_t, u_int16_t, etc) in places where natural-size
variables are required.  In particular, <netinet/ip_fw.h> specifies struct
ip_fw as such:

struct ip_fw {
  ...
  u_int16_t fw_nsp, fw_ndp;    /* N'of src ports and # of dst ports */
  ...
  u_int32_t fw_pcnt, fw_bcnt;    /* Packet and byte counters */
  ...
};

fw_nsp and fw_ndp show a proper usage of fixed-size variables, afterall, a
port number is specified to be 16 bits.  However, the variables fw_pcnt and
fw_bcnt are an explicit 32 bits.  The problem is subtle..  These same
values in the Linux kernel are specified as "unsigned long".  On x86,
u_int32_t and unsigned long coincidentally happen to be the same size, and
the bug is masked.  However, on Alpha (and presumably UltraSparc) unsigned
long is 64 bits.  Now the bug is apparent, because when networking tools
use the include from the glibc headers, the struct ip_fw has the wrong
size.  This can cause syscalls such as setsockopt() to fail -EINVAL.

The suggestion is to make variables which do not clearly require an
explicit size to use a natural size.  In the case I point out here, there
is no logical reason I can see to force a counter variable to a specific
number of bits.  Why limit architectures that are capable of better?

FWIW, this little bugger is the cause of the "ifpwadm does not work" on
RedHat-5.1 and several unaligned accesses in various other networking tools
(several in net-tools).  I suspect a similar problem with tcpdump also, but
have not yet investigated further.

thanks,
-bp
--
B. James Phillippe <bryan@terran.org>
Linux Software Engineer, WGTI.
http://earth.terran.org/~bryan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mistakes in glibc-2.0.7 includes
  1998-09-16  7:14 B. James Phillippe
@ 1998-09-17  4:58 ` Rui-Tao Dong ~{6-HpLN~}
  0 siblings, 0 replies; 4+ messages in thread
From: Rui-Tao Dong ~{6-HpLN~} @ 1998-09-17  4:58 UTC (permalink / raw)
  To: B. James Phillippe; +Cc: Linux GNU libc list, RedHat AXP list


>>>>> "b" == B James Phillippe <bryan@terran.org> writes:

 b> Hello,
 b> 	I posted this information quite a while back but never got any
 b> response.  I'd like to know what other folks think about this, if anyone
 b> can please comment.

 b> The problem is that some files in the glibc includes specify fixed-size
 b> variables (u_int32_t, u_int16_t, etc) in places where natural-size
 b> variables are required.  In particular, <netinet/ip_fw.h> specifies struct
 b> ip_fw as such:

 b> struct ip_fw {
 b>   ...
 b>   u_int16_t fw_nsp, fw_ndp;    /* N'of src ports and # of dst ports */
 b>   ...
 b>   u_int32_t fw_pcnt, fw_bcnt;    /* Packet and byte counters */
 b>   ...
 b> };

But how do I fix this (at least temporarily)?  I changed the include
file and recompiled ipfwadm.  There is not error running it, but
ipmasquerade still doesn't work.  Do I need to recompile the kernel
(2.0.35?) with these includes?  I tried with an older kernel (2.0.30)
with which ipmasquerade is known to work.  Still no luck. Or do I need
to recompile glibc?  I'm still using glibc from the original RH 5.1.
I'm running my UDB headless.  Does anyone know how to update lib rpms
remotely?  I used to know how to do update live libraries before rpms
made Linux so boring.

Regards,

Rui-Tao Dong ~{6-HpLN~}	<rdong@internetMCI.com>, Mission Viejo, California

PS. I have been using Linux since 0.99pl14 (i386 not axp).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mistakes in glibc-2.0.7 includes
       [not found] <Pine.LNX.3.96.980916221836.29860A-100000@earth.terran.org>
@ 1998-09-24  5:27 ` Rui-Tao Dong ~{6-HpLN~}
  1998-10-16  3:24 ` Rui-Tao Dong ~{6-HpLN~}
  1 sibling, 0 replies; 4+ messages in thread
From: Rui-Tao Dong ~{6-HpLN~} @ 1998-09-24  5:27 UTC (permalink / raw)
  To: B. James Phillippe; +Cc: axp-list


>>>>> "b" == B James Phillippe <bryan@terran.org> writes:

	........................................

 b> No, it should work.  I recompiled my ipfwadm with the fixed variables and
 b> it works fine now.  Perhaps your kernel does not have masquerading support?
 b> I know it works because my AS200 is masquerading the rest of the machines
 b> on my network just fine.

Really strange.  Are you using RH5.1 (glibc-2.0.7-13)?  My old kernel
with which masquerading worked under RH4.2 doesn't like to forward
packets.  One twist is that I also use IP aliasing, but that part seem 
to work just fine.

Regards,

Rui-Tao Dong ~{6-HpLN~}	<rdong@internetMCI.com>, Mission Viejo, California




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mistakes in glibc-2.0.7 includes
       [not found] <Pine.LNX.3.96.980916221836.29860A-100000@earth.terran.org>
  1998-09-24  5:27 ` Mistakes in glibc-2.0.7 includes Rui-Tao Dong ~{6-HpLN~}
@ 1998-10-16  3:24 ` Rui-Tao Dong ~{6-HpLN~}
  1 sibling, 0 replies; 4+ messages in thread
From: Rui-Tao Dong ~{6-HpLN~} @ 1998-10-16  3:24 UTC (permalink / raw)
  To: B. James Phillippe; +Cc: axp-list


>>>>> "b" == B James Phillippe <bryan@terran.org> writes:

 b> No, it should work.  I recompiled my ipfwadm with the fixed variables and
 b> it works fine now.  Perhaps your kernel does not have masquerading support?
 b> I know it works because my AS200 is masquerading the rest of the machines
 b> on my network just fine.

Well, I upgraded my glibc to 2.0.7-19 and downgraded net-tools to
1.33-4 before I finally figured out that I didn't have ip forwarding
enabled in the kernel.  Doing

echo 1 > /proc/sys/net/ipv4/ip_forward

solved all of my problems.  Using the UDB instead of a 486 to do the
masquerade also fixed Netscape's DNS problem.

BTW, upgrading glibc got me into real trouble.  Somehow a couple of
critial libraries were not installed, and that leaves the system
almost dead. (I'm running my UDB headless.)  Fortunately, I have a DU
copy of XEmacs, which doesn't use these libraries.  I could still do
copy-file, rename-file, make-symbolic-link, etc, (but no dired).  I use
an nfs partition to set uid root on XEmacs and fixed the libraries.

Regards,

Rui-Tao Dong ~{6-HpLN~}	<rdong@internetMCI.com>, Mission Viejo, California


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-10-16  3:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.3.96.980916221836.29860A-100000@earth.terran.org>
1998-09-24  5:27 ` Mistakes in glibc-2.0.7 includes Rui-Tao Dong ~{6-HpLN~}
1998-10-16  3:24 ` Rui-Tao Dong ~{6-HpLN~}
1998-09-16  7:14 B. James Phillippe
1998-09-17  4:58 ` Rui-Tao Dong ~{6-HpLN~}

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox