From 924e5c54eb3e0fec1e70e05ac13133da40ee66c7 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 13 Feb 2019 15:47:33 +0100 Subject: [PATCH] core: fix RM-session upgrade mechanism This is a follow-up commit of "base/core: use references instead of pointers". Because the 'Rm_root::_upgrade_session' implementation lacked the 'override' keyword, my overzealous change of the pointer argument went unnoticed. This commit fixes the depot_rom (cached_fs_rom) failure in Sculpt. When cached_fs_rom attempted to create a new managed dataspace while the RM session quota was depleted, it tried to upgrade the session (via Rm_connection::create). However, the upgraded resources never reached the actual session because the default 'Root_component::_upgrade_session' was called instead of 'Rm_root::_upgrade_session'. Issue #3135 --- repos/base/src/core/include/rm_root.h | 4 ++-- repos/base/src/core/include/vm_root.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/repos/base/src/core/include/rm_root.h b/repos/base/src/core/include/rm_root.h index 294354bfea..2adaaa3f79 100644 --- a/repos/base/src/core/include/rm_root.h +++ b/repos/base/src/core/include/rm_root.h @@ -40,10 +40,10 @@ class Genode::Rm_root : public Root_component Rm_session_component(*this->ep(), *md_alloc(), _pager_ep, ram_quota); } - void _upgrade_session(Rm_session_component &rm, const char *args) + void _upgrade_session(Rm_session_component *rm, const char *args) override { size_t ram_quota = Arg_string::find_arg(args, "ram_quota").ulong_value(0); - rm.upgrade_ram_quota(ram_quota); + rm->upgrade_ram_quota(ram_quota); } public: diff --git a/repos/base/src/core/include/vm_root.h b/repos/base/src/core/include/vm_root.h index 8125f71439..598db12ebd 100644 --- a/repos/base/src/core/include/vm_root.h +++ b/repos/base/src/core/include/vm_root.h @@ -42,7 +42,7 @@ class Genode::Vm_root : public Root_component _ram_allocator, _local_rm); } - void _upgrade_session(Vm_session_component *vm, const char *args) + void _upgrade_session(Vm_session_component *vm, const char *args) override { vm->upgrade(ram_quota_from_args(args)); vm->upgrade(cap_quota_from_args(args));