From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753378AbbIOJGs (ORCPT ); Tue, 15 Sep 2015 05:06:48 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35295 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753267AbbIOJGo convert rfc822-to-8bit (ORCPT ); Tue, 15 Sep 2015 05:06:44 -0400 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: Re: why is text address constant with full randomization? From: yalin wang In-Reply-To: Date: Tue, 15 Sep 2015 17:05:40 +0800 Cc: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <000AC074-2BC0-4361-A518-787ABAC1C9A2@gmail.com> References: To: =?utf-8?B?5oWV5Yas5Lqu?= X-Mailer: Apple Mail (2.3094) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 15, 2015, at 16:36, 慕冬亮 wrote: > > First, my linux kernel is Linux 114-212-83-136 4.1.0-2-amd64. > Second, I copy /bin/cat in system to mycat , and see the address space > layout below. > > mdl@114-212-83-136:~$ ./mycat /proc/self/maps > 00400000-0040c000 r-xp 00000000 08:03 1046776 > /home/mdl/mycat > 0060b000-0060c000 r--p 0000b000 08:03 1046776 > /home/mdl/mycat > 0060c000-0060d000 rw-p 0000c000 08:03 1046776 > /home/mdl/mycat > 01da7000-01dc8000 rw-p 00000000 00:00 0 > [heap] > ...... > > The starting address of executable image is constant with my aslr > configuration 2 (full randomization). > I think text segment should be inconstant to defeat the attack like > reusing text code! > Is it related to fixing offset2lib attack? > Thanks for any help! > - mudongliang your mycat elf is executable elf file, it is not possible to random the .text section address, only relocatable elf file can be random, you should build your elf with gcc -fPIC to make it relocatable . Thanks