remove unsave uses of __builtin_return_address()
authorReto Achermann <reto.achermann@inf.ethz.ch>
Mon, 2 Oct 2017 05:51:34 +0000 (07:51 +0200)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Mon, 2 Oct 2017 05:51:34 +0000 (07:51 +0200)
calls to __builtin_return_address with values greather than 0 are
unsave. See https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00886.html

Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

include/arch/x86_64/barrelfish/lmp_chan_arch.h
include/arch/x86_64/barrelfish/syscall_arch.h
include/barrelfish/ump_impl.h
lib/barrelfish/arch/x86_64/debug.c
lib/barrelfish/capabilities.c
lib/barrelfish/monitor_client.c
lib/barrelfish/proc_mgmt_client.c
usr/drivers/e1000/e1000n.c
usr/mem_serv_dist/steal.c

index 0fb1f5e..a84cc3b 100644 (file)
@@ -43,10 +43,8 @@ static inline errval_t lmp_ep_send(struct capref ep, lmp_send_flags_t flags,
     capaddr_t send_cptr = get_cap_addr(send_cap);
 
     if(debug_notify_syscall) {
-        printf("memcached: lmp_ep_send while forbidden from %p, %p, %p\n",
-               __builtin_return_address(0),
-               __builtin_return_address(1),
-               __builtin_return_address(2));
+        printf("memcached: lmp_ep_send while forbidden from %p\n",
+               __builtin_return_address(0));
     }
 
 #ifndef TRACE_DISABLE_LRPC
index 0014a78..fd28683 100644 (file)
@@ -123,10 +123,8 @@ static inline struct sysret syscall(uint64_t num, uint64_t arg1, uint64_t arg2,
 {
     if(debug_notify_syscall && num == SYSCALL_INVOKE) {
         char str[256];
-        snprintf(str, 256, "Syscall while forbidden! from %p, %p, %p\n",
-                 __builtin_return_address(0),
-                 __builtin_return_address(1),
-                 __builtin_return_address(2));
+        snprintf(str, 256, "Syscall while forbidden! from %p\n",
+                 __builtin_return_address(0));
         BF_SYSCALL_BODY(SYSCALL_PRINT, (uint64_t)str, 256, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, "");
         return (struct sysret){/*error*/ SYS_ERR_ILLEGAL_SYSCALL, /*value*/ 0};
     }
index da77994..9a8d6f4 100644 (file)
@@ -194,14 +194,8 @@ static inline volatile struct ump_message *ump_impl_get_next(
 
 #ifdef __x86_64__
     if(debug_notify_syscall) {
-        printf("ump_impl_get_next while forbidden from %p, %p, %p, %p, %p, %p, %p\n",
-               __builtin_return_address(0),
-               __builtin_return_address(1),
-               __builtin_return_address(2),
-               __builtin_return_address(3),
-               __builtin_return_address(4),
-               __builtin_return_address(5),
-               __builtin_return_address(6));
+        printf("ump_impl_get_next while forbidden from %p\n",
+               __builtin_return_address(0));
     }
 #endif
 
index 1b28ea7..1eace7e 100644 (file)
@@ -99,8 +99,4 @@ void debug_print_save_area(arch_registers_state_t *state)
 void debug_return_addresses(void)
 {
     printf("return address = %p\n", __builtin_return_address(0));
-    printf("return address = %p\n", __builtin_return_address(1));
-    printf("return address = %p\n", __builtin_return_address(2));
-    printf("return address = %p\n", __builtin_return_address(3));
-    printf("return address = %p\n", __builtin_return_address(4));
 }
index f0c313e..f802636 100644 (file)
@@ -486,16 +486,8 @@ errval_t cnode_create_from_mem(struct capref dest, struct capref src,
 errval_t cnode_create(struct capref *ret_dest, struct cnoderef *cnoderef,
                       cslot_t slots, cslot_t *retslots)
 {
-    USER_PANIC("cnode_create deprecated; use cnode_create_l1, cnode_create_l2, or cnode_create_foreign_l2: %p %p %p %p\n",
-            __builtin_return_address(0),
-#ifdef __x86_64__
-            __builtin_return_address(1),
-            __builtin_return_address(2),
-            __builtin_return_address(3)
-#else
-            NULL, NULL, NULL
-#endif
-            );
+    USER_PANIC("cnode_create deprecated; use cnode_create_l1, cnode_create_l2, or cnode_create_foreign_l2: %p \n",
+            __builtin_return_address(0));
     return LIB_ERR_NOT_IMPLEMENTED;
 }
 
index dc9d15e..fb5ffcd 100644 (file)
@@ -23,7 +23,7 @@
 static void error_handler(struct monitor_binding *b, errval_t err)
 {
 #if defined(__x86_64__) || defined(__i386__)
-    debug_printf("%p %p %p %p\n", __builtin_return_address(0), __builtin_return_address(1),__builtin_return_address(2),__builtin_return_address(3));
+    debug_printf("%p\n", __builtin_return_address(0));
 #endif
     debug_err(__FILE__, __func__, __LINE__, err,
               "asynchronous error in monitor binding");
@@ -438,4 +438,4 @@ errval_t monitor_cap_identify_remote(struct capref cap, struct capability *ret)
     *ret = u.capability;
 
     return msgerr;
-}
\ No newline at end of file
+}
index 0761550..a205cae 100644 (file)
@@ -31,11 +31,7 @@ extern char **environ;
 static void error_handler(struct proc_mgmt_binding *b, errval_t err)
 {
 #if defined(__x86_64__) || defined(__i386__)
-    debug_printf("%p %p %p %p\n",
-                 __builtin_return_address(0),
-                 __builtin_return_address(1),
-                 __builtin_return_address(2),
-                 __builtin_return_address(3));
+    debug_printf("%p \n",  __builtin_return_address(0));
 #endif
     debug_err(__FILE__, __func__, __LINE__, err,
               "asynchronous error in proc_mgmt binding");
index a04edec..33e79ba 100644 (file)
@@ -652,8 +652,7 @@ static int add_desc(uint64_t paddr, void *opaque)
        //E1000_DEBUG("no space to add a new receive pbuf\n");
        printf("no space to add a new receive pbuf [%"PRIu32"], [%"PRIu32"]\n",
                 receive_free, receive_index);
-        printf("%p\n%p\n%p\n", __builtin_return_address(0),
-                __builtin_return_address(1), __builtin_return_address(2));
+        printf("%p\n", __builtin_return_address(0));
         abort();
        /* FIXME: how can you return -1 as error here
         * when return type is unsigned?? */
index a9469b5..761d987 100644 (file)
@@ -222,12 +222,7 @@ void try_steal(errval_t *ret, struct capref *cap, uint8_t bits,
 {
     printf("[%d][%"PRIuDOMAINID"]: failed percore alloc request: bits: %d going to STEAL\n",
             disp_get_core_id(), disp_get_domain_id(), bits);
-       printf("%p %p %p %p %p %p\n",   __builtin_return_address(0),
-                                                                       __builtin_return_address(1),
-                                                                       __builtin_return_address(2),
-                                                                       __builtin_return_address(3),
-                                                                       __builtin_return_address(4),
-                                                                       __builtin_return_address(5));
+       printf("%p\n",  __builtin_return_address(0));
     //DEBUG_ERR(*ret, "allocation of %d bits in 0x%" PRIxGENPADDR
     //           "-0x%" PRIxGENPADDR " failed", bits, minbase, maxlimit);
     *ret = steal_and_alloc(cap, bits+1, bits, minbase, maxlimit);