Changeset 15084


Ignore:
Timestamp:
Nov 21, 2011, 8:17:00 AM (8 years ago)
Author:
gb
Message:

Trying to allocate a very large vector in _SPmisc_alloc could cause
tcr.save_allocptr to become negative; we do an unsigned comparison
with tcr.save_allocbase and would think that the allocation succeeded
in that case.

"very large" depends on IMAGE_BASE_ADDRESS (+ a few 100 GB); it's
something over 50 TB on most x8664 platforms or about 130GB on Win64.
It -might- be worth trying to do the allocation another way someday.
For now, just report that the allocation attempt failed and don't
get confused by the fact that the freepointer wrapped around address 0
and became either negative or very, very positive.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-spentry64.s

    r14993 r15084  
    28392839local_label(misc_alloc_alloc_vector):   
    28402840        __(dnode_align(%imm1,node_size,%imm1))
     2841        __(ref_global(tenured_area,%arg_x))
     2842        __(cmpq area.low(%arg_x),%imm1)
     2843        __(ja local_label(misc_alloc_large))
    28412844        __(Misc_Alloc(%arg_z))
    28422845        __(ret)
    28432846local_label(misc_alloc_not_u56):
    28442847        __(uuo_error_reg_not_type(Rarg_y,error_object_not_unsigned_byte_56))
     2848local_label(misc_alloc_large):
     2849        /* If we tried to subtract %imm1 from tcr.allocptr, it
     2850           might become negative ; we treat addresses as being unsigned,
     2851           so that negative value would look like a very large unsigned
     2852           value and we'd think that the allocation succeeded.
     2853           If we reach this point, we're trying to allocate something
     2854           very large indeed.  Depending on the platform, that's anywhere
     2855           from hundreds of GB to hundreds of TB.  Someday, it might be
     2856           worth trying that (using a special "large allocation" UUO);
     2857           for now, it's probably safe to just report that a memory
     2858           allocation attempt failed.
     2859        */
     2860        __(movq $XMEMFULL,%arg_z)
     2861        __(set_nargs(1))
     2862        __(jmp _SPksignalerr)
    28452863_endsubp(misc_alloc)
    28462864
Note: See TracChangeset for help on using the changeset viewer.