After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776117 - False positives in sandboxing restrictions
False positives in sandboxing restrictions
Status: RESOLVED OBSOLETE
Product: tracker
Classification: Core
Component: General
1.10.x
Other Linux
: Normal major
: ---
Assigned To: tracker-general
tracker-general
: 776271 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-12-14 23:58 UTC by Phil Reilly
Modified: 2021-05-26 22:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Core Dump (1.49 MB, application/octet-stream)
2016-12-14 23:58 UTC, Phil Reilly
  Details
Core Dump (1.58 MB, application/octet-stream)
2016-12-14 23:59 UTC, Phil Reilly
  Details
Core Dump (1.58 MB, application/octet-stream)
2016-12-15 00:00 UTC, Phil Reilly
  Details
System startup core dump. (1.58 MB, application/x-lz4)
2016-12-15 00:42 UTC, Phil Reilly
  Details
GDB debug info (31.28 KB, text/plain)
2016-12-15 03:12 UTC, Phil Reilly
  Details
Tracker GDB Startup (30.23 KB, application/octet-stream)
2016-12-15 03:29 UTC, Phil Reilly
  Details
libtracker-common: Whitelist *64() stat/getdents syscalls (1.12 KB, patch)
2016-12-15 11:20 UTC, Carlos Garnacho
committed Details | Review
libtracker-common: Whitelist more syscalls used on non-x86_64 arches (1.75 KB, patch)
2016-12-15 18:14 UTC, Carlos Garnacho
committed Details | Review
Core dump after patched 1 (21.79 KB, application/octet-stream)
2016-12-16 22:41 UTC, Phil Reilly
  Details
Another dump after new versions installed. (3.88 KB, application/octet-stream)
2016-12-16 22:42 UTC, Phil Reilly
  Details
libtracker-common: Whitelist gettimeofday() syscall (806 bytes, patch)
2016-12-17 12:05 UTC, Carlos Garnacho
committed Details | Review
libtracker-common: Handle mlock*/munlock* syscalls (1.32 KB, patch)
2016-12-21 16:06 UTC, Carlos Garnacho
committed Details | Review
libtracker-common: Allow querying process stats/limits (870 bytes, patch)
2016-12-21 16:15 UTC, Carlos Garnacho
committed Details | Review
patch for gstreamer v4l2 plugin and plugin scanner (1.88 KB, patch)
2018-02-25 16:01 UTC, Chris HORLER
none Details | Review
tracker 1.12 -> 1.8 calls alignment (3.28 KB, patch)
2018-02-25 16:03 UTC, Chris HORLER
none Details | Review

Description Phil Reilly 2016-12-14 23:58:13 UTC
Created attachment 341984 [details]
Core Dump

System disk is a USB. When I copy from another USB drive to the USB system disk core dumps repeatedly.
Comment 1 Phil Reilly 2016-12-14 23:59:24 UTC
Created attachment 341985 [details]
Core Dump
Comment 2 Phil Reilly 2016-12-15 00:00:04 UTC
Created attachment 341987 [details]
Core Dump
Comment 3 Phil Reilly 2016-12-15 00:42:47 UTC
Created attachment 341990 [details]
System startup core dump.

This core dump happens at system start.
Comment 4 Carlos Garnacho 2016-12-15 01:37:28 UTC
Thanks for the bug report. It would be great if you could obtain the backtraces through:

$ gdb /usr/libexec/tracker-extract ./core.tracker-extract...
(gdb) t a a bt

And paste those here. I have neither your same version, dependencies nor architecture, so can't get much info of the coredump files you attached.
Comment 5 Phil Reilly 2016-12-15 02:17:36 UTC
This system disk is only 16gb with less than 4gb free. It this be a problem? Can I set preferences to consider this?
Comment 6 Phil Reilly 2016-12-15 03:12:13 UTC
Created attachment 341997 [details]
GDB debug info

Here is one if u need more say so.
Comment 7 Phil Reilly 2016-12-15 03:29:15 UTC
Created attachment 341998 [details]
Tracker GDB Startup

Known dump from startup.
Comment 8 Carlos Garnacho 2016-12-15 11:19:18 UTC
Thanks, that was useful. Turns out your 32bit arch triggers false positives in the brand new extraction sandbox, so the process terminates with SIGSYS due to "invalid" syscalls being performed. I only have 64bit installs around, so didn't see this.

I'm attaching/pushing a patch that whitelists syscalls that might be useful there, however the bug will remain open in the hope that you can confirm you no longer get crashes with the patch, if not I'll eventually setup a 32bit VM and try there myself.
Comment 9 Carlos Garnacho 2016-12-15 11:20:00 UTC
Created attachment 342010 [details] [review]
libtracker-common: Whitelist *64() stat/getdents syscalls

Those variants may end up called depending on architecture and other
factors, there's no reason for those to be blacklisted.
Comment 10 Carlos Garnacho 2016-12-15 11:23:51 UTC
Comment on attachment 342010 [details] [review]
libtracker-common: Whitelist *64() stat/getdents syscalls

Attachment 342010 [details] pushed as 14f77ae - libtracker-common: Whitelist *64() stat/getdents syscalls
Comment 11 Phil Reilly 2016-12-15 13:18:34 UTC
If you want me to apply a patch you're gonna have to give me some guidance since I'm a noob when it comes to patching.
Comment 12 Carlos Garnacho 2016-12-15 18:14:07 UTC
Created attachment 342036 [details] [review]
libtracker-common: Whitelist more syscalls used on non-x86_64 arches

These ones were spotted after compiling Tracker on i686.
Comment 13 Phil Reilly 2016-12-15 18:50:53 UTC
Will I see this in the repository soon?
Comment 14 Phil Reilly 2016-12-15 19:18:26 UTC
....also launching the gnome-photos app causes repetitive core dumps.
Comment 15 Carlos Garnacho 2016-12-15 23:04:33 UTC
All fixes are now in git. This IMO warrants new Tracker releases
which I'll do tomorrow. I guess/hope your distro of choice should
pick up those soon.

As for the gnome-photos issue, that sounds entirely unrelated.
This extractor sandbox is specific to the tracker-extract daemon.
I suggest you file a separate bug addressed to gnome-photos.

Attachment 342036 [details] pushed as fff1ba0 - libtracker-common: Whitelist more syscalls used on non-x86_64 arches
Comment 16 Phil Reilly 2016-12-15 23:39:09 UTC
It may be related since gnome-photos seems to be indexing photos with Tracker? I'll wait to see if the update takes care of it before filing a bug report.
Comment 17 Phil Reilly 2016-12-15 23:52:34 UTC
Thanks for your prompt response to this issue, I'll test as soon as I get the update & post my results on this open bug report.
Comment 18 Debarshi Ray 2016-12-16 13:02:38 UTC
(In reply to Phil Reilly from comment #14)
> ....also launching the gnome-photos app causes repetitive core dumps.

What is crashing? Is gnome-photos itself crashing? Or is it causing a tracker process to crash?
Comment 19 Carlos Garnacho 2016-12-16 13:32:52 UTC
FWIW 1.10.3 and 1.8.2 are already out.
Comment 20 Phil Reilly 2016-12-16 16:31:43 UTC
(In reply to Debarshi Ray from comment #18)
> (In reply to Phil Reilly from comment #14)
> > ....also launching the gnome-photos app causes repetitive core dumps.
> 
> What is crashing? Is gnome-photos itself crashing? Or is it causing a
> tracker process to crash?

gnome-photos not dumping.

Multiple triggers causing tracker core dumps probably not limited to:
1. system startup/login
2. usb file transfer to system
3. launching gnome-photos as it indexes user's photos

& I'm guessing there are more.


I'm waiting to update before openening more bug reports.
Comment 21 Phil Reilly 2016-12-16 22:41:33 UTC
Created attachment 342089 [details]
Core dump after patched 1

Dump after new versions installed. Dumps keep coming & had to uninstall tracker.
Comment 22 Phil Reilly 2016-12-16 22:42:39 UTC
Created attachment 342090 [details]
Another dump after new versions installed.

Dump after new versions installed. Dumps keep coming & had to uninstall tracker.
Comment 23 Carlos Garnacho 2016-12-17 12:05:35 UTC
Created attachment 342117 [details] [review]
libtracker-common: Whitelist gettimeofday() syscall
Comment 24 Carlos Garnacho 2016-12-17 12:06:25 UTC
Comment on attachment 342117 [details] [review]
libtracker-common: Whitelist gettimeofday() syscall

Attachment 342117 [details] pushed as 88cfdc5 - libtracker-common: Whitelist gettimeofday() syscall
Comment 25 Carlos Garnacho 2016-12-17 13:19:45 UTC
Hi Phil,

I think at this point it might be better if you tried compiling Tracker yourself, as it's going to be very spotty otherwise... You might (and seem to) hit some files that use plugins I don't run into with my testing data set, as soon as one of those plugins does a syscall that is not observed in the sandbox, this would keep happening.

I would recommend jhbuild for the task, it's the helper script many gnome devs use to compile (parts of) the gnome platform, it will clone/update git repos to a directory in your home folder, compile orderly and install to another directory in your home folder. You can then run manually run things from that directory, and eventually delete it altogether without affecting your base install.

There's instructions to set up jhbuild at https://wiki.gnome.org/Newcomers/BuildGnome , some more specific steps after you got it working are:

1) Make sure you install -devel/-dev packages for some tracker dependencies, besides the basic dependencies listed in that wiki page, those would include: libjpeg, giflib, gstreamer1, poppler-glib, totem-pl-parser, icu, upower, sqlite.

If you get those right, you might be able to build only tracker, doing:

  $ jhbuild buildone tracker

Otherwise you might just compile most of these deps from git too doing:

  $ jhbuild build tracker

That should greatly reduce the number of -devel packages you need installed, but would take some more time.

2) Additionally, install strace, it will give us in a clearer way the same info I've been deducing from your backtraces.

3) Once tracker is built, it will be easier to reinstall tracker in your system and only run the tracker-extract executable from inside the jhbuild environment, you'd do in one terminal tab:

  $ tracker daemon -s
  $ killall -15 tracker-extract ; strace -f ~/jhbuild/install/libexec/tracker-extract 2>&1 | grep SIGSYS

  That will restart daemons, and replace the tracker-extract process with the one you just compiled, running through strace will produce a line similar to this whenever the process terminates due to this reason:

[pid 5739] --- SIGSYS {si_signo=SIGSYS, si_code=SYS_SECCOMP, si_call_addr=0x7f507b685d37, si_syscall=__NR_gettimeofday, si_arch=AUDIT_ARCH_X86_64} ---

4) Paste those lines here, I'll try to fix ASAP
5) you again rebuild tracker with:

  $ jhbuild buildone tracker

6) We repeat steps 3,4 and 5 till this is all finished.
7) In order to make it dead sure that everything was fixed, you can reset tracker file info and reindex doing:

  $ tracker reset -f /path/to/configured/folder

  This will make tracker reindex the given directory as per the configuration, as if it first found it.


I'm sorry for this burden, but it will allow fixing any remaining issue in a much tighter loop. I fixed this last one you reported, but there could be no more issues just like there could be 10 more, and I'd rather not involve further releases and extra work on distros to fix this for good.
Comment 26 Phil Reilly 2016-12-17 15:37:06 UTC
I'm doing this on Apricity so if someone puts this build into the AUR repository I can build it from there otherwise I can't commit.
Comment 27 Carlos Garnacho 2016-12-17 16:43:23 UTC
I am using fedora 25 so have no easy way to do that, you can perhaps download the arch PKGBUILD file for Tracker at https://git.archlinux.org/svntogit/packages.git/plain/trunk/PKGBUILD?h=packages/tracker

And modify the source=... line to:

source=("git+https://git.gnome.org/browse/tracker#branch=tracker-1.10")

After that running makepkg should give you the packages to replace your system's, compiled from the most recent tracker-1.10 branch changes.
Comment 28 Michael Biebl 2016-12-21 13:36:19 UTC
We also got this downstream bug report with 1.10.3
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848842
Comment 29 Carlos Garnacho 2016-12-21 16:06:33 UTC
Created attachment 342335 [details] [review]
libtracker-common: Handle mlock*/munlock* syscalls

Disallow pinning memory on RAM, but make it softly fail with EPERM.
Comment 30 Carlos Garnacho 2016-12-21 16:15:07 UTC
Created attachment 342337 [details] [review]
libtracker-common: Allow querying process stats/limits

Modifying those is not allowed though.
Comment 31 Carlos Garnacho 2016-12-21 16:19:33 UTC
Thanks for the info Michael :), I'll make yet another set of releases during the weekend with the accumulated patches. Hopefully we get closer to forgetting this ever happened...
Comment 32 Carlos Garnacho 2016-12-22 13:32:44 UTC
Attachment 342335 [details] pushed as c9acfe0 - libtracker-common: Handle mlock*/munlock* syscalls
Attachment 342337 [details] pushed as 47b4958 - libtracker-common: Allow querying process stats/limits
Comment 33 Jeremy Bicha 2016-12-23 06:06:35 UTC
Carlos, did you see https://bugzilla.gnome.org/776271
Comment 34 Carlos Garnacho 2016-12-23 09:42:06 UTC
Oops, I didn't, thanks for pointing it out Jeremy :). I however saw a ubuntu bug report linked at the debian bug in comment #28, which seems to be the same issue you forwarded there, the patch allowing getrusage() in comment #30 here should fix it.

I'll mark as dup of this one, and during the weekend I'll cherry-pick the relevant patches in all branches and make another set of releases.
Comment 35 Carlos Garnacho 2016-12-23 09:44:44 UTC
*** Bug 776271 has been marked as a duplicate of this bug. ***
Comment 36 Michael Biebl 2017-01-12 15:35:20 UTC
Hi Carlos, how is the new release coming along?
I see that the tracker-1.10 does not have all of the fixes from the master branch yet. 

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848842#36 saw a more detailed reply by Simon.

You might also be interested in his idea at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851148#41 (can file a separate bug report for that)
Comment 37 Sebastian Keller 2017-01-19 00:07:03 UTC
There are two more syscalls I needed to whitelist for Tracker >=1.11.2 to work on my system (Fedora 26).

The first one is "getpid". Here is a backtrace of it being used by the gstreamer module:

Thread 23 "single" received signal SIGSYS, Bad system call.

Thread 140736275040000 (LWP 27458)

  • #0 getpid
    at ../sysdeps/unix/syscall-template.S line 66
  • #1 g_log_writer_format_fields
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 2204
  • #2 g_log_writer_standard_streams
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 2488
  • #3 g_log_writer_default
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 2591
  • #4 g_log_structured_array
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 1933
  • #5 g_log_default_handler
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 3047
  • #6 tracker_log_handler
    at tracker-log.c line 143
  • #7 g_logv
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 1336
  • #8 g_log
    at /home/sebastian/devel/checkout/gnome/glib/glib/gmessages.c line 1398
  • #9 gst_registry_scan_plugin_file
    at gstregistry.c line 1180
  • #10 gst_registry_scan_path_level
    at gstregistry.c line 1354
  • #11 gst_registry_scan_path_internal
    at gstregistry.c line 1381
  • #12 scan_and_update_registry
    at gstregistry.c line 1625
  • #13 ensure_current_registry
    at gstregistry.c line 1769
  • #14 gst_update_registry
    at gstregistry.c line 1846
  • #15 init_post
    at gst.c line 727
  • #16 g_option_context_parse
    at /home/sebastian/devel/checkout/gnome/glib/glib/goption.c line 2165
  • #17 gst_init_check
    at gst.c line 354
  • #18 gst_init
    at gst.c line 400
  • #19 tracker_extract_gstreamer
    at tracker-extract-gstreamer.c line 1322
  • #20 tracker_extract_get_metadata
    at tracker-extract-gstreamer.c line 1455
  • #21 get_file_metadata
    at tracker-extract.c line 326
  • #22 get_metadata
    at tracker-extract.c line 510
  • #23 single_thread_get_metadata
    at tracker-extract.c line 538
  • #24 g_thread_proxy
    at /home/sebastian/devel/checkout/gnome/glib/glib/gthread.c line 784
  • #25 start_thread
    at pthread_create.c line 333
  • #26 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 97

Comment 38 Carlos Garnacho 2017-01-19 11:32:37 UTC
I've just released 1.10.4 and 1.8.3, together with yesterday's 1.11.3. These all contain all the latest whitelisting fixes...

(In reply to Sebastian Keller from comment #37)
> There are two more syscalls I needed to whitelist for Tracker >=1.11.2 to
> work on my system (Fedora 26).
> 
> The first one is "getpid". Here is a backtrace of it being used by the
> gstreamer module:

...except this one, which is included in 1.10/1.8, but didn't make it to 1.11.3. Would be great if you could downgrade to 1.10.4 when it's packaged and test further with it :).
Comment 39 Sebastian Keller 2017-01-19 11:42:55 UTC
I just noticed bugzilla ate the rest of my comment after the trace. I already added getpid to the whitelist and then Tracker got stuck on wait4 when trying to call waitpid. This happened when indexing a gzipped PS file. After adding "wait4" to the whitelist, it was able to index all files again.

Thread 26 "single" received signal SIGSYS, Bad system call.

Thread 140735944771328 (LWP 22560)

  • #0 __waitpid
    at ../sysdeps/unix/sysv/linux/waitpid.c line 29
  • #1 fork_exec_with_pipes
    at /home/sebastian/devel/checkout/gnome/glib/glib/gspawn.c line 1460
  • #2 g_spawn_async_with_pipes
  • #3 extract_ps_gz
    at tracker-extract-ps.c line 271
  • #4 tracker_extract_get_metadata
    at tracker-extract-ps.c line 324
  • #5 get_file_metadata
    at tracker-extract.c line 326
  • #6 get_metadata
    at tracker-extract.c line 510
  • #7 single_thread_get_metadata
    at tracker-extract.c line 538
  • #8 g_thread_proxy
    at /home/sebastian/devel/checkout/gnome/glib/glib/gthread.c line 784
  • #9 start_thread
    at pthread_create.c line 333
  • #10 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 97

Comment 40 Carlos Garnacho 2017-01-19 12:18:40 UTC
Ouch :), I just pushed the wait4 fix to all 3 branches, but that unfortunately means no release is up-to-date enough for you... I'll eventually roll another unstable tarball.

On the plus side, you already have the files indexed, and shouldn't be reindexed unless they change, you should be able to run 1.11.3 without a hitch now (until some new file possibly triggers these or other false positives, that is)
Comment 41 Chris HORLER 2018-02-25 15:56:56 UTC
in openSUSE Leap 42.3 / SLE-12 SP3 we see several issues with tracker 1.8.3

https://bugzilla.opensuse.org/show_bug.cgi?id=1017652

patches that fixed this are here:
https://build.opensuse.org/request/show/579801

some seem to be resolved by applying some tracker 1.12 branch changes to the tracker 1.8 branch:  tracker-whitelist-dup2-dup3.patch

also:
- gstreamer v4l2 plugin that triggers creation of a NETLINK socket in systemd-udev
- gst-plugin-scanner fork
: tracker-gst-v4l2-and-scanner-workaround.patch

I'm attaching both patches for review
Comment 42 Chris HORLER 2018-02-25 16:01:15 UTC
Created attachment 368897 [details] [review]
patch for gstreamer v4l2 plugin and plugin scanner
Comment 43 Chris HORLER 2018-02-25 16:03:46 UTC
Created attachment 368898 [details] [review]
tracker 1.12 -> 1.8 calls alignment
Comment 44 Sam Thursfield 2021-05-26 22:24:55 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new enhancement request ticket at
  https://gitlab.gnome.org/GNOME/tracker/-/issues/

Thank you for your understanding and your help.