Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp632184rdb; Thu, 15 Feb 2024 10:17:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJgMpb/+8V1CSXzJ1t/9gjwWxiSs4wCaCvGG3QcTpSy4xF5aYDcJXa1tPrM3U81xabgRfvN55hNMOZRC5w7x4QcYMUIt1dqnue36er9A== X-Google-Smtp-Source: AGHT+IFe6qqwYMN1JRzq3eEn8EOnoWVBNnCQhjFI062X1ghEhVng4/i8fisKf+3VjDokdQxEquSE X-Received: by 2002:a17:906:da03:b0:a3d:1249:25dd with SMTP id fi3-20020a170906da0300b00a3d124925ddmr1703808ejb.15.1708021041971; Thu, 15 Feb 2024 10:17:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708021041; cv=pass; d=google.com; s=arc-20160816; b=TOfDjc/AmUKnI7XmeE19FwCY7a4KQ7ND3GM2i9y9DJ5+v3IPQeUY5uRDfZnMxyIvJY W5m0j2wVYsDWTU3ECoAVb/AaWiOW8xOQNkPDnHSac86IBNAepS6JOC8J0SCkbIThp+fC fpLUxd4QJd2G94CpJRMYnHgsE83dIKCaEh7YWg2wPntJEO1Z+NgtB4sbJu/qyYlcbvcT uk4xk4gIw0uP3Mqxn3MkOoJcB2wDdg7M5CGbLMza4z41wZO0UzXz3HKV0GApDJgdSBoQ NucYjsetJEw8cU2rE3+zbGnbC7AVV8VwTDHEtFLwDXatXkjunmfrH3sajyivYchtVqej UtgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=5PQMJU8VBCATAr8+bfgPz9ZOvObk7WnHIMIqwe0D4ho=; fh=juVVnA/HAeP0ClmHQp9jhKb9mQ7W2qFRNHQpiUDcz0g=; b=OBKMJ6qHVlLIK7cD6xLUrOxzz9ODMyPLbLMp8mqQjPjwlflbAwmzmZKCGLEEiMmiAq Ml28N0WU4skAJfZ5Xod52qzRvfOgwOqj0bsVB6TuaFGzOaXtO0YJs+Nn4xPxesPnGZB9 qq4cevRg2tqJz82TYaoIiRKC2oXNDz00DaxEmO4OvPkJWq0zWrV5tftzHvVfr+k+f3cX oZUcvxQL/ULmBrbuCf+7DWGCgH/8iwRCzKL9qch+0FlFCPbYgk7dYuoMWvOCepDyTJud nKZcheWtbviU2ukV6aKKSXIFBLtfUuWguo4fJnUD7QkKdxwlM9iwUmhufh4KObOenZpU 7ZrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QZjFrhjO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67484-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67484-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d18-20020a170906371200b00a3db7ac8fd4si248008ejc.298.2024.02.15.10.17.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 10:17:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67484-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QZjFrhjO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67484-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67484-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8874B1F223C6 for ; Thu, 15 Feb 2024 18:17:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 278901384B8; Thu, 15 Feb 2024 18:17:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QZjFrhjO" Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A771513173F; Thu, 15 Feb 2024 18:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708021034; cv=none; b=OQKv3VYqWHQQlrJ6qGf/I8C0hiJqL/QwCanPDxps/iwOn+CBW10okdWUpPL9bUENjROu0hrZRTmJy+i3PlpgHEh9z0P1pV9ukGDCYV45eLIF37bCEAY7Lxp02jkOlE7L7B70Z4fmVx+mnp7ivvLzevrg6RjM4gqHS0OA4LxGSHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708021034; c=relaxed/simple; bh=xGhiyaV9i6rlKLrExFnE/CpescGwgSNkb44LB7gAni8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pmIIaEyrTDf1eFnu4mZI7kyPoY5kOEfx9sapwP2kMZn4DQtFLfjjeUKvdm1YWpK5C6GTmbfjQIdlNMb0ToIcLfC9DPE2yLK1sOl13sfUcKs1jfqWED+cTbLjM+utdIyHAEUZC5aq5yJEL2TU485efezAzMdtvteH5VfbjIezLJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QZjFrhjO; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1d944e8f367so11153485ad.0; Thu, 15 Feb 2024 10:17:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708021032; x=1708625832; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=5PQMJU8VBCATAr8+bfgPz9ZOvObk7WnHIMIqwe0D4ho=; b=QZjFrhjOhmuQJckQlzIBVM/ZNVzSJV8/BQSyiywPorDtDBqjXKwEXgQMTvGbPfVDq5 sQqcYqgTWQGUh/72GFwEeb5TPC7xCtyTDlgXd/rakQPzfuWsYuw+H11L/xgjeUrcAFqP tCCKCHC80UN7Z7h8okv3poNKjHDJrHIT3ZuSw/QEFKp/Qm0/wqQy2zgBZ7i2gzuD3zb/ QkS85+PjAO9I+wOg9l/5tCLGc/KsTdVXftWYN09sv71WP0gyoWh1U6IGnoJ+pZdC64km WAtmi5ZYRoXqhZMv1yVs6gpTaEbRUi2bDwbhh7ybYNNH6ti0qiZoc5hDpxagVtQTXX4S 85zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708021032; x=1708625832; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5PQMJU8VBCATAr8+bfgPz9ZOvObk7WnHIMIqwe0D4ho=; b=HiLpMzr6/yktB592ONxS6ZEVmVNre/REyeKCkVMl3HaR+qL+isG4M1gcYez1l8VG3l rlfxA8H+SINxCRNFXxXiq5C5hcmbXsHMfFSRAdvImMijUbrTcB5kZOJD8geX6YR/S4Tt 3h3Gbk3G9Da10bB2JW/+8DktQJ1mKuT5TAK2bJhCQvGojMGQpwICLmTkQcdf1b8zOYJE U+NxrBk66kPFNHvRuw8hBjSqbxUN4Lu1LZPki+0L0gKhSj+8qusTZR8LGsuFo2OjiU4Y Is2VYvJwhV6W+JGVrkb/tNm8PwuaMgiYYjGzIOnjKzNyqFpa+vGAetXvCLoXbAP3NUnm RsZQ== X-Forwarded-Encrypted: i=1; AJvYcCUgYpFD/bKNY9tL1I3OvmkXVny+ZsaXxT6YQDWpWG4j1gVldUuDHHNU+Ho0XsudYAHjMcYX7PHSKO4LSi7X4oZDYKOicECBy4gMo+oZ X-Gm-Message-State: AOJu0YzMWLFaqRT9cD2S9jJQlFo7LqzpYb0AuDyxoIlj7WJGm4vfeRTK nyS1zgvqq8h/FO8rjXif6wIteOvgfa0v8Abfi8yWhue42cCLnJ4Fwyl64q8J X-Received: by 2002:a17:902:d548:b0:1db:4419:e933 with SMTP id z8-20020a170902d54800b001db4419e933mr2915151plf.17.1708021031935; Thu, 15 Feb 2024 10:17:11 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id kj4-20020a17090306c400b001d9ed80607esm1556484plb.126.2024.02.15.10.17.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 10:17:11 -0800 (PST) Sender: Guenter Roeck Message-ID: <34c8d6f6-3449-4a5f-b8c8-50faf1621714@roeck-us.net> Date: Thu, 15 Feb 2024 10:17:09 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 2/2] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Content-Language: en-US To: John David Anglin , David Laight , Charlie Jenkins , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Al Viro Cc: "linux-kernel@vger.kernel.org" References: <20240214-fix_sparse_errors_checksum_tests-v8-0-36b60e673593@rivosinc.com> <20240214-fix_sparse_errors_checksum_tests-v8-2-36b60e673593@rivosinc.com> <2ec91b11-23c7-4beb-8cef-c68367c8f029@roeck-us.net> <4723822c-2acf-4c41-899c-1e3d5659d1d8@bell.net> <1e302d8f-4e94-4278-b556-b8fc54956efb@roeck-us.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6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qYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/15/24 09:25, John David Anglin wrote: [ ... ] >>>> Source: >>>> >>>> static bool pc_is_kernel_fn(unsigned long pc, void *fn) >>>> { >>>>         return (unsigned long)dereference_kernel_function_descriptor(fn) == pc; >>> This looks wrong to me.  Function descriptors should always be 8-byte aligned.  I think this >>> routine should return false if fn isn't 8-byte aligned. >> >> Below you state "Code entry points only need 4-byte alignment." >> >> I think that contradicts each other. Also, the calling code is, >> for example, >>     pc_is_kernel_fn(pc, syscall_exit) >> >> I fail to see how this can be consolidated if it is ok >> that syscall_exit is 4-byte aligned but, at the same time, >> must be 8-byte aligned to be considered to be a kernel function. > In the above call, syscall_exit is treated as a function pointer. It points to an 8-byte aligned > function descriptor.  The descriptor holds the actual address of the function.  It only needs > 4-byte alignment. > > Descriptors need 8-byte alignment for efficiency on 64-bit parisc. The pc and gp are accessed > using ldd instructions. > Maybe code such as pc_is_kernel_fn(pc, syscall_exit) is wrong because syscall_exit doesn't point to a function descriptor but to the actual address. The code and comments in arch/parisc/kernel/unwind.c is for sure confusing because it talks about not using dereference_kernel_function_descriptor() to keep things simple but then calls dereference_kernel_function_descriptor() anyway. Maybe it should just be if (pc == syscall_exit) instead. The entire code is really odd anyway. ptr = dereference_kernel_function_descriptor(&handle_interruption); if (pc_is_kernel_fn(pc, ptr)) { and then pc_is_kernel_fn() dereferences it again. Weird. It looks like commit 8e0ba125c2bf ("parisc/unwind: fix unwinder when CONFIG_64BIT is enabled") might have messed this up. No idea how to fix it properly, though. Thanks, Guenter