kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Query Regarding Stack-Out-of-Bounds Error
@ 2024-08-26 12:34 Muni Sekhar
  2024-08-26 19:46 ` Valdis Klētnieks
  0 siblings, 1 reply; 4+ messages in thread
From: Muni Sekhar @ 2024-08-26 12:34 UTC (permalink / raw)
  To: kernelnewbies; +Cc: LKML

Dear Linux Kernel Community,

I am writing to seek clarification on a potential stack-out-of-bounds
issue observed during the calls to for_each_set_bit function or
find_first_bit function, specifically in the following code snippet:

static struct cmd_info *find_cmd_entry_any_ring(struct intel_gvt *gvt,
               unsigned int opcode, int rings)
{
        struct cmd_info *info = NULL;
        unsigned int ring;
        ...
        for_each_set_bit(ring, (unsigned long *)&rings, I915_NUM_ENGINES) {

In the above code, a 32-bit integer pointer (rings) is being cast to a
64-bit unsigned long pointer, which leads to an extra 4 bytes being
accessed. This raises a concern regarding a stack-out-of-bounds bug.

My specific query is: While it is logically understandable that a
write operation involving these extra 4 bytes could cause a kernel
crash, in this case, it is a read operation that is occurring. Would
such a read operation still be capable of crashing the kernel or
resulting in unpredictable system behaviour? If so, could you please
explain how that would happen?

I appreciate your insights and look forward to your guidance on this issue.


-- 
Thanks,
Sekhar

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-31 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26 12:34 Query Regarding Stack-Out-of-Bounds Error Muni Sekhar
2024-08-26 19:46 ` Valdis Klētnieks
2024-08-27 10:31   ` Muni Sekhar
2024-08-31 17:19   ` Muni Sekhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).