# git rev-parse -q --verify 3593030761630e09200072a4bd06468892c27be3^{commit} 3593030761630e09200072a4bd06468892c27be3 already have revision, skipping fetch # git checkout -q -f -B kisskb 3593030761630e09200072a4bd06468892c27be3 # git clean -qxdf # < git log -1 # commit 3593030761630e09200072a4bd06468892c27be3 # Author: Linus Torvalds # Date: Tue Feb 15 15:28:00 2022 -0800 # # tty: n_tty: do not look ahead for EOL character past the end of the buffer # # Daniel Gibson reports that the n_tty code gets line termination wrong in # very specific cases: # # "If you feed a line with exactly 64 chars + terminating newline, and # directly afterwards (without reading) another line into a pseudo # terminal, the the first read() on the other side will return the 64 # char line *without* terminating newline, and the next read() will # return the missing terminating newline AND the complete next line (if # it fits in the buffer)" # # and bisected the behavior to commit 3b830a9c34d5 ("tty: convert # tty_ldisc_ops 'read()' function to take a kernel pointer"). # # Now, digging deeper, it turns out that the behavior isn't exactly new: # what changed in commit 3b830a9c34d5 was that the tty line discipline # .read() function is now passed an intermediate kernel buffer rather than # the final user space buffer. # # And that intermediate kernel buffer is 64 bytes in size - thus that # special case with exactly 64 bytes plus terminating newline. # # The same problem did exist before, but historically the boundary was not # the 64-byte chunk, but the user-supplied buffer size, which is obviously # generally bigger (and potentially bigger than N_TTY_BUF_SIZE, which # would hide the issue entirely). # # The reason is that the n_tty canon_copy_from_read_buf() code would look # ahead for the EOL character one byte further than it would actually # copy. It would then decide that it had found the terminator, and unmark # it as an EOL character - which in turn explains why the next read # wouldn't then be terminated by it. # # Now, the reason it did all this in the first place is related to some # historical and pretty obscure EOF behavior, see commit ac8f3bf8832a # ("n_tty: Fix poll() after buffer-limited eof push read") and commit # 40d5e0905a03 ("n_tty: Fix EOF push handling"). # # And the reason for the EOL confusion is that we treat EOF as a special # EOL condition, with the EOL character being NUL (aka "__DISABLED_CHAR" # in the kernel sources). # # So that EOF look-ahead also affects the normal EOL handling. # # This patch just removes the look-ahead that causes problems, because EOL # is much more critical than the historical "EOF in the middle of a line # that coincides with the end of the buffer" handling ever was. # # Now, it is possible that we should indeed re-introduce the "look at next # character to see if it's a EOF" behavior, but if so, that should be done # not at the kernel buffer chunk boundary in canon_copy_from_read_buf(), # but at a higher level, when we run out of the user buffer. # # In particular, the place to do that would be at the top of # 'n_tty_read()', where we check if it's a continuation of a previously # started read, and there is no more buffer space left, we could decide to # just eat the __DISABLED_CHAR at that point. # # But that would be a separate patch, because I suspect nobody actually # cares, and I'd like to get a report about it before bothering. # # Fixes: 3b830a9c34d5 ("tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer") # Fixes: ac8f3bf8832a ("n_tty: Fix poll() after buffer-limited eof push read") # Fixes: 40d5e0905a03 ("n_tty: Fix EOF push handling") # Link: https://bugzilla.kernel.org/show_bug.cgi?id=215611 # Reported-and-tested-by: Daniel Gibson # Cc: Peter Hurley # Cc: Greg Kroah-Hartman # Cc: Jiri Slaby # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/xtensa-linux/bin/xtensa-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/xtensa-linux/bin/xtensa-linux-ld --version # < git log --format=%s --max-count=1 3593030761630e09200072a4bd06468892c27be3 # < make -s -j 24 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/xtensa-linux/bin/xtensa-linux- allmodconfig # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_SAMPLES=n # < make -s -j 24 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/xtensa-linux/bin/xtensa-linux- help # make -s -j 24 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/xtensa-linux/bin/xtensa-linux- olddefconfig # make -s -j 24 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/xtensa-linux/bin/xtensa-linux- /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:11.18-14.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x0: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:15.24-18.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x6000000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:19.24-22.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x6800000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:23.24-26.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x7fe0000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:11.18-14.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x0: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:15.24-18.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x6000000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:19.24-22.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x6800000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi:23.24-26.6: Warning (unit_address_format): /soc/flash@00000000/partition@0x7fe0000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:11.18-14.6: Warning (unit_address_format): /soc/flash@08000000/partition@0x0: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:15.23-18.6: Warning (unit_address_format): /soc/flash@08000000/partition@0x400000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:19.23-22.6: Warning (unit_address_format): /soc/flash@08000000/partition@0xa00000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:11.18-14.6: Warning (unit_address_format): /soc/flash@08000000/partition@0x0: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:23.23-26.6: Warning (unit_address_format): /soc/flash@08000000/partition@0xfe0000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:15.23-18.6: Warning (unit_address_format): /soc/flash@08000000/partition@0x400000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:19.23-22.6: Warning (unit_address_format): /soc/flash@08000000/partition@0xa00000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi:23.23-26.6: Warning (unit_address_format): /soc/flash@08000000/partition@0xfe0000: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi:11.18-14.6: Warning (unit_address_format): /soc/flash@08000000/partition@0x0: unit name should not have leading "0x" /kisskb/src/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi:15.23-18.6: Warning (unit_address_format): /soc/flash@08000000/partition@0x3f0000: unit name should not have leading "0x" WARNING: modpost: vmlinux.o(.text.unlikely+0x4540): Section mismatch in reference from the function __trace_event_discard_commit() to the variable .init.data:initcall_level_names The function __trace_event_discard_commit() references the variable __initdata initcall_level_names. This is often because __trace_event_discard_commit lacks a __initdata annotation or the annotation of initcall_level_names is wrong. WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14410): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14428): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14440): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14458): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14470): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14488): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x144a0): Section mismatch in reference from the variable qed_mfw_legacy_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_legacy_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x144f0): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14508): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14520): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14538): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14550): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14568): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14580): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qed/qed.o(.data+0x14598): Section mismatch in reference from the variable qed_mfw_ext_maps to the variable .init.rodata:qed_mfw_legacy_bb_100g The variable qed_mfw_ext_maps references the variable __initconst qed_mfw_legacy_bb_100g If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x4790): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x47a8): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x47c0): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x47d8): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x47f0): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x4808): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: modpost: drivers/net/ethernet/qlogic/qede/qede.o(.data+0x4820): Section mismatch in reference from the variable qede_forced_speed_maps to the variable .init.rodata:qede_forced_speed_100000 The variable qede_forced_speed_maps references the variable __initconst qede_forced_speed_100000 If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console Completed OK # rm -rf /kisskb/build/linus_xtensa-allmodconfig_xtensa-gcc11 # Build took: 0:29:27.613660