From owner-freebsd-hackers@freebsd.org Sun Oct 25 08:39:55 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C40A3447338 for ; Sun, 25 Oct 2020 08:39:55 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJrxk4pZdz3W6S for ; Sun, 25 Oct 2020 08:39:54 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: by mail-lf1-f41.google.com with SMTP id h6so7804448lfj.3 for ; Sun, 25 Oct 2020 01:39:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NjPB+MmiSlCtdrhKm/L2A30oA860LNNZ2RDLQLHYgIU=; b=JNCjXkUm3KgNVrMsaZ4JkobJ0Gc1Nv4RxuCMAZB/uJzsw0aH8WHyFJudMnmL8hy8M0 ETjQNVIuH5hLDIMWBxPQgWX9cQ0g3ojWU+68o8ddRfGNARgl/fEzNWFspBwhBibmIHx7 ix5aQ1gv9sWqYPwpilmKcr1DjvRIWq+wd64SyJKWLiIjm3pcuhcoZZYcMqgG8KAkb77p DC1lf9I+4WnFaKxoo8GvAphGsTZE+OROZbkUqrRHKKEjGptssaf0oC3T8LqX9kKriKgV RhDl18W3N4bsq6PjRdQb3B2T4QwrSOWBReb2H0zPYGjbpuGqVlwvGV/kTxk5sJux0k8w nKyQ== X-Gm-Message-State: AOAM532pMIXbzKnQkJn0RR5cy6Y5CCg9Dw/Tadz4EgI7jma0uVh/gIgi S/fgr9lMaTvuBf7wM9FUepKwP9oV0pF7CA== X-Google-Smtp-Source: ABdhPJxJexOdz+O+JGpIC3pf0SdTjbDKdaWlwj8U8A+TwYlllr+wxswuKb68p5ODLWtPFBguc5rqdA== X-Received: by 2002:a05:6512:313c:: with SMTP id p28mr3023313lfd.310.1603615192737; Sun, 25 Oct 2020 01:39:52 -0700 (PDT) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com. [209.85.167.51]) by smtp.gmail.com with ESMTPSA id t5sm754226ljc.124.2020.10.25.01.39.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Oct 2020 01:39:52 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id a9so7811737lfc.7 for ; Sun, 25 Oct 2020 01:39:52 -0700 (PDT) X-Received: by 2002:a19:7513:: with SMTP id y19mr3597694lfe.157.1603615192313; Sun, 25 Oct 2020 01:39:52 -0700 (PDT) MIME-Version: 1.0 From: Gleb Popov Date: Sun, 25 Oct 2020 12:39:26 +0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Mapping Linux capabilities(7) to our Capsicum rights(4) To: freebsd-hackers X-Rspamd-Queue-Id: 4CJrxk4pZdz3W6S X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of 6yearold@gmail.com designates 209.85.167.41 as permitted sender) smtp.mailfrom=6yearold@gmail.com X-Spamd-Result: default: False [-1.86 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DOM_EQ_FROM_DOM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.97)[-0.966]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_MEDIUM(-0.89)[-0.886]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.00)[-0.003]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.41:from]; FORGED_SENDER(0.30)[arrowd@freebsd.org,6yearold@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.41:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_NEQ_ENVFROM(0.00)[arrowd@freebsd.org,6yearold@gmail.com]; MAILMAN_DEST(0.00)[freebsd-hackers] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2020 08:39:55 -0000 Hello hackers! I'm porting a software that employs Linux capabilities to constrain the running process. The code looks like if (!haveCapability(CAP_SYS_CHROOT) || !haveCapability(CAP_MKNOD) || !haveCapability(CAP_FOWNER)) { errorOut(); } dropCapability(CAP_SYS_CHROOT); dropCapability(CAP_MKNOD); dropCapability(CAP_FOWNER); The CAP_MKNOD looks much like our CAP_MKNODAT. The CAP_FOWNER looks more complex, but it seems it is implemented at higher granularity in Capsicum. Finally, I haven't found anything for CAP_SYS_CHROOT. I'll continue digging this up, but any hints would be appreciated. Thanks in advance.