Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp899060pxk; Sat, 12 Sep 2020 04:14:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8a+AyySGa/Ee2a7myS/2th6jGB5q5N7wvWRszdeAfTd5e5OKNgCGcCjHKH8gFIQJRzfhB X-Received: by 2002:a17:906:8c8:: with SMTP id o8mr5562140eje.91.1599909270870; Sat, 12 Sep 2020 04:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599909270; cv=none; d=google.com; s=arc-20160816; b=cBSfGSCspQ3IvpjLSTU1wd6BPo9g8r5HdiIeNZsw1nXN/n89oZWgO15i5rjrr0rgfy kcng2/kS7oCe6i1tob0f7ZlGDT9UArPX4BOXkaWMcFSSqh3PGWBd8FD0b/im6/02dWcB k98Egzm0j8yBYsUkrootzHyGChEa8e0m3UfSWE1TxtpQGjQF6CmNWY9jDIdu2gwh46jM QTcJfR3fxNY+lOYzb2RkZDhTHVSnXnpa3yuMp5agR4kJlFdsthApWKL2BukXRQK3pLMH Ym3LqiJesAF2CWLy5BdYas+qeb5Z5kt24PUDbTluBuLHi+91b4ZLFyvcLTVSkra0C9Ox s3dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yfwK3v59ulDG8xRv4Cwr4k2seeBZHBJy/fMB9LYQCYQ=; b=G+Amzvh5Fi3YXTfRgYH2lAI+46H5c5vwue4G8LUeABTaeKO+k2vKDJO/V7bcS8Eakg Ku71VXriwqQ+RyhBu04UC9MT4s+MCw6pUse+zkAUnEaPkjKL9KNXlMsmkhRqIcv/2AW1 EfC3JuHL9Cxq/MWxD86EMZ6dQiYDletaOtzyk4mxJP/bu+VrisgXQTLVNWVsle0qT1xe MHiyW+cWFxShQLyM9QTEQdz5rytGs/fogoPHVYRvg3JtahttL6xCg9MroXeSyiPuYUvg O4/yyjSEsC4eJi4s2GjMa0r06BMv2/Ry1yWvPDM2e06qst+aBKs/y2qzJje3dfrLZCFE W9aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KLE1PL50; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si3385258edh.74.2020.09.12.04.14.08; Sat, 12 Sep 2020 04:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KLE1PL50; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725980AbgILLK7 (ORCPT + 99 others); Sat, 12 Sep 2020 07:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbgILLJo (ORCPT ); Sat, 12 Sep 2020 07:09:44 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E904CC061345 for ; Sat, 12 Sep 2020 04:08:35 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id t7so2986396pjd.3 for ; Sat, 12 Sep 2020 04:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yfwK3v59ulDG8xRv4Cwr4k2seeBZHBJy/fMB9LYQCYQ=; b=KLE1PL50FLBo8ev5qSDoj1kBBVOJoMyiHr99ME6rCPqlayRiESNpQWvxCHB3om2Bfc XN0BVMjBNpBx5otJmu1jvqPjeWgsI4KksNuYIwR70mc27cvFLWlhjTRLgt83KBE2MFDw Dm8vSbSJaJpHsO2XD/IeVUJf+GCoM9n5H04mM= 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:mime-version:content-transfer-encoding; bh=yfwK3v59ulDG8xRv4Cwr4k2seeBZHBJy/fMB9LYQCYQ=; b=UjY1zfnRhB8Q2NW9LhQAs6LlvUuNxoh9rd5ETjPBIw5B/uLi/pDqakLt/et2+qtfyB gXiwvB8Wp5y2P7BziqKSAtNOL/ubGQYJOg5t003+iTUaMSvv4KEq6poWceWa0XbIdYK2 jn6XlHKWq9mlnbrIwDN631AS09XLINYxP+Ui+/xbzq7yrwa6ZSa7inNICZckAlCgRgTj 6kAoVJkTt7jAiLvkrke1cfGlr4QNHXFouWeWlYalQ0AeXPs9pl6KOzkwM8/G5SSvexTy eRf8biEoRKKzfgzFEwLkWcyI22KFpi/PS0SrOz0ccQR3JcytVelEWEkaPajMMLAz4pjY FAAg== X-Gm-Message-State: AOAM531oJdENh+iVmSDLPRlfSdBuJ4+6Wdfxvn9tVJr6KAH4uZo7U7Ti ivrUnFU+1vzcZbp2DSY69Ad8yg== X-Received: by 2002:a17:902:7489:b029:d0:4c09:be with SMTP id h9-20020a1709027489b02900d04c0900bemr6604087pll.0.1599908915516; Sat, 12 Sep 2020 04:08:35 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q190sm5265820pfq.99.2020.09.12.04.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:08:34 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Thadeu Lima de Souza Cascardo , Max Filippov , Michael Ellerman , Christian Brauner , Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 14/15] selftests/clone3: Avoid OS-defined clone_args Date: Sat, 12 Sep 2020 04:08:19 -0700 Message-Id: <20200912110820.597135-15-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200912110820.597135-1-keescook@chromium.org> References: <20200912110820.597135-1-keescook@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the UAPI headers start to appear in distros, we need to avoid outdated versions of struct clone_args to be able to test modern features. Additionally pull in the syscall numbers correctly. Signed-off-by: Kees Cook --- I needed to fix this to get MIPS to build the seccomp selftests. --- .../testing/selftests/clone3/clone3_selftests.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3_selftests.h b/tools/testing/selftests/clone3/clone3_selftests.h index 91c1a78ddb39..bc0f34e37ae1 100644 --- a/tools/testing/selftests/clone3/clone3_selftests.h +++ b/tools/testing/selftests/clone3/clone3_selftests.h @@ -4,11 +4,19 @@ #define _CLONE3_SELFTESTS_H #define _GNU_SOURCE + +/* Pull in syscall numbers. */ +#include +#include + +/* Avoid old OS versions of "struct clone_args". */ +#define clone_args old_clone_args #include #include +#undef clone_args + #include #include -#include #include #include "../kselftest.h" @@ -25,6 +33,7 @@ #ifndef __NR_clone3 #define __NR_clone3 -1 +#endif struct clone_args { __aligned_u64 flags; __aligned_u64 pidfd; @@ -34,13 +43,16 @@ struct clone_args { __aligned_u64 stack; __aligned_u64 stack_size; __aligned_u64 tls; +#ifndef CLONE_ARGS_SIZE_VER1 #define CLONE_ARGS_SIZE_VER1 80 +#endif __aligned_u64 set_tid; __aligned_u64 set_tid_size; +#ifndef CLONE_ARGS_SIZE_VER2 #define CLONE_ARGS_SIZE_VER2 88 +#endif __aligned_u64 cgroup; }; -#endif /* __NR_clone3 */ static pid_t sys_clone3(struct clone_args *args, size_t size) { -- 2.25.1