# git rev-parse -q --verify 3a34b13a88caeb2800ab44a4918f230041b37dd9^{commit} 3a34b13a88caeb2800ab44a4918f230041b37dd9 already have revision, skipping fetch # git checkout -q -f -B kisskb 3a34b13a88caeb2800ab44a4918f230041b37dd9 # git clean -qxdf # < git log -1 # commit 3a34b13a88caeb2800ab44a4918f230041b37dd9 # Author: Linus Torvalds # Date: Fri Jul 30 15:42:34 2021 -0700 # # pipe: make pipe writes always wake up readers # # Since commit 1b6b26ae7053 ("pipe: fix and clarify pipe write wakeup # logic") we have sanitized the pipe write logic, and would only try to # wake up readers if they needed it. # # In particular, if the pipe already had data in it before the write, # there was no point in trying to wake up a reader, since any existing # readers must have been aware of the pre-existing data already. Doing # extraneous wakeups will only cause potential thundering herd problems. # # However, it turns out that some Android libraries have misused the EPOLL # interface, and expected "edge triggered" be to "any new write will # trigger it". Even if there was no edge in sight. # # Quoting Sandeep Patil: # "The commit 1b6b26ae7053 ('pipe: fix and clarify pipe write wakeup # logic') changed pipe write logic to wakeup readers only if the pipe # was empty at the time of write. However, there are libraries that # relied upon the older behavior for notification scheme similar to # what's described in [1] # # One such library 'realm-core'[2] is used by numerous Android # applications. The library uses a similar notification mechanism as GNU # Make but it never drains the pipe until it is full. When Android moved # to v5.10 kernel, all applications using this library stopped working. # # The library has since been fixed[3] but it will be a while before all # applications incorporate the updated library" # # Our regression rule for the kernel is that if applications break from # new behavior, it's a regression, even if it was because the application # did something patently wrong. Also note the original report [4] by # Michal Kerrisk about a test for this epoll behavior - but at that point # we didn't know of any actual broken use case. # # So add the extraneous wakeup, to approximate the old behavior. # # [ I say "approximate", because the exact old behavior was to do a wakeup # not for each write(), but for each pipe buffer chunk that was filled # in. The behavior introduced by this change is not that - this is just # "every write will cause a wakeup, whether necessary or not", which # seems to be sufficient for the broken library use. ] # # It's worth noting that this adds the extraneous wakeup only for the # write side, while the read side still considers the "edge" to be purely # about reading enough from the pipe to allow further writes. # # See commit f467a6a66419 ("pipe: fix and clarify pipe read wakeup logic") # for the pipe read case, which remains that "only wake up if the pipe was # full, and we read something from it". # # Link: https://lore.kernel.org/lkml/CAHk-=wjeG0q1vgzu4iJhW5juPkTsjTYmiqiMUYAebWW+0bam6w@mail.gmail.com/ [1] # Link: https://github.com/realm/realm-core [2] # Link: https://github.com/realm/realm-core/issues/4666 [3] # Link: https://lore.kernel.org/lkml/CAKgNAkjMBGeAwF=2MKK758BhxvW58wYTgYKB2V-gY1PwXxrH+Q@mail.gmail.com/ [4] # Link: https://lore.kernel.org/lkml/20210729222635.2937453-1-sspatil@android.com/ # Reported-by: Sandeep Patil # Cc: Michael Kerrisk # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc --version # < /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld --version # < git log --format=%s --max-count=1 3a34b13a88caeb2800ab44a4918f230041b37dd9 # < make -s -j 120 ARCH=arm O=/kisskb/build/linus_multi_v7_defconfig_arm-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- multi_v7_defconfig # < make -s -j 120 ARCH=arm O=/kisskb/build/linus_multi_v7_defconfig_arm-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- help # make -s -j 120 ARCH=arm O=/kisskb/build/linus_multi_v7_defconfig_arm-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- olddefconfig # make -s -j 120 ARCH=arm O=/kisskb/build/linus_multi_v7_defconfig_arm-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- In file included from /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.4/plugin/include/tm.h:23, from /kisskb/src/scripts/gcc-plugins/gcc-common.h:15, from /kisskb/src/scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3: /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.4/plugin/include/config/elfos.h:102:21: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\ ^ /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.4/plugin/include/config/elfos.h:170:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ ^ In file included from /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.4/plugin/include/tm.h:44, from /kisskb/src/scripts/gcc-plugins/gcc-common.h:15, from /kisskb/src/scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3: /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.4/plugin/include/defaults.h:126:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ ^ cc1plus: warning: unrecognized command line option '-Wno-format-diag' /kisskb/src/arch/arm/crypto/ghash-ce-glue.c: In function 'ghash_do_update': /kisskb/src/arch/arm/crypto/ghash-ce-glue.c:67:44: warning: passing argument 4 of 'pmull_ghash_update_p64' from incompatible pointer type pmull_ghash_update_p64(blocks, dg, src, key->h, head); ^ /kisskb/src/arch/arm/crypto/ghash-ce-glue.c:45:17: note: expected 'const u64 (*)[2]' but argument is of type 'u64 (*)[2]' asmlinkage void pmull_ghash_update_p64(int blocks, u64 dg[], const char *src, ^ /kisskb/src/arch/arm/crypto/ghash-ce-glue.c:69:43: warning: passing argument 4 of 'pmull_ghash_update_p8' from incompatible pointer type pmull_ghash_update_p8(blocks, dg, src, key->h, head); ^ /kisskb/src/arch/arm/crypto/ghash-ce-glue.c:48:17: note: expected 'const u64 (*)[2]' but argument is of type 'u64 (*)[2]' asmlinkage void pmull_ghash_update_p8(int blocks, u64 dg[], const char *src, ^ /kisskb/src/net/sched/sch_frag.c: In function 'sch_fragment': /kisskb/src/net/sched/sch_frag.c:93:10: warning: missing braces around initializer [-Wmissing-braces] struct rtable sch_frag_rt = { 0 }; ^ /kisskb/src/net/sched/sch_frag.c:93:10: warning: (near initialization for 'sch_frag_rt.dst') [-Wmissing-braces] /kisskb/src/drivers/firmware/qcom_scm-smc.c: In function '__scm_smc_call': /kisskb/src/drivers/firmware/qcom_scm-smc.c:95:9: warning: missing braces around initializer [-Wmissing-braces] struct arm_smccc_args smc = {0}; ^ /kisskb/src/drivers/firmware/qcom_scm-smc.c:95:9: warning: (near initialization for 'smc.args') [-Wmissing-braces] /kisskb/src/drivers/firmware/qcom_scm-legacy.c: In function 'scm_legacy_call': /kisskb/src/drivers/firmware/qcom_scm-legacy.c:139:9: warning: missing braces around initializer [-Wmissing-braces] struct arm_smccc_args smc = {0}; ^ /kisskb/src/drivers/firmware/qcom_scm-legacy.c:139:9: warning: (near initialization for 'smc.args') [-Wmissing-braces] Completed OK # rm -rf /kisskb/build/linus_multi_v7_defconfig_arm-gcc4.9 # Build took: 0:02:09.680663