[RTEMS Project] #3772: missaligned pointer dereference in cpukit/libnetworking/libc/res_query.c:131

RTEMS trac trac at rtems.org
Wed Jul 24 22:00:11 UTC 2019


#3772: missaligned pointer dereference in
cpukit/libnetworking/libc/res_query.c:131
---------------------------------------+---------------------
 Reporter:  Jeffrey Hill               |       Owner:  (none)
     Type:  defect                     |      Status:  new
 Priority:  normal                     |   Milestone:
Component:  admin                      |     Version:  4.11
 Severity:  normal                     |  Resolution:
 Keywords:  missaligned libnetworking  |  Blocked By:
 Blocking:                             |
---------------------------------------+---------------------

Comment (by Joel Sherrill):

 Are you compiling with any type of strict alignment flags?

 Is the stack itself properly aligned initially?

 I agree that it's an ugly solution but it is clear that you can't assume
 proper alignment of a byte buffer without either a union, compiler magic,
 or an attribute.  A union requires more modification of the software I
 think. RTEMS has this macro to help avoid compiler dependencies. I am
 almost OK with using it and the CPU_ALIGNMENT constant as the alignment.
 Are we sure 4 is a portable answer. What's the first field of HEADER?

 include/rtems/score/basedefs.h:  #define RTEMS_ALIGNED( _alignment )
 __attribute__((__aligned__(_alignment)))

--
Ticket URL: <http://devel.rtems.org/ticket/3772#comment:1>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list