From patchwork Tue Jun 12 05:32:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Kamboju X-Patchwork-Id: 138289 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4902004lji; Mon, 11 Jun 2018 22:32:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ2RItMfoDia2Se83aE7XbnBDBlOu+SDEitKt2LSefUK9U7Dq6/goCNfGmvM6suWW+uTvJP X-Received: by 2002:a17:902:6546:: with SMTP id d6-v6mr2419478pln.196.1528781532130; Mon, 11 Jun 2018 22:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528781532; cv=none; d=google.com; s=arc-20160816; b=dCFS2Yg45YJMJ7Ee7MO1OPihTZb8Dh1i4V/Z92bQqMfb/B24xNaUqe5FhkkiUycWf8 1vl+P3WewI0Nwrfy7UIDcmwQf0IlKsDPFh968xuc+03mJGEjJj9kNM93fqFFwgq37zyr 9tKzIjSiKhvTXv7tIkxzYJNyLJZe2GzZ6DeTWH0xsrL0hzllPBmJozexkDg/AtJUJv/k f3PlMrItA8X90BGi5s64qcB0gb5QV5Fshz0ugnBzxRp/PaxVtbf7u86HLPEJ+I1Qc2PN L2TfQw3P26xxCcxhh5M+StdnpMXVIeLIId5nvU7ywXG1G+tSOuqweUYhlxAyz82De6jD oMBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=Gn3HMQ+lWShhWmCw3HkBAMhArzmR5LgaKBOcGSP6Nic=; b=qygavWBAEJaSRQtKiFUN+ltIEnW+CwPBYpHdV+dUX4OMAQuNDtliRIRMo9yggky0Vr fPCCEQezrGCUH7l+BA/ZNz3bsw7YiNew4wy6Hk5SYOL5qHy9AyFOx+gKjNLtpud5yvdu 5+qRnwloYIUNLZisTqEoPHLPcxvbEloGWlLBn8LHmY684JT+pcOhgHZtWav+F38WUMBZ RiZpuIKOGW8sHeSBjaioLtiCE3YBhpWVrsny3dpjDWf98zTAry4LCny+/5mgnko8Z2m8 H/orSBsD8HwfVc/iEHVOO4t9XyDFROqwi8gwm9yjGh7Hh6hP4TecG70sAAfuoZAFO/VU wDdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QSkH4hQ6; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id b13-v6si79481plm.202.2018.06.11.22.32.11; Mon, 11 Jun 2018 22:32:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QSkH4hQ6; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id E48E578D9C; Tue, 12 Jun 2018 05:32:09 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pf0-f173.google.com (mail-pf0-f173.google.com [209.85.192.173]) by mail.openembedded.org (Postfix) with ESMTP id E84DD78D85 for ; Tue, 12 Jun 2018 05:32:08 +0000 (UTC) Received: by mail-pf0-f173.google.com with SMTP id c22-v6so11064093pfi.2 for ; Mon, 11 Jun 2018 22:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=7cyVgkTcCQ1qibf4h3Ygzgk3mrDVchhcLwOFqdm5FeA=; b=QSkH4hQ6y8U1k2Z0yogRLS1Kh8Zwn2bceorFi16k15/EFpv+BtQXAvTo6fR3+0jEe5 dGMJxCaxJZcz50KVtj1hoCVvwu61kmZ0YpMZGmIphJyNuZbXpLKRtwKNnme7imypPx9p V0On+QY55c5ubq43gNmk7Y5qdAXtM/YoGUPYU= 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; bh=7cyVgkTcCQ1qibf4h3Ygzgk3mrDVchhcLwOFqdm5FeA=; b=Sm+Qa521VKEtXOTTE2pFhIPM5jebe8ddqqnz1WWIUf1PQA89sApKus5CnPvX78a4vP aQ9dlh8BlIW91d6kfQty9OztuOiKbnxxarCmmOiK0GLWIcQ/XUgKBp5yghzyDj6ByUT/ c2tTlYx+DZs3LDALHhbYBbnzGxah4nMA7+NjPHSJU5u19fPdgkEjK8H5t4iXRj6CA6Ew XK5m4JP9g4QuoRYtuPYOL/0bol0nHcKjonsPZWSVT20U2pZvEggyrZzBZXvuugKHOUHZ GSztZ4WlCcNF3xNlABI5wVF5CPMqkRU786HDh4CCk2QdKJs1tIFF/nGham6jZaxaoc7N 6klA== X-Gm-Message-State: APt69E2YrMZVf/8ViZmquQbkOoBnvOnlgZYvL94cMGePAlTuO15gMIh4 55OR1SQGYCqWqB7WdL03KywYXy3L49Y= X-Received: by 2002:a62:9c9c:: with SMTP id u28-v6mr2315983pfk.90.1528781529421; Mon, 11 Jun 2018 22:32:09 -0700 (PDT) Received: from localhost.localdomain ([183.82.210.238]) by smtp.gmail.com with ESMTPSA id r20-v6sm186722pgu.25.2018.06.11.22.32.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jun 2018 22:32:08 -0700 (PDT) From: Naresh Kamboju To: openembedded-core@lists.openembedded.org Date: Tue, 12 Jun 2018 11:02:03 +0530 Message-Id: <1528781523-25424-1-git-send-email-naresh.kamboju@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [OE-core] [PATCH v2] ltp: fix cve-2017-5669 test case X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Adding cve-2017-5669 test fix patch which is accepted upstream in LTP repo. Ref: cve-2017-5669: shmat() for 0 (or --- ...69-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch | 95 ++++++++++++++++++++++ meta/recipes-extended/ltp/ltp_20180515.bb | 1 + 2 files changed, 96 insertions(+) create mode 100644 meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch b/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch new file mode 100644 index 0000000..c8498d9 --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch @@ -0,0 +1,95 @@ +From b767b73ef027ba8d35f297c7d3659265ac80425b Mon Sep 17 00:00:00 2001 +From: Rafael David Tinoco +Date: Wed, 30 May 2018 09:14:34 -0300 +Subject: [PATCH] cve-2017-5669: shmat() for 0 (or +Date: Fri May 25 14:47:30 2018 -0700 + + ipc/shm: fix shmat() nil address after round-down when remapping + +commit a73ab244f0da +Author: Davidlohr Bueso +Date: Fri May 25 14:47:27 2018 -0700 + + Revert "ipc/shm: Fix shmat mmap nil-page protection" + +For previously test, and now broken, made based on: + +commit 95e91b831f87 +Author: Davidlohr Bueso +Date: Mon Feb 27 14:28:24 2017 -0800 + + ipc/shm: Fix shmat mmap nil-page protection + +Signed-off-by: Rafael David Tinoco +Tested-by: Naresh Kamboju +Reviewed-by: Jan Stancek + +Upstream-Status: Accepted [https://github.com/linux-test-project/ltp/pull/324] +--- + testcases/cve/cve-2017-5669.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/testcases/cve/cve-2017-5669.c b/testcases/cve/cve-2017-5669.c +index 1ca5983..0834626 100644 +--- a/testcases/cve/cve-2017-5669.c ++++ b/testcases/cve/cve-2017-5669.c +@@ -28,7 +28,20 @@ + * is just to see if we get an access error or some other unexpected behaviour. + * + * See commit 95e91b831f (ipc/shm: Fix shmat mmap nil-page protection) ++ * ++ * The commit above disallowed SHM_RND maps to zero (and rounded) entirely and ++ * that broke userland for cases like Xorg. New behavior disallows REMAPs to ++ * lower addresses (0<=PAGESIZE). ++ * ++ * See commit a73ab244f0da (Revert "ipc/shm: Fix shmat mmap nil-page protect...) ++ * See commit 8f89c007b6de (ipc/shm: fix shmat() nil address after round-dow...) ++ * See https://github.com/linux-test-project/ltp/issues/319 ++ * ++ * This test needs root permissions or else security_mmap_addr(), from ++ * get_unmapped_area(), will cause permission errors when trying to mmap lower ++ * addresses. + */ ++ + #include + #include + #include +@@ -60,7 +73,11 @@ static void cleanup(void) + static void run(void) + { + tst_res(TINFO, "Attempting to attach shared memory to null page"); +- shm_addr = shmat(shm_id, ((void *)1), SHM_RND); ++ /* ++ * shmat() for 0 (or < PAGESIZE with RND flag) has to fail with REMAPs ++ * https://github.com/linux-test-project/ltp/issues/319 ++ */ ++ shm_addr = shmat(shm_id, ((void *)1), SHM_RND | SHM_REMAP); + if (shm_addr == (void *)-1) { + shm_addr = NULL; + if (errno == EINVAL) { +@@ -89,6 +106,7 @@ static void run(void) + } + + static struct tst_test test = { ++ .needs_root = 1, + .setup = setup, + .cleanup = cleanup, + .test_all = run, +-- +2.7.4 + diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb index b07c1b9..48739f1 100644 --- a/meta/recipes-extended/ltp/ltp_20180515.bb +++ b/meta/recipes-extended/ltp/ltp_20180515.bb @@ -41,6 +41,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \ file://0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch \ + file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \ " S = "${WORKDIR}/git"