Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1763699pxb; Thu, 7 Oct 2021 14:47:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiq/eWqhMt8kIahep/2dUaoXw6tBC0xTmkj3DPSzy3inWX5yCbss732mWn//rkh3IBzVH9 X-Received: by 2002:a17:90a:3ec2:: with SMTP id k60mr6136879pjc.176.1633643275459; Thu, 07 Oct 2021 14:47:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633643275; cv=pass; d=google.com; s=arc-20160816; b=ZQ/oOtcVN8W/s1egHzCsqfuHpI7gCsEYQzJ1d2bZdJjz1bmJXOt8WzjWnRgMBIAi+Q EOQ+kCHxIaj+ZUBfL65gbvzoKYH2QZTHaLgCvfLXrJSiWJOZBYcYF0tAcHEm6TBsuoQe EGDqBc0GbmWEF1UMrEREEGLHvEZW2fDQa2OYsC8yk4bPl9EBUpr9lo61z7EkwQTZCyU4 77i1OAmTOMOFppMcrRoJgpQ3UmFSg4UZtyg6UX5VetzonEAduoqq9DWF2BTkJT0sgobh DE74Gqc5kof+1toAQltGPMcaAhVhDgqYeobse5GuNno8Ks8A1eglrKccpXq3krv4CHcm NrsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=MFHga1tLW8x69y5rLxdCmPpzPHiabQgoAawWQYe5SvM=; b=1EbwVJNW147ZrXw0RcPyRCuIhjkqhwEjXcHSVrFUC09A/qWC10dTmp6166ELGas5Vv ZTjK8BQ/MJBfnOsCt6Nx7YsqhKFWUGCctHRN4a6cyfcTDTL7JnAl7UMr0J6AtgVfsWYz 03t7mq9o91QowbfTbDlOFoVGv0usDVHO/umno4OGu0o5yRUJCmI5F7w9dNOWlpGiYSKL cThxyQPbNfwmvxGlFpJvm4kAIBXSiAGYDqlfUY3veSmzTi8Ec9vHDiaV9tIdPb0z/kBx 3Zc+fVXpPO55fvmLpRsygfQpHW/KHg/m4dJU5KwkaPCbJOCgnUdysscwOrSIAMpBSzPu HEvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=ekQg185j; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hF4MxpPM; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nv14si15203806pjb.143.2021.10.07.14.47.42; Thu, 07 Oct 2021 14:47:55 -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=@oracle.com header.s=corp-2021-07-09 header.b=ekQg185j; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hF4MxpPM; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242866AbhJGVrx (ORCPT + 99 others); Thu, 7 Oct 2021 17:47:53 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:51220 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242670AbhJGVrh (ORCPT ); Thu, 7 Oct 2021 17:47:37 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 197KYYFs007643; Thu, 7 Oct 2021 21:45:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=MFHga1tLW8x69y5rLxdCmPpzPHiabQgoAawWQYe5SvM=; b=ekQg185joLmBrewRw7Hmn/fFGwAGowXDVzWCnAnflqx90FZWqm4Uw8pcLTxijDoz1VGU NLYv94w812zJ4nzo6yJh/3cZgHI8kDxBQC0DzjQ1rHHzarZdiR0jZrAThpj0m8ZJ7R82 Wp8S7w/YFUi6E4V98O8v+EBOt3vdHRhqloYte40rd1Nz2UDa0FBHg/jeMqyjTEu1Lt88 /5XRgLmq/9dpxWQb+9CSvCFuqs32BEHKZm7dmT1dNy2G6bc1OfRZUogqCs535YK08LCm HSTXSWrqJ5NkJEERqKwbZ5R50+d0E4CudX5fjib5Di88AWvmQXX7TQrO2h9ZimeSpZeC HQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3bj0pw475a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Oct 2021 21:45:02 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 197Le7IP113075; Thu, 7 Oct 2021 21:45:01 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by aserp3030.oracle.com with ESMTP id 3bev7x4uju-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Oct 2021 21:45:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U02PpirQT9riAGyp5ej961xScVcN8Js/iWbTnxp4RbQe4gkEEfSo+kwAtvBm7EQhzMDmOv8HRSBvOwr0OjJ7JEcI1fWDl/eWPLxRV6OOL0Y/xpvmMgpskY+BIVL1jHhxLLQFI1r4+kyS1Iuz6VsSMmdh03sJKrRplaY4a2KEHIRvtCapluzBpViKllFmcXRrkSN3fe8hKp1lxZlexLSZ+vl6hB5oSsaAdxtSavSIQUzRHn5lsy/9e9KRdxBV656OWCVizei+w5PYSOxfFNQJsvOULii7ONRlRgE/Sa7IhJcPnVpq2FzTG3wbefxoF1O8jAdGzcx2BltqQ2S5n70Caw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MFHga1tLW8x69y5rLxdCmPpzPHiabQgoAawWQYe5SvM=; b=Dr4mhFUWmhd5/LioTeuDTKdjqZgcz95xnUSshN+fB8M9H3ZNOgTMAFhL7nUqh2s6Q2NIv6Reb0BleFFUGHjvMfJYV8/ZydYCSSu/x/RXEurVqnpQ7Yg+5P5C8y09KL5f8Fn5W0l9sdoKKXaj1cghjKBVrhJFZ2sH6admbLGgpHWKQvmtFRsvUIPuZuGN2LvOEDK3IRc7vpTKQur23EmzlgtXyWFUKDniqDojQcksGGAABJrkg0YFOSX2F4NVDl7yBblVyOUaBb5OvwlBppY52V/TMPfFYlWN0gDZMQsdFjsqeLAFiXsS1iQElxOBdCE7RTSHFT06n5oxfO+XUUjQ0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MFHga1tLW8x69y5rLxdCmPpzPHiabQgoAawWQYe5SvM=; b=hF4MxpPMSCIQ5WmjhdoT65t/1yq442rLXlwQhYk94f1NIypj912PFWYT2Bk3okJqoM393xIbKIXDCYz1yGbBxOOaXhale2HhpkQ0cwxcUZwERKvka58GJ+oxCzpYlWFGFtvf0XEpv01XHc6sQrcnXdFt5jJQj4AwKP/AaJesq3U= Authentication-Results: linux-m68k.org; dkim=none (message not signed) header.d=none;linux-m68k.org; dmarc=none action=none header.from=oracle.com; Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM5PR10MB1612.namprd10.prod.outlook.com (2603:10b6:4:5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Thu, 7 Oct 2021 21:44:58 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::195:7e6b:efcc:f531]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::195:7e6b:efcc:f531%5]) with mapi id 15.20.4587.021; Thu, 7 Oct 2021 21:44:58 +0000 From: Mike Christie To: geert@linux-m68k.org, vverma@digitalocean.com, hdanton@sina.com, hch@infradead.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org, christian.brauner@ubuntu.com, axboe@kernel.dk, linux-kernel@vger.kernel.org Cc: Mike Christie Subject: [PATCH V4 4/8] fork: Add KERNEL_WORKER flag to ignore signals Date: Thu, 7 Oct 2021 16:44:44 -0500 Message-Id: <20211007214448.6282-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211007214448.6282-1-michael.christie@oracle.com> References: <20211007214448.6282-1-michael.christie@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM5PR20CA0008.namprd20.prod.outlook.com (2603:10b6:3:93::18) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 Received: from localhost.localdomain (73.88.28.6) by DM5PR20CA0008.namprd20.prod.outlook.com (2603:10b6:3:93::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Thu, 7 Oct 2021 21:44:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d5429ac-56f8-4a5e-223c-08d989dbb568 X-MS-TrafficTypeDiagnostic: DM5PR10MB1612: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:590; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: of57Z9XRCfwKVrswFvxuxPNXYugjeL+8cBspUbw/ba1gnXPs3Wg6gteeS0U8bPaSf2m9fmDL9jalqDU3KwQx3KM0x6WXauSTJwBeRShH7MRjTOs1Tb26afKjFX/K2daEGBSzN0Ifg5lvF3Yc4z4ts+peD88+8++PyCQYZcpX1yxE0zpf6aKwP2a39+FAJExPixYHSROq+peS8B9Wa1Wc5uOeUAUoKZ0AWyq3m1ACcuUd+kqSgJWQWKBveP8snKKW4DRhDMRHxFe6pJSpVqPda/uD3c7Vi2/EhsU956TYa/sopAkKp26SX/0/UzG99zTC3Q4+5pNoeH5+SK7Bro90bPhTw9GNo/UQmJ5Fw67m5rVY5nWc6O4jxSJqX68b6Km5Az9nkg2YAPTGaSRqyqfVb5m4KWqXeXk6awNRXfYmmaXg08PMwZ/7T/xyEijpL48s44UFv5JykE4YGD0XoQJX+JrGJ8QMv75HC2FZ40WnW24eT2Lk5WSiAbGQjVX3035IEa7XlJMa4Ct0O9ql4S9zvB84kSFpPj2ot1DHPXK5/LVOJ6RuGm3A4h0u6Gm1WNB6+tHTjunCq6a6aD222bejrlSosJzyxxK1MPbOsfR/Bc3TCkm3IQcnfSZaIMIFmeTn1DEGdpH85jMqBGcSyFfgZLE79fXl4H41+bbR3xi0loFJTmpDqTu9JCj1MgxF4s3wFRG/7a5AwIQ5z90U25lY28Q6dz5ptmrF+D691wIHncc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR10MB1466.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(316002)(36756003)(2906002)(66556008)(1076003)(66476007)(86362001)(186003)(6506007)(83380400001)(508600001)(7416002)(52116002)(66946007)(6512007)(8936002)(921005)(107886003)(26005)(4326008)(8676002)(2616005)(956004)(6666004)(6486002)(5660300002)(38100700002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7Dk0TGjVJwdcNzwnZiJ8o25nYBLWg4q5xTyzC4kokWm3SuD3xbCot58PH5Jl?= =?us-ascii?Q?rg4915jSdHaYTTOkQRBjeTNqReNRf05R0d651yXv7bCk51Ym1OaL0pc7f/a9?= =?us-ascii?Q?XVACGjeWgUQyUe+P5LkK9VQJfhDfTF8omvl5mTxPw+/zfbS0WrRf6pK1XaBD?= =?us-ascii?Q?KG4jD+45ecpwrpijkDTtWNEnM93EMP7pi0//r2jZBBYZE88tqR6Z7ovAJC0G?= =?us-ascii?Q?LyCmdtfw8YsIMYKEjpm4LdhJ9WsYmW7FL+zGN5/GC3E0rxRj9qNyiANoAAcB?= =?us-ascii?Q?7vVChhVSalzvzNrQvi04x962nknwla9q4eaZxEnXdYY1mHqvCaCTkbSejuys?= =?us-ascii?Q?qyKPHun7tJwVs+KGsG7e3xrA4CmOHa4a6Rxm2wgkv7mU27yCgut03aZTALEc?= =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J+gs4AyCjocD9hzFtdXkE28?= =?us-ascii?Q?XmmF9Fx3Sei6eNv2E0A4oltp?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d5429ac-56f8-4a5e-223c-08d989dbb568 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2021 21:44:58.5638 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hdLKcW8oEY6snkmZkKTYNlezwfYFvadjAJNExogUG/pFCSw/KQ4I1SKQ+ENt9o4rjbp/chEba+/BVXg/jTk+dIlnT9EEH+r0Q7UUvkdm4hU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1612 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10130 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110070137 X-Proofpoint-ORIG-GUID: VfJrye7DazUZyPwBq7uLrCn_aZEZrcDx X-Proofpoint-GUID: VfJrye7DazUZyPwBq7uLrCn_aZEZrcDx Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian Brauner Since this is mirroring kthread's sig ignore api introduced in commit 10ab825bdef8 ("change kernel threads to ignore signals instead of blocking them") this patch adds an option flag, KERNEL_WORKER_SIG_IGN, handled in copy_process() after copy_sighand() and copy_signals() to ease the transition from kthreads to this new api. Signed-off-by: Christian Brauner Signed-off-by: Mike Christie --- include/linux/sched/task.h | 1 + kernel/fork.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 1153f9e5d10e..5f3928fe0544 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -21,6 +21,7 @@ struct css_set; #define KERN_WORKER_IO BIT(0) #define KERN_WORKER_USER BIT(1) #define KERN_WORKER_NO_FILES BIT(2) +#define KERN_WORKER_SIG_IGN BIT(3) struct kernel_clone_args { u64 flags; diff --git a/kernel/fork.c b/kernel/fork.c index 3161edac1236..07f9e410fb64 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2213,6 +2213,9 @@ static __latent_entropy struct task_struct *copy_process( if (retval) goto bad_fork_cleanup_io; + if (args->worker_flags & KERN_WORKER_SIG_IGN) + ignore_signals(p); + stackleak_task_init(p); if (pid != &init_struct_pid) { -- 2.25.1