From patchwork Sat Feb 3 10:53:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 196244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp956317dyc; Sat, 3 Feb 2024 02:54:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/qKTJX1OWaXygGfgKbN3bcigPN7QKkc1Y5fJJu8ZD0gyYO5apoT9L6tal1N568OG7Hca9 X-Received: by 2002:a17:90a:4a85:b0:296:44f1:e19e with SMTP id f5-20020a17090a4a8500b0029644f1e19emr3201541pjh.22.1706957696339; Sat, 03 Feb 2024 02:54:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706957696; cv=pass; d=google.com; s=arc-20160816; b=l3N7BhyMKuhTU7nZRjQzf5UBlieKZEKRi1VCJzcXJjPcZzGY+DEmHgf2XD88yhwYW9 5pumGEEf3NKRaCDve3ruen2g4n6gI769c9/TGqIn/+kYHkMYgGCC3TS//8zOVPQ1zqrs j4c5HfNF0qYfOrtTknwzFiQ+pXO+jn0iguo5NfG1A8InwoLmnES5+HStSR0UXO5KK54N 5AeDhmf+H0SWP40cTjCBGXyVZdJhdd87/2oIkHbW/6hAHJfYRHI6xEgz7YuyvBXzDTJh 9bj+ZNLzEZeYr3gJ6ZxGpfXGa/PDDnV0NWFXBxDiMKYCoBjOYD9dztAZ1RJTtOEDdUgi p4YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=P/PY6cDmgJ0N1DoI5AVz2Z9ojvFQmgDsk5JnB4/Msqs=; fh=TlLtNNbfcUYT/9XeQrR21p2bQMG4nBjH4kBBHVyEJXA=; b=bX7tOL0rfZZqfdLJt3qzaCFv7dUK3qbijFI/SCdVp7uSGY4tCXAO1UEUsRtazRq91i kygyyD1VFWbVhqLmXnLKmEWywMf5xT8i/m38rhQp8gbjTiqkN+CsuqE88JtS29aTl36E lUZRagMTlMav89r7naz2QtaxWpO41mzIAVrm4p5rtPAWf/5Ch72EeXqtfdjT4Aiynj9i URATZzSk/XyVWYT8nA6p1jc0l2cZdF/ABMk4rCIUSEeXojg8G3WrJd3etYuX9Fl9gYdI Ui7oVq/xXop2mTGhkUnpcr6a/KufQMDABlSEg+5QDvKE2y4Q1oNTG28Cj3DxwgupL6bz A1cA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=i-love.sakura.ne.jp); spf=pass (google.com: domain of linux-kernel+bounces-51035-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51035-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVrOxS/wkR+YP6DbwV+HwgvIA9wGUCPf0HwHXFRCEcIXqgRqHDKlv73pzCB0fEt/IkTeS8HcR0opZaTa1i4U0OZh7JVtg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g12-20020a170902740c00b001d909321bffsi3019551pll.295.2024.02.03.02.54.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 02:54:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51035-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=i-love.sakura.ne.jp); spf=pass (google.com: domain of linux-kernel+bounces-51035-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51035-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 00154286BD0 for ; Sat, 3 Feb 2024 10:54:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31E1F5D720; Sat, 3 Feb 2024 10:54:07 +0000 (UTC) Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCEBF482FF; Sat, 3 Feb 2024 10:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706957645; cv=none; b=X9gh7kl8ATI+1tyyBkFkm8c+/hu9IXw7cfH2/6v9ih6c3Ymu+SGfYco/mBu2ntzh6n5mMY6oYkv9twZ79BI/ZdD75rGDxvD5r+xCyZetam/icgNZUeX6/cnRbLtPYuka5A0SvjAH2EdmMTZTmt8RKRRESH+9aq+46o39bdadB2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706957645; c=relaxed/simple; bh=F+69FTeIjzSdatJi0VG2CjE/hSQPwZ6HCaeuaIWBHzw=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=ANW0UvDLbWFxqo8uZAAYCKtkmlZkTZ05dJbyugP3uDD/hxs0XP77Pkk/FYHC9sMtpAVHim60Wc6cYX0xVTxwsHCK16Whhtb7WQwF6Nyp0mX6YwMLFRGsTBN6fH1gXcWOEa1/SgtY27dwhl80kwVk77Y3DrEzmVTLHRt14IXVuG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from fsav311.sakura.ne.jp (fsav311.sakura.ne.jp [153.120.85.142]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 413Arep7052729; Sat, 3 Feb 2024 19:53:40 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav311.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav311.sakura.ne.jp); Sat, 03 Feb 2024 19:53:40 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav311.sakura.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 413AqOr0052397 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sat, 3 Feb 2024 19:53:39 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: Date: Sat, 3 Feb 2024 19:53:39 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 3/3] fs/exec: remove current->in_execve flag Content-Language: en-US From: Tetsuo Handa To: Linus Torvalds , Eric Biederman , Kees Cook , Alexander Viro , Christian Brauner , Jan Kara , Paul Moore , James Morris , "Serge E. Hallyn" Cc: linux-security-module , linux-fsdevel , LKML References: <8fafb8e1-b6be-4d08-945f-b464e3a396c8@I-love.SAKURA.ne.jp> In-Reply-To: <8fafb8e1-b6be-4d08-945f-b464e3a396c8@I-love.SAKURA.ne.jp> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789874807713540365 X-GMAIL-MSGID: 1789874873288005633 Addition of security_execve_abort() hook made it possible to remove this flag. Signed-off-by: Tetsuo Handa Reviewed-by: Kees Cook --- fs/exec.c | 3 --- include/linux/sched.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index d6d35a06fd08..c197573b2940 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1865,7 +1865,6 @@ static int bprm_execve(struct linux_binprm *bprm) * where setuid-ness is evaluated. */ check_unsafe_exec(bprm); - current->in_execve = 1; sched_mm_cid_before_execve(current); sched_exec(); @@ -1882,7 +1881,6 @@ static int bprm_execve(struct linux_binprm *bprm) sched_mm_cid_after_execve(current); /* execve succeeded */ current->fs->in_exec = 0; - current->in_execve = 0; rseq_execve(current); user_events_execve(current); acct_update_integrals(current); @@ -1901,7 +1899,6 @@ static int bprm_execve(struct linux_binprm *bprm) sched_mm_cid_after_execve(current); current->fs->in_exec = 0; - current->in_execve = 0; return retval; } diff --git a/include/linux/sched.h b/include/linux/sched.h index ffe8f618ab86..66ada87249b1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -919,9 +919,6 @@ struct task_struct { #ifdef CONFIG_RT_MUTEXES unsigned sched_rt_mutex:1; #endif - - /* Bit to tell TOMOYO we're in execve(): */ - unsigned in_execve:1; unsigned in_iowait:1; #ifndef TIF_RESTORE_SIGMASK unsigned restore_sigmask:1;