lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b4aa0d0-62b9-484d-a95f-316f5defbc28@amd.com>
Date: Thu, 20 Feb 2025 16:26:15 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>, Valentin Schneider
	<vschneid@...hat.com>, Ben Segall <bsegall@...gle.com>, Thomas Gleixner
	<tglx@...utronix.de>, Andy Lutomirski <luto@...nel.org>,
	<linux-kernel@...r.kernel.org>, Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>, Mel Gorman <mgorman@...e.de>,
	"Sebastian Andrzej Siewior" <bigeasy@...utronix.de>, Clark Williams
	<clrkwllms@...nel.org>, <linux-rt-devel@...ts.linux.dev>, Tejun Heo
	<tj@...nel.org>, Frederic Weisbecker <frederic@...nel.org>, Barret Rhoden
	<brho@...gle.com>, Petr Mladek <pmladek@...e.com>, Josh Don
	<joshdon@...gle.com>, Qais Yousef <qyousef@...alina.io>, "Paul E. McKenney"
	<paulmck@...nel.org>, David Vernet <dvernet@...a.com>, "Gautham R. Shenoy"
	<gautham.shenoy@....com>, Swapnil Sapkal <swapnil.sapkal@....com>
Subject: Re: [RFC PATCH 01/22] kernel/entry/common: Move
 syscall_enter_from_user_mode_work() out of header

Hello Peter,

Thank you for taking a look.

On 2/20/2025 4:13 PM, Peter Zijlstra wrote:
> On Thu, Feb 20, 2025 at 09:32:36AM +0000, K Prateek Nayak wrote:
>> Retain the prototype of syscall_enter_from_user_mode_work() in
>> linux/entry-common.h and move the function definition to
>> kernel/entry/common.c in preparation to notify the scheduler of task
>> entering and exiting kernel mode for syscall. The two architectures that
>> use it directly (x86, s390) and the four that call it via
>> syscall_enter_from_user_mode() (x86, riscv, loongarch, s390) end up
>> selecting GENERIC_ENTRY, hence, no functional changes are intended.
>>
>> [..snip..]
>>
>> @@ -79,6 +79,16 @@ noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs)
>>   	instrumentation_end();
>>   }
>>   
>> +__always_inline long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall)
>> +{
>> +	unsigned long work = READ_ONCE(current_thread_info()->syscall_work);
>> +
>> +	if (work & SYSCALL_WORK_ENTER)
>> +		syscall = syscall_trace_enter(regs, syscall, work);
>> +
>> +	return syscall;
>> +}
>> +
>>   /* Workaround to allow gradual conversion of architecture code */
>>   void __weak arch_do_signal_or_restart(struct pt_regs *regs) { }
> 
> This breaks s390. While you retain an external linkage, the function
> looses the noinstr tag that's needed for correctness.
> 
> Also, extern __always_inline is flaky as heck. Please don't do this.

Noted! I'll try to find another way around this.

-- 
Thanks and Regards,
Prateek


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ