Re: [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- On Feb 26, 2021, at 11:06 AM, Piotr Figiel figiel@xxxxxxxxxx wrote:

> Hi,
> 
> On Fri, Feb 26, 2021 at 10:32:35AM -0500, Mathieu Desnoyers wrote:
>> > +static long ptrace_get_rseq_configuration(struct task_struct *task,
>> > +					  unsigned long size, void __user *data)
>> > +{
>> > +	struct ptrace_rseq_configuration conf = {
>> > +		.rseq_abi_pointer = (u64)(uintptr_t)task->rseq,
>> > +		.rseq_abi_size = sizeof(*task->rseq),
>> > +		.signature = task->rseq_sig,
>> > +		.flags = 0,
>> > +	};
>> > +
>> > +	size = min_t(unsigned long, size, sizeof(conf));
>> > +	if (copy_to_user(data, &conf, size))
>> > +		return -EFAULT;
>> > +	return sizeof(conf);
>> > +}
>> 
>> I think what Florian was after would be:
>> 
>> struct ptrace_rseq_configuration {
>> 	__u32 size;  /* size of struct ptrace_rseq_configuration */
>> 	__u32 flags;
>> 	__u64 rseq_abi_pointer;
>> 	__u32 signature;
>> 	__u32 pad;
>> };
>> 
>> where:
>> 
>>     .size = sizeof(struct ptrace_rseq_configuration),
>> 
>> This way, the configuration structure can be expanded in the future. The
>> rseq ABI structure is by definition fixed-size, so there is no point in
>> having its size here.
> 
> Still rseq syscall accepts the rseq ABI structure size as a paremeter.
> I think this way the information returned from ptrace is consistent with
> the userspace view of the rseq state and allows expansion in case the
> ABI structure would have to be extended (in spite of it's current
> definition).
> 
> The configuration structure still can be expanded as its size is
> reported to userspace as return value from the request (in line with
> Dmitry's comments).

Fair enough. And now with the reply from Florian I see that I misunderstood his
point.

Thanks,

Mathieu

> 
> Best regards, Piotr.

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux