Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp131446pxy; Tue, 4 May 2021 20:55:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSqADKriGBaJKu/QlmVkca3kwFj/MwtNlE9tJRtm9lA9kviE1x1ZroFbXy1LKNCqhGnqBW X-Received: by 2002:a17:902:d718:b029:ee:cf89:57ea with SMTP id w24-20020a170902d718b02900eecf8957eamr16047396ply.3.1620186936737; Tue, 04 May 2021 20:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620186936; cv=none; d=google.com; s=arc-20160816; b=bPxh9kOPk+ZWJZSi0CHN119e5v0Ql+dTiPQ3VUc+f9LbZ8gKFtpkCaQq1P3JtBHaGt c+oQ6uQH65Tw+hNVT7sCdjVyLZT6GptTtPXdecSHxu9GOFCVVgynWYOm8rK5cfH0py3/ 2eHANRe4yo8XjQSi6n23odVvw3bNIaReOgx4sjM9HoRwXzpr5pHYt3T8cGVzEo+TGx2O 0JXHQYWG1yQsJG7wYFht+IgdbV5za0XB7Z33o4lKZb63Kbo/ZXCrm9GUfujd24EGO12w ZkB0r6Gx2i7rf1Q5tZs6UpGHHq5Vc46AyOLKIMREOOKOMgZtO18k+gWcZ/HO78tNq0mz y+8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FdYnIi3+wvcewiyb12JYscUQLF6f+8/X4sFgHiL/c/s=; b=xD6id3AFtHRLojIsjK5S98S5kvve4KQLkgBV5Qh5Ruozo8LWxXuKNmzahyZVT4rkss u+UBXeTKQF6p4yixSJnubhs4pNyh7fWUkTLbq1OMf3g3HUFYLMjYPR/80AvG4mS2Ee4J o9CcFupEIQDiusZtl2hF64dVI4eIjJBdz67RQJ18gwvW9CyfX36HqUqfWugW2RaXd4oR xYerpao6c8sRuD/+ZQo3E5Ai2wj7GHKFlOh/ipLUrSgLerG3+Pukii2FijahH1E9FEd7 ZN1gxFTmxuzZzM8S0YUzoNHviqhvizaGKlmKZ6tRItY/uESqsTHoGdHqbPjGF/9ElkEI 5Ipw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W92L8L1s; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay12si5881670plb.357.2021.05.04.20.55.24; Tue, 04 May 2021 20:55:36 -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=@redhat.com header.s=mimecast20190719 header.b=W92L8L1s; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231439AbhEEDzs (ORCPT + 99 others); Tue, 4 May 2021 23:55:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55832 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbhEEDzr (ORCPT ); Tue, 4 May 2021 23:55:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620186890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FdYnIi3+wvcewiyb12JYscUQLF6f+8/X4sFgHiL/c/s=; b=W92L8L1suAdEwMLNHJ1pAlN3D/LwIx6Rg/EDmx78E1NFgr5xXRrn3D0u3yIJ1075iuhKNL JICOgJ7y/LKIt9oPLKPN9Ejhw4vF64bBIYRAW3M4bJO3y0S75zufNPK0wwRUXSAfgP+Naa /i0WzTx66fMLmSFHGwEg1iUJf6+4VAk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-418-i94IWRkRO6GZ6Gq7awREJg-1; Tue, 04 May 2021 23:54:49 -0400 X-MC-Unique: i94IWRkRO6GZ6Gq7awREJg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60918818401; Wed, 5 May 2021 03:54:47 +0000 (UTC) Received: from treble.redhat.com (ovpn-115-93.rdu2.redhat.com [10.10.115.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D7C810190A7; Wed, 5 May 2021 03:54:44 +0000 (UTC) From: Josh Poimboeuf To: Al Viro Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Will Deacon , Dan Williams , Andrea Arcangeli , Waiman Long , Peter Zijlstra , Thomas Gleixner , Andrew Cooper , Andy Lutomirski , Christoph Hellwig , David Laight , Mark Rutland , Borislav Petkov , Arnd Bergmann , Stephen Rothwell , Sami Tolvanen Subject: [PATCH v4 1/4] uaccess: Always inline strn*_user() helper functions Date: Tue, 4 May 2021 22:54:29 -0500 Message-Id: <8cf8f43ae31e63be1858d156d18a2180813c8702.1620186182.git.jpoimboe@redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CONFIG_DEBUG_SECTION_MISMATCH uses -fno-inline-functions-called-once, causing these single-called helper functions to not get inlined: lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0xa3: call to do_strncpy_from_user() with UACCESS enabled lib/strnlen_user.o: warning: objtool: strnlen_user()+0x73: call to do_strnlen_user() with UACCESS enabled Always inline them regardless. Reported-by: Arnd Bergmann Reported-by: Stephen Rothwell Reported-by: Sami Tolvanen Signed-off-by: Josh Poimboeuf --- lib/strncpy_from_user.c | 6 ++++-- lib/strnlen_user.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index 122d8d0e253c..388539951116 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -25,8 +25,10 @@ * hit it), 'max' is the address space maximum (and we return * -EFAULT if we hit it). */ -static inline long do_strncpy_from_user(char *dst, const char __user *src, - unsigned long count, unsigned long max) +static __always_inline long do_strncpy_from_user(char *dst, + const char __user *src, + unsigned long count, + unsigned long max) { const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; unsigned long res = 0; diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 1616710b8a82..378744e96039 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -20,7 +20,9 @@ * if it fits in a aligned 'long'. The caller needs to check * the return value against "> max". */ -static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) +static __always_inline long do_strnlen_user(const char __user *src, + unsigned long count, + unsigned long max) { const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; unsigned long align, res = 0; -- 2.31.1