Merge "epoll_create: reject size <= 0"
diff --git a/libc/arch-x86/atom/string/sse2-memset-atom.S b/libc/arch-x86/atom/string/sse2-memset-atom.S
index 30fb3f1..e03cd1a 100644
--- a/libc/arch-x86/atom/string/sse2-memset-atom.S
+++ b/libc/arch-x86/atom/string/sse2-memset-atom.S
@@ -113,11 +113,12 @@
#endif
ENTRY(__memset_chk)
- movl LEN(%esp), %ecx
- cmpl %ecx, CHK_DST_LEN(%esp)
- jbe memset
+ ENTRANCE
- jmp __memset_chk_fail
+ movl LEN(%esp), %ecx
+ cmpl CHK_DST_LEN(%esp), %ecx
+ ja __memset_chk_fail
+ jmp L(memset_length_loaded)
END(__memset_chk)
.section .text.sse2,"ax",@progbits
@@ -126,6 +127,7 @@
ENTRANCE
movl LEN(%esp), %ecx
+L(memset_length_loaded):
movzbl CHR(%esp), %eax
movb %al, %ah
/* Fill the whole EAX with pattern. */
diff --git a/libc/arch-x86/silvermont/string/sse2-memset-slm.S b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
index 0718fa7..f5182ba 100644
--- a/libc/arch-x86/silvermont/string/sse2-memset-slm.S
+++ b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
@@ -113,11 +113,12 @@
#endif
ENTRY(__memset_chk)
- movl LEN(%esp), %ecx
- cmpl %ecx, CHK_DST_LEN(%esp)
- jbe memset
+ ENTRANCE
- jmp __memset_chk_fail
+ movl LEN(%esp), %ecx
+ cmpl CHK_DST_LEN(%esp), %ecx
+ ja __memset_chk_fail
+ jmp L(memset_length_loaded)
END(__memset_chk)
.section .text.sse2,"ax",@progbits
@@ -126,6 +127,7 @@
ENTRANCE
movl LEN(%esp), %ecx
+L(memset_length_loaded):
cmp $0, %ecx
ja L(1byteormore)
SETRTNVAL
diff --git a/tests/getauxval_test.cpp b/tests/getauxval_test.cpp
index 6499f89..54458c4 100644
--- a/tests/getauxval_test.cpp
+++ b/tests/getauxval_test.cpp
@@ -67,7 +67,11 @@
// If this test fails, apps that use getauxval to decide at runtime whether crypto hardware is
// available will incorrectly assume that it isn't, and will have really bad performance.
// If this test fails, ensure that you've enabled COMPAT_BINFMT_ELF in your kernel configuration.
- ASSERT_NE(0UL, getauxval(AT_HWCAP2)) << "kernel not reporting AT_HWCAP2 to 32-bit ARM process";
+ // Note that 0 ("I don't support any of these things") is a legitimate response --- we need
+ // to check errno to see whether we got a "true" 0 or a "not found" 0.
+ errno = 0;
+ getauxval(AT_HWCAP2);
+ ASSERT_EQ(0, errno) << "kernel not reporting AT_HWCAP2 to 32-bit ARM process";
#else
GTEST_LOG_(INFO) << "This test is only meaningful for 32-bit ARM code.\n";
#endif