From patchwork Thu Jan 26 19:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13117650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F1B1C05027 for ; Thu, 26 Jan 2023 19:38:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36B536B0073; Thu, 26 Jan 2023 14:38:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F2656B0078; Thu, 26 Jan 2023 14:38:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11E836B007B; Thu, 26 Jan 2023 14:38:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F39A36B0073 for ; Thu, 26 Jan 2023 14:38:01 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BE223803CF for ; Thu, 26 Jan 2023 19:38:01 +0000 (UTC) X-FDA: 80397960762.18.3B2FAF0 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf11.hostedemail.com (Postfix) with ESMTP id EA22E40011 for ; Thu, 26 Jan 2023 19:37:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fpC9OxtB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of 3ltbSYwYKCLMlnkXgUZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3ltbSYwYKCLMlnkXgUZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674761879; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aLjaaxPJUorXnCMktZtzjKFOG8Xxelv9KGA9flqeCpQ=; b=EElpv6vCg1FsHRG9ha3YV+3Ftlc68Zqpop9aAle7BfeLIEcR6DZZqsp+Fc8yEzgqxM7x/m tBHJw0pT/E6qZke9SLKZ+tDrFY0FMF9ERcOdQ/tBXghRZKX1uMSJLMjmQenBp29K73tmk0 fdgRPk6PexPxuFQVMijIGuQni+m+mCw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fpC9OxtB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of 3ltbSYwYKCLMlnkXgUZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3ltbSYwYKCLMlnkXgUZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674761879; a=rsa-sha256; cv=none; b=urX/vsBmrvoLbbE7uSa5nELnU8AyJ5mPn1l8ysESSW1oMqIskB57JG14iN5FjfhbXlq6Ci nf2sL8GSUCaYVd+WBlCL0/olFKkqu60cZ8CoKPbQOcmUvLYOKse+NwkYVqbKpQ1+ivw2Iz lJVUkdK38vq5/uKPD8tFMHktCXqmco8= Received: by mail-yb1-f201.google.com with SMTP id x188-20020a2531c5000000b00716de19d76bso2925379ybx.19 for ; Thu, 26 Jan 2023 11:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=aLjaaxPJUorXnCMktZtzjKFOG8Xxelv9KGA9flqeCpQ=; b=fpC9OxtByMrsgeuCLlTqjq7ljheyeUGFByxdovFvi/BEZbaqTBtYfqbw7mV85n35vh nsJw1tLg82ZBRg3RV9Utdbg2g8s0Gs6HglMnvLMVN1RCTr4mkBoD2v2oZh4Mjh9w/Usr DL7mn5GFR4iC1hBs+0CvTUhQnmsv06W09b6suBaVdlve2NmFj/hGVpWM4xqWu44vFGv+ cln+RN7Rzpw5J9WfB/zYjO6KEwxRe8QhOmkLvUNBVLba9roo72RSbcTHiolp9Ji6xuqA dACq72jx3kgKLuzmXwAspaoItebJfeBLbx4oDjP1Exnk9IXVYclbAW1J4WBLbHjzpPE8 Y+sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aLjaaxPJUorXnCMktZtzjKFOG8Xxelv9KGA9flqeCpQ=; b=UaXVuKPjwFVkVgPbictbDRXoFbwAYnLBxi4UPSE8Gvu5tjJimstNqs1JRYVMCv95ZM Zr709Io3y2NlrNJN6LP35OYszSKjQOrsDdGRi9LgJljy6M5FaP41YKz3QHcosmVAPJQc QuA07J20QDAtyqukCKLXTtnfLQ140C1gBeydum2JTM8kJ4f6MlQTLPgt0ExoQ3MxAnh/ 1cU9wglk6Cei7RD+t/4wYccx2ryAGBqOQFbMK/XkglmRTPxodoRFd3ouKOHVl4bhsxIq xUXXJW8RinEBBXFydFNl/391SSrv1/4taXM5KfbRpoIAvDnjjjKhFCkUfnhMO3OBqQ+v CmMg== X-Gm-Message-State: AFqh2kq1ZFU5tqF7hAozvh0lACGM+xYp2HesyzpR9gHnbhOMBQLMqFBV Ej9+N2Wrje0R4x+At1kBP3MYCvJvX8c= X-Google-Smtp-Source: AMrXdXvThl7i+LdwZ0FvFdLYZXBmPQfzv8R5JgH5MisJqIZuH2YNlDhICDf5h1c+oIs087t+N+fAgYzZdrs= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:d774:88af:bab3:648d]) (user=surenb job=sendgmr) by 2002:a0d:da83:0:b0:3c3:8b8e:13ee with SMTP id c125-20020a0dda83000000b003c38b8e13eemr4101612ywe.77.1674761878986; Thu, 26 Jan 2023 11:37:58 -0800 (PST) Date: Thu, 26 Jan 2023 11:37:46 -0800 In-Reply-To: <20230126193752.297968-1-surenb@google.com> Mime-Version: 1.0 References: <20230126193752.297968-1-surenb@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230126193752.297968-2-surenb@google.com> Subject: [PATCH v4 1/7] kernel/fork: convert vma assignment to a memcpy From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@techsingularity.net, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, paulmck@kernel.org, mingo@redhat.com, will@kernel.org, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, kent.overstreet@linux.dev, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, rppt@kernel.org, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, leewalsh@google.com, posk@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, surenb@google.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id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QluQE5Ded8niKb2imiq7pcTGYIfilhv7HjT4dgvwngmcCtB75iZAxyuFl/DRGzAW/rlAGReZxNfLFGDymUqmfCASbmfB2MPsGLpItfWD7i3aTYe/Lecnrb8dLuoCq802IeEHlnh3HafhhjjufnhoYR7jyan7gJYPbPnEp24u2vQysFjxP4Uy6P+QlL0qK8fCpl3gNo+QKHcg/WusAzaOfH7Y4KZe1w3Vm/sYJte7VTv4jm6jvrET1VXofTqAdufvgff2+6Ik59weXZov1ghmoXPnoS5PRk0Q2bgNEiHLPENkFrG6fck/xHFfdCKZ5oLiPCWaWxqkCDzVxXKNDMRXtl7asqSXE30xFaP6OM69MW+Mi0FAKky8mBkRZbS2IeaeFo+qLnKxVoKpTDMeCVqpAtTQjC1x55vRehoK9EtPGJvmlBhLQZpSc+rKsMF3aYJ7stuszRKIXZ/VPliKeOUl1IuYfwyjYNVNQyZZJCnq5xmRgEnuySByYkCfH0mN3AIIdRissPqEmMt5EaWHk/zAyjPfbwe6alfKiR7ycBzc4SNyGcOKjaaYp7+hZ9LG6mz13h7ofdJvOGsqEly7yexB4ybat2dfj2AI5ldAKiNSoMmW0z32VUIaemDeGFNdnsn7GLZyR25LPlo9xs52CFg1KccUjhlalU+V5tMHAMaSO/lsmw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert vma assignment in vm_area_dup() to a memcpy() to prevent compiler errors when we add a const modifier to vma->vm_flags. Signed-off-by: Suren Baghdasaryan Acked-by: Mel Gorman Acked-by: Mike Rapoport (IBM) --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index 441dcec60aae..9260f975b8f4 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -472,7 +472,7 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig) * orig->shared.rb may be modified concurrently, but the clone * will be reinitialized. */ - *new = data_race(*orig); + data_race(memcpy(new, orig, sizeof(*new))); INIT_LIST_HEAD(&new->anon_vma_chain); dup_anon_vma_name(orig, new); }