Bug 376455 - Solaris: unhandled syscall lgrpsys(180)
Summary: Solaris: unhandled syscall lgrpsys(180)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.11.0
Platform: Compiled Sources Solaris
: NOR crash
Target Milestone: ---
Assignee: Ivo Raisr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-13 18:36 UTC by Matthieu Longo
Modified: 2017-03-14 17:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch: add syscall wrapper for meminfo() + unit test (6.95 KB, application/mbox)
2017-02-13 18:36 UTC, Matthieu Longo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthieu Longo 2017-02-13 18:36:51 UTC
Created attachment 104019 [details]
patch: add syscall wrapper for meminfo() + unit test

Platform:
SunOS dell747srv 5.11 11.3 i86pc i386 i86pc Solaris

syscall meminfo() :
https://docs.oracle.com/cd/E23824_01/html/821-1463/meminfo-2.html#scrolltoc

==36267== Memcheck, a memory error detector
==36267== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==36267== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==36267== Command: test.elf
==36267== 
--36267-- WARNING: unhandled x86-solaris syscall: 180
--36267-- You may be able to write your own handler.
--36267-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--36267-- Nevertheless we consider this a bug.  Please report
--36267-- it at http://valgrind.org/support/bug_reports.html.

I tried to do a patch but I still get anoying errors.
I would need some advices so that I can finalize it.

Please find attached the patch and the unit test.
Comment 1 Ivo Raisr 2017-02-13 23:26:46 UTC
Thank you for the patch.

This syscall number (180) is used for a family of lgrpsys commands, of which LGRP_SYS_MEMINFO is subcode 0.
It will take a while to implement support for all subcodes.

To expedite the patch, you help if you run 'truss' on your native binary and grep for all lgrpsys invocations. This will reveal lgrpsys subcodes used by your application.
Comment 2 Ivo Raisr 2017-02-14 10:36:04 UTC
Fixed for LGRP_SYS_MEMINFO subcode in SVN r16224.
Comment 3 Matthieu Longo 2017-02-14 11:23:01 UTC
Please find below the "truss" of the native binary.

/1: lgrp_version(2)                 = 2
/1: _lgrpsys(1, 0)                  = 93
/1: _lgrpsys(3, 0x00000000, 0x00000000)     = 19140
/1: brk(0x237FF5C0)                 = 0x00000000
/1: brk(0x238035C0)                 = 0x00000000
/1: _lgrpsys(3, 0x00004AC4, 0x237FCBB0)     = 19140
/1: _lgrpsys(1, 0)                  = 93
Comment 4 Ivo Raisr 2017-02-14 11:55:02 UTC
Alright, so it means also subcodes LGRP_SYS_GENERATION(1) and LGRP_SYS_SNAPSHOT(3) need to be supported...
Comment 5 Ivo Raisr 2017-02-14 12:38:31 UTC
Additional subcodes for lgrpsys(180) syscall were added under SVN r16225.
Comment 6 Ivo Raisr 2017-02-15 15:22:23 UTC
Follow up SVN commit r16226.
Comment 7 Matthieu Longo 2017-02-15 16:15:17 UTC
I couldn't compile your code because of this include :
sys/lgrp_user_impl.h not found

Commenting it made the code compile and it seems to work fine in our use case now.

However we crash on another unimplemented syscall :
--00:00:06:20.881 8667-- WARNING: unhandled amd64-solaris syscall: fast:6
--00:00:06:20.881 8667-- You may be able to write your own handler.
--00:00:06:20.881 8667-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--00:00:06:20.881 8667-- Nevertheless we consider this a bug.  Please report
--00:00:06:20.881 8667-- it at http://valgrind.org/support/bug_reports.html.

I am going to open another ticket for that.
Comment 8 Ivo Raisr 2017-02-15 16:24:48 UTC
Please do 'svn update' so your source tree gets also revision r16226.
Then do './autogen.sh && ./configure && make --quiet check' again.
Comment 9 Matthieu Longo 2017-03-14 17:39:07 UTC
Fixes tested and validated on our side.
Thanks a lot.