403Webshell
Server IP : 103.18.247.38  /  Your IP : 216.73.217.101
Web Server : Apache
System : Linux server2.aznethosting.net 4.18.0-553.144.1.el8_10.x86_64 #1 SMP Tue Jul 14 09:26:58 EDT 2026 x86_64
User : gmbizz ( 1200)
PHP Version : 8.1.34
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/src/file_protector-1.1-1583/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/src/file_protector-1.1-1583/safe_kobject.h
/**
@file     safe_kobject.h
@brief    Safe kobject interop with sysfs
@details  Copyright (c) 2025 Acronis International GmbH
@author   Denis Kopyrin (denis.kopyrin@acronis.com)
@since    $Id: $
*/

#pragma once

#include <linux/completion.h>
#include <linux/kobject.h>

#ifdef KERNEL_MOCK
#include <mock/mock_types.h>
#endif

// The problem with kobject is that it is embedded in sysfs system.
// For regular monolith design it is not an issue but for unload code we do not want our callback to triggered.
// The common solution for this is to use waitable 'completion' that is invoked from 'release' instead of 'kfree'.

typedef struct safe_kobject_s {
	struct kobject kobj;
	struct completion complete;
} safe_kobject_t;

#define to_safe_kobject(_at) container_of(_at, safe_kobject_t, kobj)

static inline void safe_kobject_sysfs_release(struct kobject* obj)
{
    // TODO: Figure out why container_of does not work here
	safe_kobject_t* skobj = (safe_kobject_t*) obj;
	complete(&skobj->complete);
}

static inline void safe_kobject_init(safe_kobject_t* skobj)
{
    skobj->kobj = (struct kobject){};
    init_completion(&skobj->complete);
}

static inline void safe_kobject_del(safe_kobject_t* skobj)
{
    kobject_del(&skobj->kobj);
    kobject_put(&skobj->kobj);
    wait_for_completion(&skobj->complete);
}

Youez - 2016 - github.com/yon3zu
LinuXploit