From patchwork Thu Nov 24 10:07:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 127467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id D5E831007E0 for ; Thu, 24 Nov 2011 21:07:48 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RTWDT-00043W-91; Thu, 24 Nov 2011 10:07:39 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RTWDN-0003zD-PK for kernel-team@lists.ubuntu.com; Thu, 24 Nov 2011 10:07:33 +0000 Received: from dynamic-adsl-94-36-80-95.clienti.tiscali.it ([94.36.80.95] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RTWDN-0005Ne-Jc for kernel-team@lists.ubuntu.com; Thu, 24 Nov 2011 10:07:33 +0000 From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 6/6] Yama: use thread group leader when creating match Date: Thu, 24 Nov 2011 11:07:26 +0100 Message-Id: <1322129246-5397-7-git-send-email-paolo.pisati@canonical.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1322129246-5397-1-git-send-email-paolo.pisati@canonical.com> References: <1322129246-5397-1-git-send-email-paolo.pisati@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Kees Cook Like the earlier bug-fix for thread group leader when matching, we also need to find the thread group leader for "current" when creating the match. BugLink: http://bugs.launchpad.net/bugs/729839 Signed-off-by: Kees Cook Acked-by: Tim Gardner Acked-by: Stefan Bader Signed-off-by: Stefan Bader (cherry picked from commit ad0ff93928b5b690054ba8a8fa9cd37464733122) BugLink: http://launchpad.net/bugs/893190 Signed-off-by: Paolo Pisati --- security/yama/yama_lsm.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index f3e7d7f..be177ca 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c @@ -131,8 +131,12 @@ int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3, } else { struct task_struct *tracer; + struct task_struct *myself = current; rcu_read_lock(); + if (!thread_group_leader(myself)) + myself = myself->group_leader; + get_task_struct(myself); tracer = find_task_by_vpid(arg2); if (tracer) get_task_struct(tracer); @@ -141,9 +145,10 @@ int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3, rcu_read_unlock(); if (tracer) { - rc = yama_ptracer_add(tracer, current); + rc = yama_ptracer_add(tracer, myself); put_task_struct(tracer); } + put_task_struct(myself); } break; }