Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp651959rdb; Thu, 15 Feb 2024 10:56:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXijlQcvqQGup7bm+3MjU/Mf3oSmwYqNQXs21xPSZzkA7GmY+ElO6vvXFHZI8hUWauK1KDneE0IMEDDAuKxsKck2dwE/3xQJeiv99ttiQ== X-Google-Smtp-Source: AGHT+IH6qYaqZxz2yZnBFWZHJ73P7f4DbAU5wOXE2+BJJmclgMMObPD+zOpQy3bLI2A8bXegaKoO X-Received: by 2002:a0c:d992:0:b0:68d:ea7:164d with SMTP id y18-20020a0cd992000000b0068d0ea7164dmr2375957qvj.58.1708023412928; Thu, 15 Feb 2024 10:56:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708023412; cv=pass; d=google.com; s=arc-20160816; b=NMI5pNP/LroksORmfMHatnKvAODx0z+gU4Tk2Ld0/DEbilbfERWz/R8u09WunViGwI Wf+/PmYThnpTV/djdQo6Dw8/zAiyzYyGYT832hMOzPnL8PHFKws/4xqu1H0fjUkCxOvM 35TFNd2cC/ym41HESGmRhj8CW/MLIhJ7BUjT8McwPiFo/I20g/oQFcH4vOZP81xDarTB QAeft/nV3CwbE22+Q8ECV4Ws6UrqMdMCvjsLZyqsdp8KufxOU0CHZcZmaq3OiF6Y/7X7 u1RuKqHp9anxZBH9KarVCgrWUFClWwdQ3KXUGZ4RP+/CENEqQV1Hi6iMHroG5FQmjGa0 G9bQ== 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 :dkim-signature; bh=S3ZkdKdSM97Ryio1K95PdUfsu1Zs9FEuw3CMKBjbQ6k=; fh=1SZlCjDK9tOd3Etv05DCwSskJmU6D5My3EqmtVgEHZw=; b=H8o2Eh1yVK+bUd2Gh/G6vKW7Clb+cfjBeKvFzJu+IYSVerAuppisMUDkxB1XLHZKjg HAPKoaZmerPgSOHqf554kzwN7Ftl/bX+owRQ63D7ieTmMVQ0txr4MX+gCx2R7boZCrqJ dgJLvhXNr99FoAdKYFD/IfChBFWYHgr6OJj6i5JPWVLzz1+am69WdoepzojqfqF9Ye6w gT/Py3syEjdAfq/Bw4ItkPCesSNEksZbmK5ioXRTvf2qAs/10lnxYOq4fPyIx4O56gh0 M++Zm/gYWTixllqNZfXoCLsHjrCgFrRu4k49rp7Lo7XxmdyLLfhRB23nAxuJiqZmHaTW P8yg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@bell.net header.s=selector1 header.b=e08WsBox; arc=pass (i=1 spf=pass spfdomain=bell.net dkim=pass dkdomain=bell.net); spf=pass (google.com: domain of linux-kernel+bounces-67541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67541-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m11-20020a0562141bcb00b0068cbd994768si2004376qvc.566.2024.02.15.10.56.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 10:56:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@bell.net header.s=selector1 header.b=e08WsBox; arc=pass (i=1 spf=pass spfdomain=bell.net dkim=pass dkdomain=bell.net); spf=pass (google.com: domain of linux-kernel+bounces-67541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67541-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id ACB601C2180E for ; Thu, 15 Feb 2024 18:56:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E3621386C5; Thu, 15 Feb 2024 18:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bell.net header.i=@bell.net header.b="e08WsBox" Received: from cmx-torrgo001.bell.net (mta-tor-001.bell.net [209.71.212.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6C4A1EA7C; Thu, 15 Feb 2024 18:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.71.212.28 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708023405; cv=none; b=H/5LmWO/Hhxy/bG2ay2ENlbwXT9urJvAtVqM1mZbTRqVGEGkO4ioEiMvpB5/iQqOduf/TwXvGx/LXLmD7y0fbo7Z5JN7cVOq7tEguUgHAarg5JDViMFtV67eJT2avj5SgKJmBX4L0y3lPbB6coGTGw5G6Bj7VpIFBDtoUQtQUb4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708023405; c=relaxed/simple; bh=gER4Vd+ai70jUG45UghcGjdobwH4FoQ8GObQlj7lTyI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HxuNt3/GU0/i16KQcwNtravBZp3eZ4JGiYQIo30QSCSICTIIYEb8JvANSsTktvTSUmELmQ8Ek7/IfJSrx617YKEnUJsfQGLNiZfxaA1vcoWl54e1urPCWANhIIB/2cT4cwCYmQ+mTUUUn8zFUUnEIbpf384ECmdPuauJ3kn/kkQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bell.net; spf=pass smtp.mailfrom=bell.net; dkim=pass (2048-bit key) header.d=bell.net header.i=@bell.net header.b=e08WsBox; arc=none smtp.client-ip=209.71.212.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bell.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bell.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell.net; s=selector1; t=1708023403; bh=S3ZkdKdSM97Ryio1K95PdUfsu1Zs9FEuw3CMKBjbQ6k=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type; b=e08WsBoxyDP5aRShEqqYqaN9k67cVGBk4XZd4TMs1ptL9oHTsNw96gSJqWgCc4GM1fzp3Z+hVxuCxB9pfUBNJbPlAdxEjfwl6qVQ0smG7KW/M+JrOu73KLTH3fkJWW7IVe5LF48aOejnxVujVPQcLp08C/XJNy/qlXLWj3jNdfKNDIwTaKbPLRyGh/RzDFfVV1ICjxq8/wJS5zoaiq+qlNGMLpPQc+tiJZ53vgV6RoYSG8rHTzMSJK+rP6oyi8ZRboYbBD3UXZqaLrECjANpDOw9diLe0xigAT65pKU0F13zUKaa/bj6fU6dxQy8uxCduABCCgrUiKRrXp/cFmxPPA== X-RG-SOPHOS: Clean X-RG-VADE-SC: 0 X-RG-VADE: Clean X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 65CD68AA0011B80A X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvledrvddtgdduudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuuefgnffnpdfqfgfvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheplfhohhhnucffrghvihguucetnhhglhhinhcuoegurghvvgdrrghnghhlihhnsegsvghllhdrnhgvtheqnecuggftrfgrthhtvghrnhepjeelffffjeehgffgueehleegfeegueeigedtkeffgeduueetffegffejudekgfeunecukfhppedugedvrdduvdeirdduuddvrddvfeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddvrdeglegnpdhinhgvthepudegvddruddviedrudduvddrvdeffedpmhgrihhlfhhrohhmpegurghvvgdrrghnghhlihhnsegsvghllhdrnhgvthdpnhgspghrtghpthhtohepuddupdhrtghpthhtohepffgrvhhiugdrnfgrihhghhhtseetvegfnfetuedrvefqofdprhgtphhtthhopeflrghmvghsrdeuohhtthhomhhlvgihsehhrghnshgvnhhprghrthhnvghrshhhihhprdgtohhmpdhrtghpthhtoheprghkphhmsehlihhnuhigqdhfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopegthhgrrhhlihgvsehrihhvohhsihhntgdrtghomhdprhgtphhtthhopegurghvvgdrrghnghhlihhnsegs vghllhdrnhgvthdprhgtphhtthhopeguvghllhgvrhesghhmgidruggv X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.2.49] (142.126.112.233) by cmx-torrgo001.bell.net (5.8.814) (authenticated as dave.anglin@bell.net) id 65CD68AA0011B80A; Thu, 15 Feb 2024 13:56:20 -0500 Message-ID: <405791f1-7e51-4ccd-8ec3-b0be6ee8f203@bell.net> Date: Thu, 15 Feb 2024 13:56:21 -0500 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: Guenter Roeck , 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> <34c8d6f6-3449-4a5f-b8c8-50faf1621714@roeck-us.net> From: John David Anglin Autocrypt: addr=dave.anglin@bell.net; keydata= xsFNBFJfN1MBEACxBrfJ+5RdCO+UQOUARQLSsnVewkvmNlJRgykqJkkI5BjO2hhScE+MHoTK MoAeKwoLfBwltwoohH5RKxDSAIWajTY5BtkJBT23y0hm37fN2JXHGS4PwwgHTSz63cu5N1MK n8DZ3xbXFmqKtyaWRwdA40dy11UfI4xzX/qWR3llW5lp6ERdsDDGHm5u/xwXdjrAilPDk/av d9WmA4s7TvM/DY3/GCJyNp0aJPcLShU2+1JgBxC6NO6oImVwW07Ico89ETcyaQtlXuGeXYTK UoKdEHQsRf669vwcV5XbmQ6qhur7QYTlOOIdDT+8zmBSlqBLLe09soATDciJnyyXDO1Nf/hZ gcI3lFX86i8Fm7lQvp2oM5tLsODZUTWVT1qAFkHCOJknVwqRZ8MfOvaTE7L9hzQ9QKgIKrSE FRgf+gs1t1vQMRHkIxVWb730C0TGiMGNn2oRUV5O5QEdb/tnH0Te1l+hX540adKZ8/CWzzW9 vcx+qD9IWLRyZMsM9JnmAIvYv06+YIcdpbRYOngWPd2BqvktzIs9mC4n9oU6WmUhBIaGOGnt t/49bTRtJznqm/lgqxtE2NliJN79dbZJuJWe5HkjVa7mP4xtsG59Rh2hat9ByUfROOfoZ0dS sVHF/N6NLWcf44trK9HZdT/wUeftEWtMV9WqxIwsA4cgSHFR2QARAQABzTdKb2huIERhdmlk IEFuZ2xpbiAoRGViaWFuIFBvcnRzKSA8ZGF2ZS5hbmdsaW5AYmVsbC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EojJWbabF6rJGN5X/UlH5OowVFEMhD9s31tciAvBwy T70V9SSrl2hiw38vRzsl In-Reply-To: <34c8d6f6-3449-4a5f-b8c8-50faf1621714@roeck-us.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-02-15 1:17 p.m., Guenter Roeck wrote: > 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 It depends on how syscall_exit is declared.    unwind.c lies the type of handle_interruption, etc:         extern void * const handle_interruption;         extern void * const ret_from_kernel_thread;         extern void * const syscall_exit;         extern void * const intr_return;         extern void * const _switch_to_ret; #ifdef CONFIG_IRQSTACKS         extern void * const _call_on_stack; #endif /* CONFIG_IRQSTACKS */ This should yield actual addresses. > 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. Looks like. > > 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. This is Helge's code...  I'll let him fix it. Dave -- John David Anglin dave.anglin@bell.net