Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: Linux kernel - interfaces to drivers  (Read 779 times)

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Linux kernel - interfaces to drivers
« on: July 03, 2020, 11:08:50 AM »

Wikipedia’s article on the Linux kernel says

Quote
By choice, Linux has no stable device driver application binary interface.

Not surprising and a very good idea imho; you just rebuild the whole lot, including drivers from the source code, no? So driver code gets recompiled and headers can change.

How much does the source-level ie C fn interface to drivers change in practice though ? Never mind ABIs.
Logged

sevenlayermuddle

  • Helpful
  • Addicted Kitizen
  • *
  • Posts: 5369
Re: Linux kernel - interfaces to drivers
« Reply #1 on: July 03, 2020, 12:12:47 PM »

From memory, I thought there were some rules about in-kernel compatibility.

For part of my career, to protect the company IP, we shipped binary blobs that got linked into the kernel with glue/abstraction layers that got recompiled at install time, and met Linux licence conditions.  But the binary blobs had to make some assumptions about kernel struct layouts, in order to talk to the rest of the kernel.  My memory is vague, but I thought there were rules about major/minor version number, that meant relevant struct layout compatibility could be assumed for all minor versions of the same major.

It sticks in my mind as, at least once, somebody in the kernel group broke one of the rules, altering a struct that should not have been altered. Caused a certain amount of unhappiness.

I'm sure other contributors with more detailed knowledge can clarify, or even dismiss all I have said. :)
Logged

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Re: Linux kernel - interfaces to drivers
« Reply #2 on: July 03, 2020, 01:34:28 PM »

Understood. But I’m not asking about binary api compatibility- rather source-level retaking changes to within-kernel interfaces across releases.

I have never had to deal with the blob requirement much myself; where such considerations were a factor in other domains, say comms, I have not used struct for example, but rather explicit definitions of offsets and element sizes, with eg *(type *)((ubyte *)(p + byte_offset)) = val with helper macros for finger saving and readability. This makes it 100% clear that these details are requirements and a change of compilers cannot break the interface. Another way would be to put introspective asserts in in order to test the realisation of struct, but forgetting one such assert leaves you vulnerable, so that’s why I banned transmission of structs over comms or writing of structs to files.
Logged

parkdale

  • Reg Member
  • ***
  • Posts: 597
Re: Linux kernel - interfaces to drivers
« Reply #3 on: July 03, 2020, 06:28:43 PM »

Logged
Vodafone FTTC ECI cab 40/10Mb connection / Fritz!box7590

ejs

  • Kitizen
  • ****
  • Posts: 2078
Re: Linux kernel - interfaces to drivers
« Reply #4 on: July 03, 2020, 08:01:39 PM »

How much does the source-level ie C fn interface to drivers change in practice though ?

Some of it changes quite often. The chance of an out-of-tree driver compiling against a much newer kernel is fairly low. Within the kernel source, an interface can be changed, and everything in the kernel that uses that interface can be changed at the same time.
Logged

Weaver

  • Senior Kitizen
  • ******
  • Posts: 11459
  • Retd s/w dev; A&A; 4x7km ADSL2 lines; Firebrick
Re: Linux kernel - interfaces to drivers
« Reply #5 on: July 03, 2020, 09:22:09 PM »

@parkdale - thanks for that useful link too
Logged
 

anything