Skip Menu |
 

From: lxs@mit.edu
Subject: SVN Commit

Since we are copying from one structure to another, copy elements.
Using memcpy is fragile.

Commit By: lxs



Revision: 20499
Changed Files:
U trunk/src/lib/krb5/krb/gic_opt.c
Assigned to Tom for code review.
To: rt@krbdev.mit.edu
Subject: Re: [krbdev.mit.edu #6010] krb5int_gic_opte_copy should copy elements individually
From: Tom Yu <tlyu@MIT.EDU>
Date: Tue, 08 Jul 2008 19:40:03 -0400
RT-Send-Cc:
On most platforms, the memcpy() should work because the structure
layouts are identical for their initial overlapping elements. (The C
standard does not guarantee this.) On the Mac, the use of "#pragma
pack" could cause a difference in structure layout.

We need to investigate whether this constitutes an ABI change on the
Mac. Given that a caller can receive a new structure type-punned to
the old one, I believe it is an ABI change.
From: Ken Raeburn <raeburn@MIT.EDU>
To: rt-comment@krbdev.mit.edu
Subject: Re: [krbdev.mit.edu #6010] krb5int_gic_opte_copy should copy elements individually
Date: Wed, 9 Jul 2008 12:41:28 -0400
RT-Send-Cc:
On Jul 8, 2008, at 19:40, Tom Yu via RT wrote:
Show quoted text
> On most platforms, the memcpy() should work because the structure
> layouts are identical for their initial overlapping elements. (The C
> standard does not guarantee this.) On the Mac, the use of "#pragma
> pack" could cause a difference in structure layout.
>
> We need to investigate whether this constitutes an ABI change on the
> Mac. Given that a caller can receive a new structure type-punned to
> the old one, I believe it is an ABI change.

Yes, I believe it is as well. I think the only way to avoid that is a
Mac-specific "#pragma pack" for the extended version of the structure
too. It will have no effect on other platforms, and the only Mac code
it could break would be code trying to explicitly set one field after
the extended structure has been put into use, and somehow relying on
the fact that it *doesn't* set the intended field, but overwrites
something else. I won't lose any sleep over breaking such programs. :)

Ken
From: tlyu@mit.edu
Subject: SVN Commit

Use #pragma pop on the Mac to ensure that the krb5_gic_opt_ext
structure has the same layout as the public version.

Commit By: tlyu



Revision: 20511
Changed Files:
_U trunk/
U trunk/src/include/k5-int.h
From: tlyu@mit.edu
Subject: SVN Commit

Add comment and <TargetConditionals.h> to previous.

Commit By: tlyu



Revision: 20512
Changed Files:
_U trunk/
U trunk/src/include/k5-int.h