Skip to content

Errors related to personality retrieval with Yama #636

@HorlogeSkynet

Description

@HorlogeSkynet

Hello there 👋

I've noticed literally thousands of errors related to personality retrieval, very likely due to Yama.

It looks like (lxcfs logs) :

lxcfs[XXXX]: ../src/proc_fuse.c: 94: get_procfile_size_with_personality: Failed to get caller process (pid: YYYY) personality

As Yama also reports unauthorized (prevented) accesses, it actually floods kernel logs as well :

kernel: ptrace attach of "REDACTED PROCESS NAME"[YYYY] was attempted by "/usr/bin/lxcfs /var/lib/lxcfs"[XXXX]

When we dig this a bit, we can read in proc(5) :

/proc/[pid]/personality (since Linux 2.6.28)
  This  read-only  file  exposes  the process's execution domain, as set by personality(2).
  The value is displayed in hexadecimal notation.

  Permission to access this file is governed by a ptrace access mode PTRACE_MODE_ATTACH_FSCREDS check; see ptrace(2)

I wanted to propose a patch but I'm not sure about the best approach here. Should we :

  • revert proc: Fix /proc/cpuinfo not respecting personality #609 ?
  • handle EPERM specifically so as to ignoring it ? (this wouldn't address Yama complaining about "ptrace attachment tentative")
  • check whether Yama is enforced through /proc/sys/kernel/yama/ptrace_scope before even trying to get task personality (LBYL) ?
  • something else ?

Thanks for your time, bye 🙏


Setup : lxcfs 6.0.0 / Linux 6.8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions