Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:41:26+00:00 2026-05-30T11:41:26+00:00

First off, let me apologize if I’m writing this in the wrong place. I

  • 0

First off, let me apologize if I’m writing this in the wrong place.
I can’t seem to find a valgrind users forum in which to post things of this nature, and since this place seems fairly all encompassing, I figured I’d try it out.

I have a somewhat unorthodox linux kernel I need to utilize when running my code.
I don’t know too much about the kernel, specifics since I didn’t write it.
My kernel, for whatever reason, looks like it extends the default linux kernel’s syscall table.
What appears to happen is that upon insmod of a .ko file, the current, standard syscall table is extended, starting at what appears to be 333, and going to 341, with the original syscall table being saved, and restored when the .ko is rmmoded.
These extra syscalls seem to perform some sort of unique IPC communication with
the proprietary software I am running.

Of course, this seems to play hell with valgrind.

I’d like to use valgrind to memcheck my programs of course, but valgrind always crashes
the instant my application performs a syscall.
Here is the output I get from valgrind, minus a few things I’d rather

==26045== Thread 2:
==26045== Syscall param preadv(vector) points to unaddressable byte(s)
==26045==    at 0x4000982: ??? (in /lib/ld-2.9.so)
==26045==    by 0x426C756: syscall (in /lib/libc-2.9.so)
==26045==    by 0x4037430: com_lock (coms.c:114)


--23932-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting
--23932-- si_code=1;  Faulting address: 0x165;  sp: 0x63a6dde4

valgrind: the 'impossible' happened:
   Killed by fatal signal
==23932==    at 0x3809D5E0: vgSysWrap_linux_sys_preadv_before (syswrap-linux.c:3413)
==23932==    by 0x380785CB: vgPlain_client_syscall (syswrap-main.c:1382)
==23932==    by 0x38076330: vgPlain_scheduler (scheduler.c:929)
==23932==    by 0x380A13E8: run_a_thread_NORETURN (syswrap-linux.c:98)
==23932==    by 0x380A1732: vgModuleLocal_start_thread_NORETURN (syswrap-linux.c:268)
==23932==    by 0x380A8AC8: ??? (in /usr/local/lib/valgrind/memcheck-x86-linux)

Unfortunately it is impossible for me to not use these extra syscalls.
The challenge I’m facing is how to deal with them.

What I’ve learned so far is that I can specify in valgrind new and or customized syscall wrappers. Unfortunately I don’t quite know how to pull that off when syscall addresses are getting all switched around during my runtime.

If anyone has any sort of experience writing valgrind syscall wrappers for syscalls they’ve added to their kernel that are non standard (and know how to tell valgrind to switch wrappers) please reply back with some details, references, anything. I’d really appreciate it.

I am using valgrind 3.7, with g++ 4.1.1 and a custom kernel built off 2.6.29 gentoo
(for all intents and purposes, it’s 2.6.29 gentoo until my proprietary kernel module is loaded)

Edit:

I have discovered a few more things relating to this since I first posted.
It appears that valgrind has a file called include/vki/vki-scnums-x86-linux.h.
According to the comments in it (valgrind 3.7.0 here remember), it’s more or less a cut and paste of asm-i386/unistd.h from a 2.6.9 kernel.
At instruction enumeration 333, __NR_preadv is defined.
For me, valgrind dies when it performs a syscall for something called my_ipc, which is a syscall unique to my kernel, enumerated at none other than 333.
It appears that there is a syscall mapping error between what valgrind was compiled against, and what is actually happening in the kernel. As such, the syscall wrapper valgrind tries to call when it sees syscall 333 can’t really handle syscall 333 since the function call signature probably doesn’t match up.

I think preadv looks like…

preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);

and from what I can tell, my ipc call looks like

asmlinkage long my_ipc (uint, long, long, long, long, long);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:41:27+00:00Added an answer on May 30, 2026 at 11:41 am

    Basically the only way you are going to resolve this is to modify valgrind to remove support for the system calls which clash with your custom ones and add at least minimal support for the custom system calls. As things stand valgrind is trying to interpret the arguments to the custom system call as if it was the standard system call that uses the same slot.

    The README_MISSING_SYSCALL_OR_IOCTL file in the root of the valgrind source tree is the best place to start for guidance on how to add a system call wrapper to valgrind.

    To answer your question about valgrind discussion forums, there are mailing lists, or the #valgrind IRC channel on freenode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, let me apologize if this has been asked already, but I can’t
First off, I'm not an expert with MySQL queries, and I can't seem to
First off let me apologize to the SO community for coming to you with
First off, I don't know if this is possible, but let me describe my
First off let me say this is my first ASP.NET project I have done.
First off, let me preface this question by stating that I'm really a pretty
First off, let me start by saying, I know this exact question has been
Let me start off by saying that this is my first real Cocoa app.
First off, let me apologize in advance for the extremely long question -- kudos
First, Let me apologize as I know NOTHING about ruby. I can read through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.