lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 Oct 2006 10:45:51 -0400
From:	Vivek Goyal <vgoyal@...ibm.com>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Andi Kleen <ak@...e.de>,
	linux kernel mailing list <linux-kernel@...r.kernel.org>,
	Reloc Kernel List <fastboot@...ts.osdl.org>, akpm@...l.org,
	horms@...ge.net.au, lace@...kratochvil.net, hpa@...or.com,
	magnus.damm@...il.com, lwang@...hat.com, dzickus@...hat.com,
	maneesh@...ibm.com
Subject: Re: [PATCH 3/12] i386: Force section size to be non-zero to prevent a symbol becoming absolute

On Wed, Oct 04, 2006 at 08:07:36AM -0600, Eric W. Biederman wrote:
> Andi Kleen <ak@...e.de> writes:
> 
> >>    /* writeable */
> >> @@ -64,6 +66,7 @@ SECTIONS
> >>  	*(.data.nosave)
> >>    	. = ALIGN(4096);
> >>    	__nosave_end = .;
> >> +	LONG(0)
> >>    }
> >>  
> >>    . = ALIGN(4096);
> >
> > You're wasting one full page once for each of these LONG(0)s because
> > of the following 4096 alignment.
> >
> > Isn't there some way to do this less wastefull?
> 
> So the problem is that we have sections that don't get relocated which
> confuses things.  If the first that happened was that the size was
> check to see if it was non-zero before we did anything I think we
> wouldn't care if the linker messed up in this way.
> 

Actually in this case if section size is zero, linker does not even
output that section and simply gets rid of it. What is left behind is
just the symbols (which were supposed to be section relative) and linker
just makes those symbols as absolute symbols. Absolute symbols are not 
to be relocated so patch just filters out those symbols and they don't
get relocated. So I am not sure where can I check the section size?

One other possible solution is that kernel code is written carefully 
so that we don't run into such problems even if absolute symbols don't
get relocated. For example, if there are two symbols A and B denoting
section start and end, always check if (A<B) before doing anything. Also
make sure that one is not trying to handle multiple sections at the same
time. For example, if A and B represents start and end for section 1
and C and D represent start and end for section 2 then one wants to 
free memory between A and D , then it should be done in two steps.

if (A<B)
	free_memory(A,B)
if (C<D)
	free_memory(C,D)

So this code will become safe even if symbols for empty sections become
absolute.  

But this looks to be very awkward solution.

Thanks
Vivek
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ