From patchwork Fri Aug 10 16:13:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 10562925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F24AD14E2 for ; Fri, 10 Aug 2018 16:13:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE81A2BC30 for ; Fri, 10 Aug 2018 16:13:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D24C02BDBA; Fri, 10 Aug 2018 16:13:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B7772BC30 for ; Fri, 10 Aug 2018 16:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbeHJSoY (ORCPT ); Fri, 10 Aug 2018 14:44:24 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33172 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728217AbeHJSoY (ORCPT ); Fri, 10 Aug 2018 14:44:24 -0400 Received: by mail-wm0-f68.google.com with SMTP id r24-v6so1875449wmh.0 for ; Fri, 10 Aug 2018 09:13: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:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fQlEYCn6A9ZB8mwzIMZiDCoWbJv/I2/BURnjHoIWK0M=; b=eh5V8QnwO6gPkVJJvWE6aDIA7L4uBbc3FmV7L+YVaJVJ6mei/byBsqHQ5ntLVL7GZ2 51iGKupf8RzrEKxD0WH/9/XIMJnubauNIcDMMhj4KMgzXYyPbJohcNjK9DkD4CYdbpiQ S5WnT6EDv+5jsBPUHnKllW9+cgksu/mih4yczSb6wS/Qu0gauexy2z98R0SvXpmw7xSW 1EvXE88sZqdGS5kLbyltu7VzEAdq09ydkYJUx7OnVW7uOnzd9OrYglbmUFfJoe2gRZ/G i+g5uUcLgaNlPnf8DABncdGxlJUoeE723KhF0Ul0MBdRwrermqRXp00n16rB2q9tdvTt Rz0w== X-Gm-Message-State: AOUpUlHa8XO0yFHJh6xrctJioEFxZQoMM/kVnu9el3PkMm3g9XQqDl3+ 8vK7d3WOxF2t3RZ/9gwD2xTVCRSw1zY= X-Google-Smtp-Source: AA+uWPx+mLcKg9Nzmb5Pbpllusch+xZgvXF0Q8Oxb+DpoVuhoGZltN8A2ipdKkR8bk2B1P1YEcmIIQ== X-Received: by 2002:a1c:ea9b:: with SMTP id g27-v6mr1837958wmi.152.1533917633476; Fri, 10 Aug 2018 09:13:53 -0700 (PDT) Received: from localhost.localdomain (u-082-c008.eap.uni-tuebingen.de. [134.2.82.8]) by smtp.gmail.com with ESMTPSA id m13-v6sm9987615wru.93.2018.08.10.09.13.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 09:13:52 -0700 (PDT) From: Christian Brauner To: linux-security-module@vger.kernel.org, containers@lists.linux-foundation.org Cc: serge@hallyn.com, morgan@kernel.org, Christian Brauner Subject: [PATCH 1/9] cap_file: use v3 xattr macros Date: Fri, 10 Aug 2018 18:13:27 +0200 Message-Id: <20180810161335.27036-2-christian@brauner.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810161335.27036-1-christian@brauner.io> References: <20180810161335.27036-1-christian@brauner.io> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP On kernels supporting VFS_CAP_REVISION_3 we should make use the new macros. Signed-off-by: Christian Brauner Reviewed-by: Serge Hallyn --- libcap/cap_file.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libcap/cap_file.c b/libcap/cap_file.c index 76aac8c..228d806 100644 --- a/libcap/cap_file.c +++ b/libcap/cap_file.c @@ -59,6 +59,13 @@ static cap_t _fcaps_load(struct vfs_cap_data *rawvfscap, cap_t result, break; #endif +#ifdef VFS_CAP_REVISION_3 + case VFS_CAP_REVISION_3: + tocopy = VFS_CAP_U32_3; + bytes -= XATTR_CAPS_SZ_3; + break; +#endif + default: cap_free(result); result = NULL; @@ -125,9 +132,15 @@ static int _fcaps_save(struct vfs_cap_data *rawvfscap, cap_t cap_d, #ifdef _LINUX_CAPABILITY_VERSION_3 case _LINUX_CAPABILITY_VERSION_3: +#ifdef VFS_CAP_REVISION_3 + magic = VFS_CAP_REVISION_3; + tocopy = VFS_CAP_U32_3; + *bytes_p = XATTR_CAPS_SZ_3; +#else magic = VFS_CAP_REVISION_2; tocopy = VFS_CAP_U32_2; *bytes_p = XATTR_CAPS_SZ_2; +#endif break; #endif