From patchwork Fri Jun 20 17:52:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 362309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F232C140078 for ; Sat, 21 Jun 2014 03:52:17 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=QIjqt7+Csa6MFxAiWg5OFNCcKResO LmUn5n5qE5rGpRkH5TdF6cXu5lq1nvMeI6qacj3kdusHkMnN1fHI7qjmm/VKHRks NM4xh+/c5dPSeAoXUjLNqx/4mbtgMYcUEepTtT8HcuhLSx6VmGBTe6wBs7upwcd5 GrKyaKAPWOO8k0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=8tMn4wjuz7R/wAgbR4ZaM9/BJYA=; b=RMw h6SdprnJo/Ea9d5oPsPnzNbE5vKpxlAwrMYEIdT3AYzNc6PLTPHTAfz8anVZlsCW TumIX5uiYOdhfewNEqNIJpvzKJBPkb3V/XxGi6NEjqDSf0ZCAmxV6yFuuSgqiG6a oELRoEMJx8evlmGpxIaVc3OVXiV8uJ4n/rLt1wAM= Received: (qmail 20519 invoked by alias); 20 Jun 2014 17:52:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 20435 invoked by uid 89); 20 Jun 2014 17:52:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Fri, 20 Jun 2014 17:52:02 +0000 From: "Joseph S. Myers" To: Subject: Remove __ASSUME_AT_RANDOM Message-ID: MIME-Version: 1.0 This patch removes __ASSUME_AT_RANDOM now it can be assumed to be true unconditionally. Tested x86_64 that the disassembly of installed shared libraries is unchanged by this patch. 2014-06-20 Joseph Myers * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_AT_RANDOM): Remove macro. * sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_setup_stack_chk_guard) [!__ASSUME_AT_RANDOM]: Remove conditional code. (_dl_setup_pointer_guard) [!__ASSUME_AT_RANDOM]: Likewise. diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h index af13438..fd82287 100644 --- a/sysdeps/unix/sysv/linux/dl-osinfo.h +++ b/sysdeps/unix/sysv/linux/dl-osinfo.h @@ -57,39 +57,17 @@ _dl_setup_stack_chk_guard (void *dl_random) unsigned char bytes[sizeof (uintptr_t)]; } ret; -#ifndef __ASSUME_AT_RANDOM - if (__glibc_unlikely (dl_random == NULL)) - { - const size_t filllen = sizeof (ret.bytes) - 1; - ret.num = 0; -# ifdef ENABLE_STACKGUARD_RANDOMIZE - int fd = open_not_cancel_2 ("/dev/urandom", O_RDONLY); - if (fd >= 0) - { - ssize_t reslen = read_not_cancel (fd, ret.bytes + 1, filllen); - close_not_cancel_no_status (fd); - if (reslen == (ssize_t) filllen) - return ret.num; - } -# endif - ret.bytes[filllen] = 255; - ret.bytes[filllen - 1] = '\n'; - } - else -#endif - { - /* We need in the moment only 8 bytes on 32-bit platforms and 16 - bytes on 64-bit platforms. Therefore we can use the data - directly and not use the kernel-provided data to seed a PRNG. */ - memcpy (ret.bytes, dl_random, sizeof (ret)); + /* We need in the moment only 8 bytes on 32-bit platforms and 16 + bytes on 64-bit platforms. Therefore we can use the data + directly and not use the kernel-provided data to seed a PRNG. */ + memcpy (ret.bytes, dl_random, sizeof (ret)); #if BYTE_ORDER == LITTLE_ENDIAN - ret.num &= ~(uintptr_t) 0xff; + ret.num &= ~(uintptr_t) 0xff; #elif BYTE_ORDER == BIG_ENDIAN - ret.num &= ~((uintptr_t) 0xff << (8 * (sizeof (ret) - 1))); + ret.num &= ~((uintptr_t) 0xff << (8 * (sizeof (ret) - 1))); #else # error "BYTE_ORDER unknown" #endif - } return ret.num; } @@ -97,18 +75,6 @@ static inline uintptr_t __attribute__ ((always_inline)) _dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) { uintptr_t ret; -#ifndef __ASSUME_AT_RANDOM - if (dl_random == NULL) - { - ret = stack_chk_guard; -# ifndef HP_TIMING_NONAVAIL - hp_timing_t now; - HP_TIMING_NOW (now); - ret ^= now; -# endif - } - else -#endif - memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); return ret; } diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 026f89f..913423f 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -165,9 +165,6 @@ /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */ #define __ASSUME_FUTEX_CLOCK_REALTIME 1 -/* Support for the AT_RANDOM auxiliary vector entry was added in 2.6.29. */ -#define __ASSUME_AT_RANDOM 1 - /* Support for preadv and pwritev was added in 2.6.30. */ #define __ASSUME_PREADV 1 #define __ASSUME_PWRITEV 1