From patchwork Thu Nov 7 00:54:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Iyer X-Patchwork-Id: 1190800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 477lLH4Q82z9sPF; Thu, 7 Nov 2019 11:55:03 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iSW4h-0000mM-HI; Thu, 07 Nov 2019 00:54:59 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iSW4g-0000m3-4D for kernel-team@lists.ubuntu.com; Thu, 07 Nov 2019 00:54:58 +0000 Received: from 1.general.manjo.us.vpn ([10.172.65.2] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iSW4f-0002IL-Nv for kernel-team@lists.ubuntu.com; Thu, 07 Nov 2019 00:54:57 +0000 From: Manoj Iyer To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3] seccomp: rework define for SECCOMP_USER_NOTIF_FLAG_CONTINUE Date: Wed, 6 Nov 2019 18:54:31 -0600 Message-Id: <20191107005433.14321-2-manoj.iyer@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191107005433.14321-1-manoj.iyer@canonical.com> References: <20191107005433.14321-1-manoj.iyer@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Christian Brauner Switch from BIT(0) to (1UL << 0). First, there are already two different forms used in the header, so there's no need to add a third. Second, the BIT() macros is kernel internal and afaict not actually exposed to userspace. Maybe there's some magic there I'm missing but it definitely causes issues when compiling a program that tries to use SECCOMP_USER_NOTIF_FLAG_CONTINUE. It currently fails in the following way: # github.com/lxc/lxd/lxd /usr/bin/ld: $WORK/b001/_x003.o: in function `__do_user_notification_continue': lxd/main_checkfeature.go:240: undefined reference to `BIT' collect2: error: ld returned 1 exit status Switching to (1UL << 0) should prevent that and is more in line what is already done in the rest of the header. BugLink: https://bugs.launchpad.net/bugs/1849281 Cc: Kees Cook Cc: Andy Lutomirski Signed-off-by: Christian Brauner Link: https://lore.kernel.org/r/20191024212539.4059-1-christian.brauner@ubuntu.com Signed-off-by: Kees Cook (cherry picked from commit 23b2c96fad21886c53f5e1a4ffedd45ddd2e85ba git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git) Signed-off-by: Manoj Iyer --- include/uapi/linux/seccomp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h index e48e2fa2d248..be84d87f1f46 100644 --- a/include/uapi/linux/seccomp.h +++ b/include/uapi/linux/seccomp.h @@ -103,7 +103,7 @@ struct seccomp_notif { * SECCOMP_USER_NOTIF_FLAG_CONTINUE. Note that SECCOMP_RET_TRACE can equally * be overriden by SECCOMP_USER_NOTIF_FLAG_CONTINUE. */ -#define SECCOMP_USER_NOTIF_FLAG_CONTINUE BIT(0) +#define SECCOMP_USER_NOTIF_FLAG_CONTINUE (1UL << 0) struct seccomp_notif_resp { __u64 id;