lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240604.c18387da7a0e@gnoack.org>
Date: Tue, 4 Jun 2024 22:22:44 +0200
From: Günther Noack <gnoack3000@...il.com>
To: Mikhail Ivanov <ivanov.mikhail1@...wei-partners.com>
Cc: mic@...ikod.net, willemdebruijn.kernel@...il.com,
	linux-security-module@...r.kernel.org, netdev@...r.kernel.org,
	netfilter-devel@...r.kernel.org, yusongping@...wei.com,
	artem.kuzin@...wei.com, konstantin.meskhidze@...wei.com
Subject: Re: [RFC PATCH v2 00/12] Socket type control for Landlock

On Fri, May 24, 2024 at 05:30:03PM +0800, Mikhail Ivanov wrote:
> Hello! This is v2 RFC patch dedicated to socket protocols restriction.
> 
> It is based on the landlock's mic-next branch on top of v6.9 kernel
> version.

Hello Mikhail!

I patched in your patchset and tried to use the feature with a small
demo tool, but I ran into what I think is a bug -- do you happen to
know what this might be?

I used 6.10-rc1 as a base and patched your patches on top.

The code is a small tool called "nonet", which does the following:

  - Disable socket creation with a Landlock ruleset with the following
    attributes:
  
    struct landlock_ruleset_attr attr = {
      .handled_access_socket = LANDLOCK_ACCESS_SOCKET_CREATE,
    };

  - open("/dev/null", O_WRONLY)

Expected result:

  - open() should work

Observed result:

  - open() fails with EACCES.

I traced this with perf, and found that the open() gets rejected from
Landlock's hook_file_open, whereas hook_socket_create does not get
invoked.  This is surprising to me -- Enabling a policy for socket
creation should not influence the outcome of opening files!

Tracing commands:

  sudo perf probe hook_socket_create '$params'
  sudo perf probe 'hook_file_open%return $retval'
  sudo perf record -e 'probe:*' -g -- ./nonet
  sudo perf report
 
You can find the tool in my landlock-examples repo in the nonet_bug branch:
https://github.com/gnoack/landlock-examples/blob/nonet_bug/nonet.c

Landlock is enabled like this:
https://github.com/gnoack/landlock-examples/blob/nonet_bug/sandbox_socket.c

Do you have a hunch what might be going on?

Thanks,
–Günther


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ