[PATCH 2/2] test: verbatim character entry with CTRL-V

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Jan 25 11:45:11 CET 2020


On 1/25/20 12:43 AM, Tom Rini wrote:
> On Sun, Jan 12, 2020 at 05:33:39PM +0100, Heinrich Schuchardt wrote:
>
>> Provide a unit test checking that CTRL-V can be used to add control
>> characters to the line buffer.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>
> I don't know why but this test, run when built with clang fails.  A log
> is here: https://gitlab.denx.de/u-boot/u-boot/-/jobs/50540 but I saw it
> on Travis and Azure as well.
>

Hello Tom, hello Simon

when I clang U-Boot branch bisect-failure with in the Gitlab Docker
image and run

./u-boot -d arch/sandbox/dts/test.dtb
ut dm usb_keyb

the test runs fine.

When I run

valgrind ./u-boot -d arch/sandbox/dts/test.dtb
usb start
ut dm usb_keyb

I see more than 100 use-after-free errors.

dm_test_destroy() calling uclass_destroy() seems to be the culprit.

@Simon:
Why would we destroy any uclass in `ut dm` that was in use before
executing the command?

@Marek
Aren't usb_kbd_remove() and usb_kbd_deregister() essentially duplicate
coding?

==149271== Invalid write of size 4
==149271==    at 0x42CC04: usb_kbd_put_queue (usb_kbd.c:0)
==149271==    by 0x42CC04: usb_kbd_translate (usb_kbd.c:255)
==149271==    by 0x42C871: usb_kbd_irq_worker (usb_kbd.c:321)
==149271==    by 0x42C7DF: usb_kbd_poll_for_event (usb_kbd.c:358)
==149271==    by 0x42C7DF: usb_kbd_testc (usb_kbd.c:410)
==149271==    by 0x42EF60: console_tstc (console.c:206)
==149271==    by 0x50F302: dm_test_usb_keyb (usb.c:0)
==149271==    by 0x4F17B4: dm_do_test (test-main.c:103)
==149271==    by 0x4F1329: dm_test_main (test-main.c:180)
==149271==    by 0x4F1329: do_ut_dm (test-main.c:210)
==149271==    by 0x437A3B: cmd_call (command.c:576)
==149271==    by 0x437A3B: cmd_process (command.c:631)
==149271==    by 0x423DF2: run_pipe_real (cli_hush.c:1678)
==149271==    by 0x423DF2: run_list_real (cli_hush.c:1876)
==149271==    by 0x422FE2: run_list (cli_hush.c:2025)
==149271==    by 0x422FE2: parse_stream_outer (cli_hush.c:3217)
==149271==    by 0x423207: parse_file_outer (cli_hush.c:3300)
==149271==    by 0x436EAA: cli_loop (cli.c:221)
==149271==  Address 0xa681ca4 is 36 bytes inside a block of size 104 free'd
==149271==    at 0x4C30D3B: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==149271==    by 0x42C6C9: usb_kbd_remove (usb_kbd.c:676)
==149271==    by 0x442947: device_remove (device-remove.c:184)
==149271==    by 0x442910: device_chld_remove (device-remove.c:52)
==149271==    by 0x442910: device_remove (device-remove.c:175)
==149271==    by 0x442910: device_chld_remove (device-remove.c:52)
==149271==    by 0x442910: device_remove (device-remove.c:175)
==149271==    by 0x442910: device_chld_remove (device-remove.c:52)
==149271==    by 0x442910: device_remove (device-remove.c:175)
==149271==    by 0x4415DC: uclass_destroy (uclass.c:121)
==149271==    by 0x4F17DA: dm_test_destroy (test-main.c:72)
==149271==    by 0x4F17DA: dm_do_test (test-main.c:107)
==149271==    by 0x4F12CB: dm_test_main (test-main.c:169)
==149271==    by 0x4F12CB: do_ut_dm (test-main.c:210)
==149271==    by 0x437A3B: cmd_call (command.c:576)
==149271==    by 0x437A3B: cmd_process (command.c:631)
==149271==    by 0x423DF2: run_pipe_real (cli_hush.c:1678)
==149271==    by 0x423DF2: run_list_real (cli_hush.c:1876)
==149271==    by 0x422FE2: run_list (cli_hush.c:2025)
==149271==    by 0x422FE2: parse_stream_outer (cli_hush.c:3217)


Best regards

Heinrich


More information about the U-Boot mailing list