Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ SUDO := ${SUDO_${OS}}
ccflags-y := -DBIOSAPIERR_OFFSET=0
ccflags-y := -DUNAME_S=\"${OS}\"

# compile test for vmalloc workaround check for Linux >= 5.8
always-y += compile_test.o

all:
make -C $(KDIR) M=$(PWD) modules
make -C $(KDIR) M=$(PWD)/button modules
Expand Down
6 changes: 2 additions & 4 deletions api.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ static struct kprobe kp = {
typedef unsigned long (*kallsyms_lookup_name_t)(const char *name);
kallsyms_lookup_name_t fcn_kallsyms_lookup_name;

typedef void *(*fcn_vmalloc_node_range_t)(unsigned long size, unsigned long align,
unsigned long start, unsigned long end, gfp_t gfp_mask,
pgprot_t prot, unsigned long vm_flags, int node,
const void *caller);
#include "api_internals.h"

fcn_vmalloc_node_range_t fcn_vmalloc_node_range;
#endif

Expand Down
17 changes: 17 additions & 0 deletions api_internals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
/**
Author: Bjarne von Horn <vh@igh.de>
Copyright (C) 2024 IgH GmbH
*/
#ifndef __API_INTERNALS_H
#define __API_INTERNALS_H

#include <linux/vmalloc.h>

typedef void *(*fcn_vmalloc_node_range_t)(unsigned long size, unsigned long align,
unsigned long start, unsigned long end, gfp_t gfp_mask,
pgprot_t prot, unsigned long vm_flags, int node,
const void *caller);

#endif

18 changes: 18 additions & 0 deletions compile_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
/**
Compile test to ensure __vmalloc_node_range is a symbol and its arguments
Author: Bjarne von Horn <vh@igh.de>
Copyright (C) 2024 IgH GmbH
*/

#include <linux/version.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)

#include "api_internals.h"
#include <linux/vmalloc.h>


__attribute__((__used__)) fcn_vmalloc_node_range_t fcn_vmalloc_node_range_test = &__vmalloc_node_range;

#endif