This commit is contained in:
Pavel 2025-04-27 02:54:33 +03:00
parent 589a555449
commit 5b8f6ea40a
5 changed files with 41 additions and 20 deletions

View File

@ -443,7 +443,7 @@ begin
rbp:=Pointer(td^.td_frame.tf_rbp);
stack_addr:=nil;
while (QWORD(rbp) < QWORD($800000000000)) do
while (QWORD(rbp) < QWORD($800000000000)) do //sv_maxuser
begin
rip:=md_fuword(rbp[1]);
rbp:=md_fuword(rbp[0]);
@ -470,7 +470,7 @@ begin
begin
if (addr=0) then
begin
if ( (QWORD(stack_addr) - QWORD($7f0000000)) < QWORD($800000000)) then
if ( (QWORD(stack_addr) - QWORD($7f0000000)) < QWORD($800000000)) then //ET_DYN_LOAD_ADDR_SYS
begin
addr:=SCE_SYS_HEAP_START;
end else
@ -570,12 +570,7 @@ end;
function is_valid_entry(entry:vm_map_entry_t):Boolean; inline;
begin
case entry^.inheritance of
VM_INHERIT_PATCH:Result:=False;
VM_INHERIT_HOLE :Result:=False;
else
Result:=True;
end;
Result:=not (entry^.inheritance in [VM_INHERIT_PATCH,VM_INHERIT_HOLE]);
end;
function next_valid_entry(map:vm_map_t;entry:vm_map_entry_t):vm_map_entry_t;
@ -795,8 +790,7 @@ begin
if (p_proc.p_libkernel_start_addr > rip) or
(p_proc.p_libkernel___end_addr <= rip) then
begin
//if ((Int64(rip) - Int64($7f0000000)) < Int64($800000000)) then //ET_DYN_LOAD_ADDR_SYS
if (QWORD(rip)>=ET_DYN_LOAD_ADDR_SYS) and (QWORD(rip)<USRSTACK) then
if ((QWORD(rip) - QWORD($7f0000000)) < QWORD($800000000)) then //ET_DYN_LOAD_ADDR_SYS
begin
sdk_version_big_4ffffff:=true;
is_libsys_call :=true;

View File

@ -188,7 +188,7 @@ function self_load_section(imgp:p_image_params;
var cache:Pointer):Integer;
function is_system_path(path:pchar):Boolean;
function is_libc_or_fios(path:pchar):Boolean;
function is_libc_or_fios_sprx(path:pchar):Boolean;
function dynlib_basename(path:pchar):pchar;
implementation
@ -1240,10 +1240,10 @@ begin
end;
end;
function is_libc_or_fios(path:pchar):Boolean;
function is_libc_or_fios_sprx(path:pchar):Boolean;
const
c_libc='libc.';
c_libSceFios2='libSceFios2.';
c_libc='libc.sprx';
c_libSceFios2='libSceFios2.sprx';
var
f:pchar;
begin

View File

@ -2260,15 +2260,42 @@ begin
begin
budget:=p_proc.p_budget_ptype;
end else
if is_system_path(path) then
begin
if is_libc_or_fios(path) then
if ((PByte(@imgp^.authinfo.app_type)[7] and $f) = 1) then
begin
budget:=p_proc.p_budget_ptype;
if is_system_path(path) then
begin
budget:=PTYPE_SYSTEM;
if is_libc_or_fios_sprx(path) then
begin
budget:=p_proc.p_budget_ptype;
end;
end else
begin
budget:=p_proc.p_budget_ptype;
end;
end else
begin
budget:=PTYPE_SYSTEM;
if is_system_path(path) then
begin
budget:=PTYPE_SYSTEM;
if is_libc_or_fios_sprx(path) then
begin
budget:=p_proc.p_budget_ptype;
end;
end;
end;
end;
imgp^.hdr_e_type:=hdr^.e_type;

View File

@ -1309,7 +1309,7 @@ charged:
budget_id:=p_proc.p_budget_ptype;
if (vm_budget_reserve(p_proc.p_budget_ptype,field_malloc,__end-start)<>0) then
if (vm_budget_reserve(budget_id,field_malloc,__end-start)<>0) then
begin
Exit(KERN_RESOURCE_SHORTAGE);
end;

View File

@ -664,7 +664,7 @@ begin
rbp:=Pointer(td^.td_frame.tf_rbp);
stack_addr:=nil;
while (QWORD(rbp) < QWORD($800000000000)) do
while (QWORD(rbp) < QWORD($800000000000)) do //sv_maxuser
begin
rip:=md_fuword(rbp[1]);
rbp:=md_fuword(rbp[0]);
@ -924,7 +924,7 @@ _map:
td^.td_fpop:=fp;
maxprot:=maxprot and cap_maxprot;
if (((flags and MAP_SANITIZER) <> 0) and (addr < QWORD($800000000000))) then
if (((flags and MAP_SANITIZER) <> 0) and (addr < QWORD($800000000000))) then //sv_maxuser
begin
if (QWORD($fc00000000) < (addr + size)) then
begin