Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp77906imu; Thu, 20 Dec 2018 17:19:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6YyaKFeuyWK672bgCRgeO5ZWI1+dAV9uPFbU5PfG6+OYpbkg5eVamnoeYHJ/Ufke7UaY/3 X-Received: by 2002:a63:3507:: with SMTP id c7mr439621pga.315.1545355179719; Thu, 20 Dec 2018 17:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545355179; cv=none; d=google.com; s=arc-20160816; b=RnayG+NXOoJGZqAGLtdrZct09eespDY0anBvm0pikt3DjFNpNwT/PEqC/u+W516fqm OnvyHO1VvIJRmUS5YTPLS1slQ6wzFz/7toHm1IW238cPrp4hcBF56t0dVuPFQ2+B+pex e+HMqUp0R+rR+cjxLk2O6pRIBwLpvWWx6XCAcG/NGMxQqLmKTRk55OBWmJ+Q4Dsx6JEl YS9+rn6TZeuCqEfihgv/yeQusTAXx5ABISwbc3HpFI3NJ/ZEjnrY1lo+GYodC5t0o6NC FGQAhGYu2TZ2Ec18xXk7pa+Ppusyn/fMTlNFzk9PCycZSJhj7fzNTwRjBU59jGhDmJmh 4fHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=kCOUs4n6qth70jzak8N5MtDBRe28Nmvl6CAIm8/+G0o=; b=fGOtOo4l2unI4OXmSWR9okoFVwezUfaXITZVlhNia916CE7n4esIkVJhDOmBloSyVH pzDqqtoetRmh19t0uXMcfX/G1avTrcjfd+Q9scEYLKqvo4HGn/lDj0By/LsUMYqxCo2h R6W9vA7NogH7+1LafvGU/8JeXRrsP91Oi9mKA2yx1nRhXh6qalqmEPb//n46gsZT2LGd rKhEw33xYJnJlHYy8/vgpUqfbrfmnvZENFHFT08zpH3ctltmxE5PN3zMCEuN4VW1NfeN TD1dxJMhf7Da2kGcTJ/D+lJ1U0g6xnXgWypNK+HPHWT8NU1mw5GiNn0WuOeO8Uo98wMQ ED3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si20610291pgb.140.2018.12.20.17.19.23; Thu, 20 Dec 2018 17:19:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387504AbeLTRaR (ORCPT + 99 others); Thu, 20 Dec 2018 12:30:17 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50206 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732074AbeLTRaR (ORCPT ); Thu, 20 Dec 2018 12:30:17 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBKHTFRm059172 for ; Thu, 20 Dec 2018 12:30:16 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pgdcm64qg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 20 Dec 2018 12:30:15 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Dec 2018 17:30:14 -0000 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 20 Dec 2018 17:30:10 -0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBKHU9KM23855148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Dec 2018 17:30:09 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 422E5BE04F; Thu, 20 Dec 2018 17:30:09 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13D3BBE053; Thu, 20 Dec 2018 17:30:05 +0000 (GMT) Received: from morokweng.localdomain (unknown [9.80.210.228]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTPS; Thu, 20 Dec 2018 17:30:05 +0000 (GMT) References: <20181219213338.26619-1-igor.stoppa@huawei.com> <20181219213338.26619-12-igor.stoppa@huawei.com> User-agent: mu4e 1.0; emacs 26.1 From: Thiago Jung Bauermann To: Igor Stoppa Cc: Andy Lutomirski , Matthew Wilcox , Peter Zijlstra , Dave Hansen , Mimi Zohar , igor.stoppa@huawei.com, Nadav Amit , Kees Cook , linux-integrity@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 11/12] IMA: turn ima_policy_flags into __wr_after_init In-reply-to: <20181219213338.26619-12-igor.stoppa@huawei.com> Date: Thu, 20 Dec 2018 15:30:01 -0200 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 18122017-0012-0000-0000-000016ED72BA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010256; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000272; SDB=6.01134559; UDB=6.00589903; IPR=6.00914732; MB=3.00024772; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-20 17:30:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18122017-0013-0000-0000-000055878A1D Message-Id: <87pntwumw6.fsf@morokweng.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-20_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=725 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812200142 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Igor, Igor Stoppa writes: > diff --git a/security/integrity/ima/ima_init.c b/security/integrity/ima/ima_init.c > index 59d834219cd6..5f4e13e671bf 100644 > --- a/security/integrity/ima/ima_init.c > +++ b/security/integrity/ima/ima_init.c > @@ -21,6 +21,7 @@ > #include > #include > #include > +#include > > #include "ima.h" > > @@ -98,9 +99,9 @@ void __init ima_load_x509(void) > { > int unset_flags = ima_policy_flag & IMA_APPRAISE; > > - ima_policy_flag &= ~unset_flags; > + wr_assign(ima_policy_flag, ima_policy_flag & ~unset_flags); > integrity_load_x509(INTEGRITY_KEYRING_IMA, CONFIG_IMA_X509_PATH); > - ima_policy_flag |= unset_flags; > + wr_assign(ima_policy_flag, ima_policy_flag | unset_flags); > } > #endif In the cover letter, you said: > As the name implies, the write protection kicks in only after init() > is completed; before that moment, the data is modifiable in the usual > way. Given that, is it still necessary or useful to use wr_assign() in a function marked with __init? -- Thiago Jung Bauermann IBM Linux Technology Center