[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH] Add __assert_fail from musl 1.1.19 .


  • To: minios-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Vlad Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Sat, 21 Mar 2020 01:37:05 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qyCAXnRwCCkuWo42qQVYMuttuNb+jxlZd06NmK2Uxs8=; b=Z6IvnkVL+IXwtcuj5d/kcjuBQy5d7mX55/bFEdET5qYs7eUGe68xPyVVYWjT0qHWvQ5sZN/6y7dbMa8R0az/f0pY8nWiuVsuSXHcXPtc9eUNru9hWbYnRW2mGrisMN6Qa1KoqGasU4SGU7heFaWpFgopdz5P+NPtz3FDFefcOfqzvohEPz7o7A0NvZzIoBp84xYcBUCX3YeKzkn1JVMdqA6TT+mIi5OzCPFiz+O0X850/c2a/yq4svu9h3aLfClWC19U/WWiaq3jz45s98AMI9hN1urdLJknb/B+759sMHkjUie5uwPZdTCP8bi8LziRlJUMS+UZMb2+aPH5DkMNEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sp4536ahM0V0ssMkOFn+qkx5HS9JzwG2OY4CujrqQk6nPfXyC5AVJpVVnh4TO/CoGGmPiHFhajvfgi1+uKkIikA28/uCy/1rweAarEuJEC73i0vFY4+H1RBI6IG+VMKncQEnz7iegdnNK+nKAW9sKIxxMZGNE5yNhJJX0Z2Py8+gkaSno0ox4YpS+N1qtWo2/pfW4j54ayWO/0dva4o0F8KWchmtVh9DYpeWQpSiSoQM3cqLhZW0NJ4Fw7OFPVT8GRRQtzYOqm58L02Ci854KnZphOPFfVqvQW9+I4x7MV4s3oRsfysfRs5tOGpbi7iEDMAbRUxetk1dyxuYvorvcw==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Delivery-date: Fri, 20 Mar 2020 23:37:15 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Hey Felipe,

Thank you Felipe. I have one comment that may be fixed inline.

Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>

On 19.03.2020 21:31, Felipe Huici wrote:
Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
---
  Makefile.uk                     | 1 +
  musl-imported/src/exit/assert.c | 9 +++++++++
  2 files changed, 10 insertions(+)
  create mode 100644 musl-imported/src/exit/assert.c

diff --git a/Makefile.uk b/Makefile.uk
index 8d683d8..82836e4 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -144,6 +144,7 @@ LIBNEWLIBGLUE_SRCS-y += 
$(LIBNEWLIBC_BASE)/musl-imported/src/misc/syslog.c
  LIBNEWLIBGLUE_SRCS-y += 
$(LIBNEWLIBC_BASE)/musl-imported/src/termios/tcsetattr.c
  LIBNEWLIBGLUE_SRCS-y += 
$(LIBNEWLIBC_BASE)/musl-imported/src/termios/tcgetattr.c
  LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/musl-imported/src/math/sincosl.c
+LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/musl-imported/src/exit/assert
ifeq ($(CONFIG_LIBNEWLIBC_CRYPT),y)
  LIBNEWLIBGLUE_CFLAGS-y   += -Wno-missing-braces -Wno-sign-compare 
-Wno-char-subscripts
diff --git a/musl-imported/src/exit/assert.c b/musl-imported/src/exit/assert.c
new file mode 100644
index 0000000..f897c68
--- /dev/null
+++ b/musl-imported/src/exit/assert.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+_Noreturn void __assert_fail(const char *expr, const char *file, int line, 
const char *func)

The _Noreturn attribute has been introduced in C11. Also, the code generated by gcc

for the _Noreturn trashes the stack frame[1]. I would suggest using  __attribute__((noreturn)).

(available in both GCC and clang)

[1] https://www.openwall.com/lists/musl/2016/08/30/1

+{
+  fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func, 
line);
+  fflush(NULL);
+  abort();
+}

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.