1
0
Fork 0
remarkable-linux/drivers/of
Daniel Kurtz 3a5465d0b6 earlycon: Use a pointer table to fix __earlycon_table stride
commit dd709e72cb upstream.

Commit 99492c39f3 ("earlycon: Fix __earlycon_table stride") tried to fix
__earlycon_table stride by forcing the earlycon_id struct alignment to 32
and asking the linker to 32-byte align the __earlycon_table symbol.  This
fix was based on commit 07fca0e57f ("tracing: Properly align linker
defined symbols") which tried a similar fix for the tracing subsystem.

However, this fix doesn't quite work because there is no guarantee that
gcc will place structures packed into an array format.  In fact, gcc 4.9
chooses to 64-byte align these structs by inserting additional padding
between the entries because it has no clue that they are supposed to be in
an array.  If we are unlucky, the linker will assign symbol
"__earlycon_table" to a 32-byte aligned address which does not correspond
to the 64-byte aligned contents of section "__earlycon_table".

To address this same problem, the fix to the tracing system was
subsequently re-implemented using a more robust table of pointers approach
by commits:
 3d56e331b6 ("tracing: Replace syscall_meta_data struct array with pointer array")
 6549864629 ("tracepoints: Fix section alignment using pointer array")
 e4a9ea5ee7 ("tracing: Replace trace_event struct array with pointer array")

Let's use this same "array of pointers to structs" approach for
EARLYCON_TABLE.

Fixes: 99492c39f3 ("earlycon: Fix __earlycon_table stride")
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Suggested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-01 12:58:24 -07:00
..
unittest-data .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
Kconfig mtd: Kill the OF_MTD Kconfig option 2016-09-23 09:35:16 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
address.c of: remove unused pci_space variable from address.c 2017-07-21 10:46:15 -05:00
base.c of: do not leak console options 2017-10-12 12:22:04 -05:00
device.c dma-mapping updates for 4.14: 2017-09-12 13:30:06 -07:00
dynamic.c of: Convert to using %pOF instead of full_name 2017-07-18 17:09:18 -05:00
fdt.c earlycon: Use a pointer table to fix __earlycon_table stride 2018-05-01 12:58:24 -07:00
fdt_address.c of: use pr_fmt prefix for all console printing 2016-07-18 16:57:42 -05:00
irq.c DeviceTree updates for 4.14: 2017-09-07 14:43:33 -07:00
of_mdio.c of_mdio: avoid MDIO bus removal when a PHY is missing 2018-03-03 10:24:37 +01:00
of_net.c of_net: factor out repetitive code from of_get_mac_address() 2015-03-29 08:56:17 +01:00
of_numa.c of: fix "/cpus" reference leak in of_numa_parse_cpu_nodes() 2017-04-18 11:04:12 -05:00
of_pci.c of_pci: use of_property_read_u32_array() 2017-07-24 10:00:52 -05:00
of_pci_irq.c OF/PCI: Update of_irq_parse_and_map_pci() comment 2017-07-02 16:14:28 -05:00
of_private.h of: find_node_by_full_name rewrite to compare each level 2017-06-22 12:38:29 -05:00
of_reserved_mem.c drivers: of: increase MAX_RESERVED_REGIONS to 32 2017-10-12 12:23:45 -05:00
overlay.c of: overlay: add overlay symbols to live device tree 2017-07-20 09:40:05 -05:00
pdt.c of: Eliminate of_allnodes list 2014-11-04 13:29:38 +00:00
platform.c of: Use PLATFORM_DEVID_NONE definition 2017-08-25 10:50:31 -05:00
property.c device property: preserve usecount for node passed to of_fwnode_graph_get_port_parent() 2017-10-12 12:26:14 -05:00
resolver.c of: find_node_by_full_name rewrite to compare each level 2017-06-22 12:38:29 -05:00
unittest.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00