Project

General

Profile

Actions

Bug #833

open

memcpy of non-packed struct into packed struct (possible layout mismatch)

Added by Mathieu Desnoyers over 9 years ago. Updated 9 months ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Target version:
Start date:
09/09/2014
Due date:
% Done:

0%

Estimated time:

Description

lttng-tools src/lib/lttng-ctl/lttng-ctl.c:

lttng_enable_event_with_exclusions()

memcpy(&lsm.u.enable.event, ev, sizeof(lsm.u.enable.event));

copy "ev" (non-packed) into a packed structure.

We should copy each field one by one (create a copy_event_to_event_packed() helper to do so).

Actions #1

Updated by David Goulet over 9 years ago

  • Status changed from New to Feedback

How do you copy the union in the lttng_event field by field... ? That union contains non packed structure.

Actions #2

Updated by David Goulet over 9 years ago

  • Status changed from Feedback to Confirmed
  • Assignee deleted (David Goulet)

We need helper functions to copy field by field depending on the union type also.

Actions #3

Updated by Christian Babeux over 9 years ago

  • Target version set to 20
Actions #4

Updated by Christian Babeux over 9 years ago

  • Target version changed from 20 to 2.7
Actions #5

Updated by Michael Jeanson over 8 years ago

The "lttng_event" struct is not defined with the packed attribute, this attribute is only added when "lttng_event" is declared as a member of the "lttcomm_session_msg" struct. Adding the packed attribute to an already defined struct is ignored by the compiler, when it's done outside of a parent struct it generates a warning.

What this all means is that we are not copying a non-packed struct into a packed struct because there is no packed version of lttng_event. This also means we are using unpacked structures in the communication protocol between the client and the sessiond.

Actions #6

Updated by Jérémie Galarneau over 8 years ago

  • Target version changed from 2.7 to 2.8
Actions #7

Updated by Jérémie Galarneau almost 8 years ago

  • Target version changed from 2.8 to 2.9
Actions #8

Updated by Michael Jeanson about 2 years ago

  • Assignee set to Jonathan Rajotte Julien
  • Target version changed from 2.9 to 2.14
Actions #9

Updated by Erica Bugden 9 months ago

  • Assignee deleted (Jonathan Rajotte Julien)
Actions #10

Updated by Mathieu Desnoyers 9 months ago

This is a technical debt low-hanging fruit that we should do. It's not a complex task and would be a nice cleanup.

Actions

Also available in: Atom PDF