Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2332753imu; Sat, 22 Dec 2018 19:25:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uy6oPD2MwArr+y6yKdi10HJcm8u7HlkwAm9VQfXJXkAihxYioB4BjqtQVIDGkAkhiEDSQf X-Received: by 2002:a62:6f88:: with SMTP id k130mr8469567pfc.234.1545535531721; Sat, 22 Dec 2018 19:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545535531; cv=none; d=google.com; s=arc-20160816; b=kjT8FljP0AMdqq/3h7MQvpGo5amkLOCZa+nSb++/cEtcnW7RlwJu5kwHmdvpXLiQxG icQZS5hcQZb2Mf68Nw9mAunSbpb3rgveZc5KuLn78EX2l9Y65hRHFfyh79riir752qz8 nnkSz/p9A/acyQoR5wIyByUc3g44/62zcD8rxZA8ZCCjiA5CU9ntLI2JdNPRm3slwl3k DZsIUy8XZVg+QVWib6yhkqGmcAqChMIvGh1nLSy65YpL4gZzSAO/oaBbdruIjTL0C56B kASwALxMu1CNBReGmfo6Y+vQA4WwCwPQc2yWzHOFzq22t6P5BFTKQBBWmQy1h6x29TUA NaNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=9SN8LImLyDjwxI7cdHrCSZgKb9HBIBdcYlEOiHmK7PE=; b=ZzkouGoOBuI4TICPZzx6YSB/bAw6qgbE+etKmmB1UsOfhp9aplz0yO7wAPH1QWPuOi vQ1BL9UdDy2ivjB/Rvi+LTULiof4VvJq/huGE1ze4yavGL99ZZUf/hYsOfuKR0yBNcBj siQnR6Id+o74+Lt6ADMzNkUqOldbu95d27YtQ1BeaDZVbP6cBGbr915LFbb3DfUwfR+c Y4JcgcsWhCp5THdTFcyQmK3T9ZOvXAidU0//wnyzGcV0F/cYzPuKKSr9rEW30d+kMTdu UNxvOkvqDW6esbYTp6kBwijCAzdX+U6Jhvd+HgT+mfh5NKidAmCvqCoHoSPYY+NQ2l/+ rhYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WNItTatU; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d40si9871579pla.427.2018.12.22.19.25.13; Sat, 22 Dec 2018 19:25:31 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WNItTatU; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404481AbeLUSqz (ORCPT + 99 others); Fri, 21 Dec 2018 13:46:55 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41442 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730799AbeLUSqy (ORCPT ); Fri, 21 Dec 2018 13:46:54 -0500 Received: by mail-lj1-f195.google.com with SMTP id k15-v6so5598873ljc.8; Fri, 21 Dec 2018 10:46:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9SN8LImLyDjwxI7cdHrCSZgKb9HBIBdcYlEOiHmK7PE=; b=WNItTatUbUjMWZLEJMMSg0/NRVug8/MNTSdPXEK9cohyLfkFrWkLV+J1+EA9ZSwWZR pL+zFN/R5toY+yIyorGQh8arn64pmvaVHUr1GPLLepfFief4pwZbUPm8KpqBBlFA8/ei TltGCNeZz+mY25hIcZjIkIbjzBhH1JRt/xuBVya24svLR+dxlw5JDz9zXpqGKbUuXRMV fom7J6vWysKI3ynEACs6aO6QJ1i5atpeXzeP6ru2kR90Xs8W70IgCXIPIwwdeGNMfe55 FI6YYe1J62ndW4Up3Np4x6t7iPXXQBZvvtYqToRDCDV+0sT2Jphcq3iDJZe+q/g4uuTq EeyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9SN8LImLyDjwxI7cdHrCSZgKb9HBIBdcYlEOiHmK7PE=; b=QcLECearp9Pl1xASsEebR3AHXKhxjTWCbIVyP8LG4f7e7l/ezVpoarcFXSSka4TYLS DpJlY+l/YwBdROIJQdG1Q4npwKFPFRCHzh5js3/HKOaAWLvm/XphBVORgDuM2+Gs8oEC cRHyMQcq32P09E41OiR+Beig5h3OIcG0sye54xHC6iQBoPXyNYQ5KTm3w2seDnVQyh/5 AmU8fBp4a4DIEV+yizIDP9bBU0R3elMBn/MZ9GSwq3Yi783FAT2GbEfhEhBc9ljwsQEn i/UbWdaWLLCCcOHQOVsmc8OOlQXhDAIRbYi3XweSSBNMvfTjQtes9XqANsqC3ekdC6qP y/sA== X-Gm-Message-State: AJcUukeNz1fckaT0qOpPS7oe67agFW91gwHNQ/P6718K4clNsTYtoYO0 dL112M6EexUfhK979/eURz9zDf/JHCs= X-Received: by 2002:a2e:81a:: with SMTP id 26-v6mr2530570lji.14.1545418012645; Fri, 21 Dec 2018 10:46:52 -0800 (PST) Received: from ?IPv6:2001:14bb:51:a4c8:5c24:24d7:ca5f:e7d2? (dmhwpt3bffxn8z3-j6k-4.rev.dnainternet.fi. [2001:14bb:51:a4c8:5c24:24d7:ca5f:e7d2]) by smtp.gmail.com with ESMTPSA id v5-v6sm4847827lje.78.2018.12.21.10.46.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 10:46:51 -0800 (PST) Subject: Re: [PATCH 01/12] x86_64: memset_user() To: Matthew Wilcox Cc: Andy Lutomirski , Peter Zijlstra , Dave Hansen , Mimi Zohar , Thiago Jung Bauermann , igor.stoppa@huawei.com, Nadav Amit , Kees Cook , Ahmed Soliman , linux-integrity@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20181221181423.20455-1-igor.stoppa@huawei.com> <20181221181423.20455-2-igor.stoppa@huawei.com> <20181221182515.GF10600@bombadil.infradead.org> From: Igor Stoppa Message-ID: Date: Fri, 21 Dec 2018 20:46:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181221182515.GF10600@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/12/2018 20:25, Matthew Wilcox wrote: > On Fri, Dec 21, 2018 at 08:14:12PM +0200, Igor Stoppa wrote: >> +unsigned long __memset_user(void __user *addr, int c, unsigned long size) >> +{ >> + long __d0; >> + unsigned long pattern = 0; >> + int i; >> + >> + for (i = 0; i < 8; i++) >> + pattern = (pattern << 8) | (0xFF & c); > > That's inefficient. > > pattern = (unsigned char)c; > pattern |= pattern << 8; > pattern |= pattern << 16; > pattern |= pattern << 32; ok, thank you -- igor